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

Method destroyDisk

src/master/authorization.cpp:349–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347
348
349Try<ActionObject> ActionObject::destroyDisk(
350 const Offer::Operation::DestroyDisk& destroyDisk)
351{
352 const Resource& resource = destroyDisk.source();
353
354 auto action = ([&resource]() -> Option<authorization::Action> {
355 switch (resource.disk().source().type()) {
356 case Resource::DiskInfo::Source::MOUNT:
357 return authorization::DESTROY_MOUNT_DISK;
358 case Resource::DiskInfo::Source::BLOCK:
359 return authorization::DESTROY_BLOCK_DISK;
360 case Resource::DiskInfo::Source::RAW:
361 return authorization::DESTROY_RAW_DISK;
362 case Resource::DiskInfo::Source::UNKNOWN:
363 case Resource::DiskInfo::Source::PATH:
364 return None();
365 }
366
367 return None();
368 })();
369
370 if (action.isNone()) {
371 return Error(
372 "Unsupported disk type: " + stringify(resource.disk().source().type()));
373 }
374
375 return fromResourceWithLegacyValue(
376 *action, resource, getReservationRole(resource));
377}
378
379
380ostream& operator<<(ostream& stream, const ActionObject& actionObject)

Callers

nothing calls this directly

Calls 7

NoneClass · 0.85
getReservationRoleFunction · 0.85
typeMethod · 0.80
ErrorFunction · 0.50
stringifyFunction · 0.50
diskMethod · 0.45
isNoneMethod · 0.45

Tested by

no test coverage detected