This is an automated email from the ASF dual-hosted git repository. grag pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit c63797cd80a1d7d3f91d6a7eb1574e1e8ef063fb Author: Greg Mann <[email protected]> AuthorDate: Mon Aug 3 10:11:54 2020 -0700 Set the readonly field in the CSI volume manager. This patch introduces a new `readonly` field in the CSI `VolumeState` message and passes it through when publishing volumes. This will allow us to set this field appropriately when publishing pre-provisioned volumes. Review: https://reviews.apache.org/r/72715/ --- src/csi/state.proto | 3 +++ src/csi/v0_volume_manager.cpp | 4 ++-- src/csi/v1_volume_manager.cpp | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/csi/state.proto b/src/csi/state.proto index af0ef1c..836e30c 100644 --- a/src/csi/state.proto +++ b/src/csi/state.proto @@ -75,4 +75,7 @@ message VolumeState { // pre-provisioned by some other means and then attached to the node using a // CSI plugin. bool pre_provisioned = 8; + + // Indicates that the volume must be mounted read-only. + bool readonly = 9; } diff --git a/src/csi/v0_volume_manager.cpp b/src/csi/v0_volume_manager.cpp index 5368440..89a6da5 100644 --- a/src/csi/v0_volume_manager.cpp +++ b/src/csi/v0_volume_manager.cpp @@ -822,7 +822,7 @@ Future<Nothing> VolumeManagerProcess::_attachVolume(const string& volumeId) request.set_node_id(CHECK_NOTNONE(nodeId)); *request.mutable_volume_capability() = evolve(volumeState.volume_capability()); - request.set_readonly(false); + request.set_readonly(volumeState.readonly()); *request.mutable_volume_attributes() = volumeState.volume_context(); return call( @@ -950,7 +950,7 @@ Future<Nothing> VolumeManagerProcess::_publishVolume(const string& volumeId) request.set_target_path(targetPath); *request.mutable_volume_capability() = evolve(volumeState.volume_capability()); - request.set_readonly(false); + request.set_readonly(volumeState.readonly()); *request.mutable_volume_attributes() = volumeState.volume_context(); if (nodeCapabilities->stageUnstageVolume) { diff --git a/src/csi/v1_volume_manager.cpp b/src/csi/v1_volume_manager.cpp index 7eae638..5178b2f 100644 --- a/src/csi/v1_volume_manager.cpp +++ b/src/csi/v1_volume_manager.cpp @@ -844,7 +844,7 @@ Future<Nothing> VolumeManagerProcess::_attachVolume(const string& volumeId) request.set_node_id(CHECK_NOTNONE(nodeId)); *request.mutable_volume_capability() = evolve(volumeState.volume_capability()); - request.set_readonly(false); + request.set_readonly(volumeState.readonly()); *request.mutable_volume_context() = volumeState.volume_context(); return call( @@ -976,7 +976,7 @@ Future<Nothing> VolumeManagerProcess::_publishVolume(const string& volumeId) request.set_target_path(targetPath); *request.mutable_volume_capability() = evolve(volumeState.volume_capability()); - request.set_readonly(false); + request.set_readonly(volumeState.readonly()); *request.mutable_volume_context() = volumeState.volume_context(); if (nodeCapabilities->stageUnstageVolume) {
