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

Method _destroyVolumes

src/master/http.cpp:1009–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007
1008
1009Future<Response> Master::Http::_destroyVolumes(
1010 const SlaveID& slaveId,
1011 const RepeatedPtrField<Resource>& volumes,
1012 const Option<Principal>& principal) const
1013{
1014 Slave* slave = master->slaves.registered.get(slaveId);
1015 if (slave == nullptr) {
1016 return BadRequest("No agent found with specified ID");
1017 }
1018
1019 // Create an operation.
1020 Offer::Operation operation;
1021 operation.set_type(Offer::Operation::DESTROY);
1022 operation.mutable_destroy()->mutable_volumes()->CopyFrom(volumes);
1023
1024 Option<Error> error = validateAndUpgradeResources(&operation);
1025 if (error.isSome()) {
1026 return BadRequest(error->message);
1027 }
1028
1029 error = validation::operation::validate(
1030 operation.destroy(),
1031 slave->checkpointedResources,
1032 slave->usedResources);
1033
1034 if (error.isSome()) {
1035 return BadRequest("Invalid DESTROY operation: " + error->message);
1036 }
1037
1038 return master->authorize(
1039 principal, ActionObject::destroyVolume(operation.destroy()))
1040 .then(defer(master->self(), [=](bool authorized) -> Future<Response> {
1041 if (!authorized) {
1042 return Forbidden();
1043 }
1044
1045 return _operation(slaveId, operation);
1046 }));
1047}
1048
1049
1050Future<Response> Master::Http::destroyVolumes(

Callers

nothing calls this directly

Calls 12

BadRequestClass · 0.85
deferFunction · 0.85
ForbiddenClass · 0.85
CopyFromMethod · 0.80
validateFunction · 0.70
getMethod · 0.45
isSomeMethod · 0.45
destroyMethod · 0.45
thenMethod · 0.45
authorizeMethod · 0.45
selfMethod · 0.45

Tested by

no test coverage detected