Skip to content

Commit

Permalink
log changes for shallow copy volume (#1109)
Browse files Browse the repository at this point in the history
Signed-off-by: “hemalathagajendran” <“hemalatha.gajendran@ibm.com”>
Co-authored-by: “hemalathagajendran” <“hemalatha.gajendran@ibm.com”>
  • Loading branch information
hemalathagajendran and “hemalathagajendran” authored Mar 8, 2024
1 parent 0e15e17 commit 0c4c4d8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion driver/csiplugin/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1622,7 +1622,12 @@ func (cs *ScaleControllerServer) validateSnapId(ctx context.Context, scaleVol *s

func (cs *ScaleControllerServer) validateShallowCopyVolume(ctx context.Context, sourcesnapshot *scaleSnapId, newvolume *scaleVolume) error {
loggerId := utils.GetLoggerId(ctx)


if sourcesnapshot.VolType == "" && sourcesnapshot.ConsistencyGroup == ""{
klog.Errorf("[%s] creating shallow copy volume is not supported for static volume or old snapshot handle", loggerId)
return status.Error(codes.Internal, fmt.Sprintf("creating shallow copy volume is not supported for static volume or old snapshot handle"))
}

if !newvolume.IsFilesetBased {
klog.Errorf("[%s] creating shallow copy volume as directory based volume is not supported", loggerId)
return status.Error(codes.Internal, fmt.Sprintf("creating shallow copy volume as directory based volume is not supported"))
Expand Down Expand Up @@ -2904,6 +2909,11 @@ func (cs *ScaleControllerServer) ControllerExpandVolume(ctx context.Context, req
return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("ControllerExpandVolume - Error in source Volume ID %v: %v", volID, err))
}

if volumeIDMembers.VolType == FILE_SHALLOWCOPY_VOLUME{
klog.Errorf("[%s] ControllerExpandVolume - volume expansion is not supported for shallow copy volume", loggerId)
return nil, status.Error(codes.Internal, fmt.Sprintf("ControllerExpandVolume - volume expansion is not supported for shallow copy volume %s", volID))
}

// For lightweight return volume expanded as no action is required
if !volumeIDMembers.IsFilesetBased {
return &csi.ControllerExpandVolumeResponse{
Expand Down

0 comments on commit 0c4c4d8

Please sign in to comment.