This is an automated email from the ASF dual-hosted git repository. chhsiao pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 51d11d93fb89d6822d6914d6e546265c672a19fe Author: Chun-Hung Hsiao <[email protected]> AuthorDate: Thu Apr 4 22:44:34 2019 -0700 Updated CSI volume state fields to match names in v1 spec. We rename `volume_attributes` to `volume_context` and `publish_info` to `publish_context` in `state.proto` to match the new CSI v1 standard to avoid confusions. Since this protobuf message is only used for checkpointing and the binary format does not change, there will be no compatibility issue. Review: https://reviews.apache.org/r/70401 --- src/csi/state.proto | 13 +++++++------ src/csi/v0_volume_manager.cpp | 18 +++++++++--------- src/csi/v0_volume_manager_process.hpp | 6 +++--- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/csi/state.proto b/src/csi/state.proto index b7213ed..96ba420 100644 --- a/src/csi/state.proto +++ b/src/csi/state.proto @@ -50,14 +50,15 @@ message VolumeState { map<string, string> parameters = 6; // Attributes of the volume to be used on the node. This field MUST match the - // attributes of the `Volume` returned by `CreateVolume`. This is an OPTIONAL - // field. - map<string, string> volume_attributes = 3; + // `volume_context` field of the `Volume` returned by `CreateVolume`. This is + // an OPTIONAL field. + map<string, string> volume_context = 3; // If the plugin has the `PUBLISH_UNPUBLISH_VOLUME` controller capability, - // this field MUST be set to the value returned by `ControllerPublishVolume`. - // Otherwise, this field MUST remain unset. This is an OPTIONAL field. - map<string, string> publish_info = 4; + // this field MUST be set to the `publish_context` field returned by + // `ControllerPublishVolume`. Otherwise, this field MUST remain unset. This is + // an OPTIONAL field. + map<string, string> publish_context = 4; // This field is used to check if the node has been rebooted since the volume // is made publishable on the node. It MUST be set to the boot ID of the node diff --git a/src/csi/v0_volume_manager.cpp b/src/csi/v0_volume_manager.cpp index 7de9000..02de17e 100644 --- a/src/csi/v0_volume_manager.cpp +++ b/src/csi/v0_volume_manager.cpp @@ -326,7 +326,7 @@ Future<VolumeInfo> VolumeManagerProcess::createVolume( volumeState.set_state(VolumeState::CREATED); *volumeState.mutable_volume_capability() = capability; *volumeState.mutable_parameters() = parameters; - *volumeState.mutable_volume_attributes() = response.volume().attributes(); + *volumeState.mutable_volume_context() = response.volume().attributes(); volumes.put(volumeId, std::move(volumeState)); checkpointVolumeState(volumeId); @@ -397,7 +397,7 @@ Future<Option<Error>> VolumeManagerProcess::validateVolume( volumeState.set_state(VolumeState::CREATED); *volumeState.mutable_volume_capability() = capability; *volumeState.mutable_parameters() = parameters; - *volumeState.mutable_volume_attributes() = volumeInfo.context; + *volumeState.mutable_volume_context() = volumeInfo.context; volumes.put(volumeInfo.id, std::move(volumeState)); checkpointVolumeState(volumeInfo.id); @@ -820,7 +820,7 @@ Future<Nothing> VolumeManagerProcess::_attachVolume(const string& volumeId) *request.mutable_volume_capability() = evolve(volumeState.volume_capability()); request.set_readonly(false); - *request.mutable_volume_attributes() = volumeState.volume_attributes(); + *request.mutable_volume_attributes() = volumeState.volume_context(); return call( CONTROLLER_SERVICE, &Client::controllerPublishVolume, std::move(request)) @@ -829,7 +829,7 @@ Future<Nothing> VolumeManagerProcess::_attachVolume(const string& volumeId) CHECK(volumes.contains(volumeId)); VolumeState& volumeState = volumes.at(volumeId).state; volumeState.set_state(VolumeState::NODE_READY); - *volumeState.mutable_publish_info() = response.publish_info(); + *volumeState.mutable_publish_context() = response.publish_info(); checkpointVolumeState(volumeId); @@ -886,7 +886,7 @@ Future<Nothing> VolumeManagerProcess::_detachVolume(const string& volumeId) CHECK(volumes.contains(volumeId)); VolumeState& volumeState = volumes.at(volumeId).state; volumeState.set_state(VolumeState::CREATED); - volumeState.mutable_publish_info()->clear(); + volumeState.mutable_publish_context()->clear(); checkpointVolumeState(volumeId); @@ -943,12 +943,12 @@ Future<Nothing> VolumeManagerProcess::_publishVolume(const string& volumeId) NodePublishVolumeRequest request; request.set_volume_id(volumeId); - *request.mutable_publish_info() = volumeState.publish_info(); + *request.mutable_publish_info() = volumeState.publish_context(); request.set_target_path(targetPath); *request.mutable_volume_capability() = evolve(volumeState.volume_capability()); request.set_readonly(false); - *request.mutable_volume_attributes() = volumeState.volume_attributes(); + *request.mutable_volume_attributes() = volumeState.volume_context(); if (nodeCapabilities->stageUnstageVolume) { const string stagingPath = paths::getMountStagingPath( @@ -1033,11 +1033,11 @@ Future<Nothing> VolumeManagerProcess::__publishVolume(const string& volumeId) NodeStageVolumeRequest request; request.set_volume_id(volumeId); - *request.mutable_publish_info() = volumeState.publish_info(); + *request.mutable_publish_info() = volumeState.publish_context(); request.set_staging_target_path(stagingPath); *request.mutable_volume_capability() = evolve(volumeState.volume_capability()); - *request.mutable_volume_attributes() = volumeState.volume_attributes(); + *request.mutable_volume_attributes() = volumeState.volume_context(); return call(NODE_SERVICE, &Client::nodeStageVolume, std::move(request)) .then(process::defer(self(), [this, volumeId] { diff --git a/src/csi/v0_volume_manager_process.hpp b/src/csi/v0_volume_manager_process.hpp index 88073e4..c3cd6ca 100644 --- a/src/csi/v0_volume_manager_process.hpp +++ b/src/csi/v0_volume_manager_process.hpp @@ -14,8 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef __CSI_VOLUME_MANAGER_PROCESS_HPP__ -#define __CSI_VOLUME_MANAGER_PROCESS_HPP__ +#ifndef __CSI_V0_VOLUME_MANAGER_PROCESS_HPP__ +#define __CSI_V0_VOLUME_MANAGER_PROCESS_HPP__ #include <string> #include <vector> @@ -215,4 +215,4 @@ private: } // namespace csi { } // namespace mesos { -#endif // __CSI_VOLUME_MANAGER_PROCESS_HPP__ +#endif // __CSI_V0_VOLUME_MANAGER_PROCESS_HPP__
