Skip to content

Commit 11ec8d1

Browse files
committed
fix createVolume error when snapshotServer is empty
1 parent fea334f commit 11ec8d1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/curve/controllerserver.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,7 @@ func (cs *controllerServer) createVolFromContentSource(
417417
req *csi.CreateVolumeRequest,
418418
destVolOptions *volumeOptions,
419419
curveVol *curveservice.CurveVolume) (volSource string, err error) {
420-
if cs.snapshotServer == "" {
421-
return "", status.Error(codes.Unimplemented, "")
422-
}
423-
420+
424421
if req.VolumeContentSource == nil {
425422
return "", nil
426423
}
@@ -429,6 +426,10 @@ func (cs *controllerServer) createVolFromContentSource(
429426
// check contentSource
430427
switch req.VolumeContentSource.Type.(type) {
431428
case *csi.VolumeContentSource_Snapshot:
429+
if cs.snapshotServer == "" {
430+
return "", status.Error(codes.Unimplemented, "")
431+
}
432+
432433
snapshotId := req.VolumeContentSource.GetSnapshot().GetSnapshotId()
433434
// lock out parallel snapshot
434435
if acquired := cs.snapshotLocks.TryAcquire(snapshotId); !acquired {

0 commit comments

Comments
 (0)