From 0c4c4d80c5673a7d36c7f51331d33142db3d233d Mon Sep 17 00:00:00 2001 From: hemalatha Date: Fri, 8 Mar 2024 12:09:44 +0530 Subject: [PATCH] log changes for shallow copy volume (#1109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: “hemalathagajendran” <“hemalatha.gajendran@ibm.com”> Co-authored-by: “hemalathagajendran” <“hemalatha.gajendran@ibm.com”> --- driver/csiplugin/controllerserver.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/driver/csiplugin/controllerserver.go b/driver/csiplugin/controllerserver.go index 5ba9d196e..c0a06c265 100644 --- a/driver/csiplugin/controllerserver.go +++ b/driver/csiplugin/controllerserver.go @@ -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")) @@ -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{