Skip to content

Commit

Permalink
fix(create): validate create volume request access mode (openebs-arch…
Browse files Browse the repository at this point in the history
…ive#109)

Commits adds the validation to validate the create volume
request access mode to validate and support only single node writer
i.e. `ReadWriteOnce` accessmode and failed for other unsupported
modes, like `ReadWriteMany`


Signed-off-by: prateekpandey14 <[email protected]>
  • Loading branch information
prateekpandey14 authored and mittachaitu committed Aug 13, 2020
1 parent 5240df1 commit e1b5c53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 1 addition & 3 deletions ci/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ DST_PATH="$GOPATH/src/github.com/openebs"
# Minikube is already running
kubectl apply -f $CSTOR_RBAC
kubectl apply -f $NDM_OPERATOR
kubectl apply -f $VOL_CRD
kubectl apply -f $CSPC_CRD
kubectl apply -f $CSPI_CRD
kubectl apply -f $ALL_CRD
kubectl apply -f $CSTOR_OPERATOR
kubectl apply -f $CSI_OPERATOR
kubectl apply -f $SNAPSHOT_CLASS
Expand Down
10 changes: 10 additions & 0 deletions pkg/driver/controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ func (cs *controller) validateVolumeCreateReq(req *csi.CreateVolumeRequest) erro
)
}
}
if mode := volcap.GetAccessMode(); mode != nil {
modeName := csi.VolumeCapability_AccessMode_Mode_name[int32(mode.GetMode())]
// we only support SINGLE_NODE_WRITER
if mode.GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
return status.Errorf(codes.InvalidArgument,
"only SINGLE_NODE_WRITER supported, unsupported access mode requested: %s",
modeName,
)
}
}
}
return nil
}
Expand Down

0 comments on commit e1b5c53

Please sign in to comment.