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

Method _createVolumes

src/master/http.cpp:838–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

836
837
838Future<Response> Master::Http::_createVolumes(
839 const SlaveID& slaveId,
840 const RepeatedPtrField<Resource>& volumes,
841 const Option<Principal>& principal) const
842{
843 Slave* slave = master->slaves.registered.get(slaveId);
844 if (slave == nullptr) {
845 return BadRequest("No agent found with specified ID");
846 }
847
848 // Create an operation.
849 Offer::Operation operation;
850 operation.set_type(Offer::Operation::CREATE);
851 operation.mutable_create()->mutable_volumes()->CopyFrom(volumes);
852
853 Option<Error> error = validateAndUpgradeResources(&operation);
854 if (error.isSome()) {
855 return BadRequest(error->message);
856 }
857
858 error = validation::operation::validate(
859 operation.create(),
860 slave->checkpointedResources,
861 principal,
862 slave->capabilities);
863
864 if (error.isSome()) {
865 return BadRequest(
866 "Invalid CREATE operation on agent " + stringify(*slave) + ": " +
867 error->message);
868 }
869
870 return master->authorize(
871 principal, ActionObject::createVolume(operation.create()))
872 .then(defer(master->self(), [=](bool authorized) -> Future<Response> {
873 if (!authorized) {
874 return Forbidden();
875 }
876
877 return _operation(slaveId, operation);
878 }));
879}
880
881
882Future<Response> Master::Http::createVolumes(

Callers

nothing calls this directly

Calls 13

BadRequestClass · 0.85
deferFunction · 0.85
ForbiddenClass · 0.85
CopyFromMethod · 0.80
validateFunction · 0.70
stringifyFunction · 0.50
getMethod · 0.45
isSomeMethod · 0.45
createMethod · 0.45
thenMethod · 0.45
authorizeMethod · 0.45

Tested by

no test coverage detected