Skip to content

Commit 015dede

Browse files
committed
move error logging for multi-zone PV from createPdSnapshot into CreateSnapshot
1 parent 3137bf0 commit 015dede

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/gce-pd-csi-driver/controller.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,11 @@ func (gceCS *GCEControllerServer) CreateSnapshot(ctx context.Context, req *csi.C
11581158
return nil, status.Errorf(codes.InvalidArgument, "CreateSnapshot Volume ID is invalid: %v", err.Error())
11591159
}
11601160

1161+
volumeIsMultiZone := isMultiZoneVolKey(volKey)
1162+
if gceCS.multiZoneVolumeHandleConfig.Enable && volumeIsMultiZone {
1163+
return nil, fmt.Errorf("Snapshots are not supported with the `multi-zone` PV volumeHandle feature.")
1164+
}
1165+
11611166
if acquired := gceCS.volumeLocks.TryAcquire(volumeID); !acquired {
11621167
return nil, status.Errorf(codes.Aborted, common.VolumeOperationAlreadyExistsFmt, volumeID)
11631168
}
@@ -1204,11 +1209,6 @@ func (gceCS *GCEControllerServer) createPDSnapshot(ctx context.Context, project
12041209
return nil, status.Errorf(codes.InvalidArgument, "Invalid volume key: %v", volKey)
12051210
}
12061211

1207-
volumeIsMultiZone := isMultiZoneVolKey(volKey)
1208-
if gceCS.multiZoneVolumeHandleConfig.Enable && volumeIsMultiZone {
1209-
return nil, fmt.Errorf("Snapshots are not supported with the `multi-zone` PV volumeHandle feature.")
1210-
}
1211-
12121212
// Check if PD snapshot already exists
12131213
var snapshot *compute.Snapshot
12141214
snapshot, err = gceCS.CloudProvider.GetSnapshot(ctx, project, snapshotName)

0 commit comments

Comments
 (0)