-
Notifications
You must be signed in to change notification settings - Fork 547
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
Default multiwrite blockmode #261
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ import ( | |
"os/exec" | ||
"sort" | ||
"strconv" | ||
"strings" | ||
"syscall" | ||
|
||
csicommon "github.com/ceph/ceph-csi/pkg/csi-common" | ||
|
@@ -94,16 +93,25 @@ func (cs *ControllerServer) validateVolumeReq(req *csi.CreateVolumeRequest) erro | |
func parseVolCreateRequest(req *csi.CreateVolumeRequest) (*rbdVolume, error) { | ||
// TODO (sbezverk) Last check for not exceeding total storage capacity | ||
|
||
// MultiNodeWriters are accepted but they're only for special cases, and we skip the watcher checks for them which isn't the greatest | ||
// let's make sure we ONLY skip that if the user is requesting a MULTI Node accessible mode | ||
disableMultiWriter := true | ||
for _, am := range req.VolumeCapabilities { | ||
if am.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER { | ||
disableMultiWriter = false | ||
isMultiNode := false | ||
isBlock := false | ||
for _, cap := range req.VolumeCapabilities { | ||
// RO modes need to be handled indepedently (ie right now even if access mode is RO, they'll be RW upon attach) | ||
if cap.GetAccessMode().GetMode() == csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER { | ||
isMultiNode = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So what about setting isMultiNode to true if the access mode is neither SINGLE_MODE_WRITER or SINGLE_MODE_READER_ONLY ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's "NODE", not "MODE.. If the mode is "neither" SINGLE_NODE_xxxx" then by elimination it's "MULTI_NODE_xxx". I'm not exactly sure what you're looking for here, but I think the safest answer is to just make this explicitly for MULTI_NODE_MULTI_WRITER option only, and then I can handle other cases involving RO and implementing the RO option separately. Trying to infer the fix or work around the issues with the single-node-multi cases doesn't belong in this PR I don't think, and I'd prefer to see how those things end up sorting out upstream. Does that work? Note that the valid options are:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, and thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So are you good here then (https://github.com/ceph/ceph-csi/pull/261/files#diff-35c77cc181d49675cd67a6095520b41fR99) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yessir There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, sorry to prolong this, but don't you want to change the sense of the comparison as well?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gahhh, yes! |
||
} | ||
if cap.GetBlock() != nil { | ||
isBlock = true | ||
} | ||
} | ||
|
||
// We want to fail early if the user is trying to create a RWX on a non-block type device | ||
if isMultiNode && !isBlock { | ||
return nil, status.Error(codes.InvalidArgument, "multi node access modes are only supported on rbd `block` type volumes") | ||
} | ||
|
||
rbdVol, err := getRBDVolumeOptions(req.GetParameters(), disableMultiWriter) | ||
// if it's NOT SINGLE_NODE_WRITER and it's BLOCK we'll set the parameter to ignore the in-use checks | ||
rbdVol, err := getRBDVolumeOptions(req.GetParameters(), (isMultiNode && isBlock)) | ||
if err != nil { | ||
return nil, status.Error(codes.InvalidArgument, err.Error()) | ||
} | ||
|
@@ -344,20 +352,11 @@ func (cs *ControllerServer) ListVolumes(ctx context.Context, req *csi.ListVolume | |
// ValidateVolumeCapabilities checks whether the volume capabilities requested | ||
// are supported. | ||
func (cs *ControllerServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) { | ||
params := req.GetParameters() | ||
multiWriter := params["multiNodeWritable"] | ||
if strings.ToLower(multiWriter) == "enabled" { | ||
klog.V(3).Info("detected multiNodeWritable parameter in Storage Class, allowing multi-node access modes") | ||
|
||
} else { | ||
for _, cap := range req.VolumeCapabilities { | ||
if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER { | ||
return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil | ||
} | ||
for _, cap := range req.VolumeCapabilities { | ||
if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER { | ||
return &csi.ValidateVolumeCapabilitiesResponse{Message: ""}, nil | ||
} | ||
|
||
} | ||
|
||
return &csi.ValidateVolumeCapabilitiesResponse{ | ||
Confirmed: &csi.ValidateVolumeCapabilitiesResponse_Confirmed{ | ||
VolumeCapabilities: req.VolumeCapabilities, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, is there a way to use some kind of anti-affinity to ensure that the second POD is scheduled on a different node?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you could use anti-affinity or node-selector. See Kube docs here: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!