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

Method CreateVolume

src/examples/test_csi_plugin.cpp:589–617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587
588
589Status TestCSIPlugin::CreateVolume(
590 ServerContext* context,
591 const csi::v0::CreateVolumeRequest* request,
592 csi::v0::CreateVolumeResponse* response)
593{
594 LOG(INFO) << request->GetDescriptor()->name() << " '" << *request << "'";
595
596 // TODO(chhsiao): Validate the request.
597
598 Try<VolumeInfo, StatusError> result = createVolume(
599 request->name(),
600 request->capacity_range().required_bytes()
601 ? request->capacity_range().required_bytes() : 1,
602 request->capacity_range().limit_bytes()
603 ? request->capacity_range().limit_bytes()
604 : std::numeric_limits<int64_t>::max(),
605 mesos::csi::v0::devolve(request->volume_capabilities()),
606 request->parameters());
607
608 if (result.isError()) {
609 return result.error().status;
610 }
611
612 response->mutable_volume()->set_id(result->id);
613 response->mutable_volume()->set_capacity_bytes(result->capacity.bytes());
614 *response->mutable_volume()->mutable_attributes() = result->context;
615
616 return Status::OK;
617}
618
619
620Status TestCSIPlugin::DeleteVolume(

Callers

nothing calls this directly

Calls 7

maxFunction · 0.85
errorMethod · 0.65
devolveFunction · 0.50
nameMethod · 0.45
parametersMethod · 0.45
isErrorMethod · 0.45
bytesMethod · 0.45

Tested by

no test coverage detected