MCPcopy Create free account
hub / github.com/apache/mesos / foreachpair

Function foreachpair

src/slave/csi_server.cpp:220–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218 }
219
220 foreachpair (const string& _name, const CSIPluginInfo& info, pluginConfigs) {
221 // Default-construct the plugin struct so that we have a valid runtime
222 // to pass into the service manager.
223 plugins.put(_name, CSIPlugin(info, "csi_plugins/" + _name + "/"));
224
225 CSIPlugin& plugin = plugins.at(_name);
226
227 if (info.containers_size() > 0) {
228 CHECK_SOME(agentId);
229
230 plugin.serviceManager.reset(new ServiceManager(
231 agentId.get(),
232 agentUrl,
233 rootDir,
234 info,
235 extractServices(info),
236 DEFAULT_CSI_CONTAINER_PREFIX,
237 authToken,
238 plugin.runtime,
239 &plugin.metrics));
240 } else {
241 CHECK(info.endpoints_size() > 0);
242
243 plugin.serviceManager.reset(new ServiceManager(
244 info,
245 extractServices(info),
246 plugin.runtime,
247 &plugin.metrics));
248 }
249
250 plugin.initialized.associate(
251 plugin.serviceManager->recover()
252 .then(defer(self(), [=]() {
253 CHECK(plugins.contains(_name));
254
255 return plugins.at(_name).serviceManager->getApiVersion();
256 }))
257 .then(defer(self(), [=](const string& apiVersion) -> Future<Nothing> {
258 CHECK(plugins.contains(_name));
259
260 Try<Owned<VolumeManager>> volumeManager = VolumeManager::create(
261 rootDir,
262 info,
263 extractServices(info),
264 apiVersion,
265 plugins.at(_name).runtime,
266 plugins.at(_name).serviceManager.get(),
267 &plugins.at(_name).metrics,
268 secretResolver);
269
270 if (volumeManager.isError()) {
271 return Failure(
272 "CSI server failed to create volume manager for plugin"
273 " '" + info.name() + "': " + volumeManager.error());
274 }
275
276 plugins.at(_name).volumeManager = std::move(volumeManager.get());
277

Callers

nothing calls this directly

Calls 15

CSIPluginClass · 0.85
extractServicesFunction · 0.85
deferFunction · 0.85
FailureClass · 0.85
atMethod · 0.80
associateMethod · 0.80
getApiVersionMethod · 0.80
isReadyMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
errorMethod · 0.65
createFunction · 0.50

Tested by

no test coverage detected