Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not check waiters if mount rbd rox #4

Open
wants to merge 1 commit into
base: atom-v3.3.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions internal/rbd/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,3 +1123,18 @@ func (cs *ControllerServer) ControllerExpandVolume(ctx context.Context, req *csi
NodeExpansionRequired: nodeExpansion,
}, nil
}

// ControllerPublishVolume collects information useful for NodeStageVolume to tell if the volume is expected to be mounted readonly.
func (cs *ControllerServer) ControllerPublishVolume(ctx context.Context, req *csi.ControllerPublishVolumeRequest) (*csi.ControllerPublishVolumeResponse, error) {
ro := "false"
if req.GetReadonly() {
ro = "true"
}
// todo: check rwo and rox constrains
return &csi.ControllerPublishVolumeResponse{PublishContext: map[string]string{"readonly": ro}}, nil
}

// ControllerUnpublishVolume does nothing.
func (cs *ControllerServer) ControllerUnpublishVolume(ctx context.Context, req *csi.ControllerUnpublishVolumeRequest) (*csi.ControllerUnpublishVolumeResponse, error) {
return &csi.ControllerUnpublishVolumeResponse{}, nil
}
2 changes: 2 additions & 0 deletions internal/rbd/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ func (r *Driver) Run(conf *util.Config) {
csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
csi.ControllerServiceCapability_RPC_CLONE_VOLUME,
csi.ControllerServiceCapability_RPC_EXPAND_VOLUME,
csi.ControllerServiceCapability_RPC_PUBLISH_READONLY,
csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME,
})
// We only support the multi-writer option when using block, but it's a supported capability for the plugin in general
// In addition, we want to add the remaining modes like MULTI_NODE_READER_ONLY,
Expand Down
2 changes: 1 addition & 1 deletion internal/rbd/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol
return nil, err
}

disableInUseChecks := req.GetPublishContext()["readonly"] == "true"
isBlock := req.GetVolumeCapability().GetBlock() != nil
disableInUseChecks := false
// MULTI_NODE_MULTI_WRITER is supported by default for Block access type volumes
if req.VolumeCapability.AccessMode.Mode == csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER {
if !isBlock {
Expand Down
2 changes: 1 addition & 1 deletion internal/util/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func CheckReadOnlyManyIsSupported(req *csi.CreateVolumeRequest) error {
writable = true
}
}
if ! writable && req.GetVolumeContentSource() == nil {
if !writable && req.GetVolumeContentSource() == nil {
return status.Error(codes.InvalidArgument, "readOnly accessMode is supported only with content source")
}
return nil
Expand Down