From 7c914b37c3084136709d07d1dfecc231e82d659f Mon Sep 17 00:00:00 2001 From: Indukuri Date: Thu, 10 Oct 2024 13:12:39 +0530 Subject: [PATCH] Pulled the latest gopowerstore changes for sync Signed-off-by: Indukuri --- go.mod | 2 +- go.sum | 2 ++ pkg/controller/controller.go | 13 ++----------- pkg/controller/controller_test.go | 8 ++++---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index a7387ef5..f945d621 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/dell/gofsutil v1.16.1 github.com/dell/goiscsi v1.9.0 github.com/dell/gonvme v1.8.1 - github.com/dell/gopowerstore v1.15.2-0.20241004144335-14f8fa34731c + github.com/dell/gopowerstore v1.15.2-0.20241008144633-6990d1b86e5b github.com/fsnotify/fsnotify v1.7.0 github.com/go-openapi/strfmt v0.23.0 github.com/golang/mock v1.6.0 diff --git a/go.sum b/go.sum index 8f137280..9e8b04eb 100644 --- a/go.sum +++ b/go.sum @@ -139,6 +139,8 @@ github.com/dell/gonvme v1.8.1 h1:46M5lPqj7+Xjen+qxooRN9cx/+uJG4xtK9TpwduWDgE= github.com/dell/gonvme v1.8.1/go.mod h1:ajbuF+fswq+ty2tRTG5FN4ecIMJsG7aDu/bkMynTKAs= github.com/dell/gopowerstore v1.15.2-0.20241004144335-14f8fa34731c h1:/zP7pDYTZJePpfrXlqchxP5/q8+qF1ezZaOEp5qYFG0= github.com/dell/gopowerstore v1.15.2-0.20241004144335-14f8fa34731c/go.mod h1:vyN1JAZ+TO7Px+gNVa61a23/KwlI/Nj/6ttzMOQFyG0= +github.com/dell/gopowerstore v1.15.2-0.20241008144633-6990d1b86e5b h1:wVpvFdhc4FIl7w73fm9aTGtE3iTfoO5Ag7/WQUNdHUU= +github.com/dell/gopowerstore v1.15.2-0.20241008144633-6990d1b86e5b/go.mod h1:EQEsDdulHtvpDIe2tMCW/2swr1enisuzW4Zmw6c2SKc= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 39e57ea1..3832574d 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -322,24 +322,15 @@ func (s *Service) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest if apiError, ok := err.(gopowerstore.APIError); ok && apiError.NotFound() { log.Infof("Volume group with name %s not found, creating it", vgName) - // Attribute that indicates whether snapshot sets of the volumegroup will be write-order consistent. - isWriteOrderConsistent := false - // ensure protection policy exists pp, err := EnsureProtectionPolicyExists(ctx, arr, vgName, remoteSystemName, rpoEnum) if err != nil { return nil, status.Errorf(codes.Internal, "can't ensure protection policy exists %s", err.Error()) } - // To apply a ProtectionPolicy with Sync rule, VolumeGroup must be write-order-consistent - if repMode == common.SyncMode { - isWriteOrderConsistent = true - } - group, err := arr.Client.CreateVolumeGroup(ctx, &gopowerstore.VolumeGroupCreate{ - Name: vgName, - ProtectionPolicyID: pp, - IsWriteOrderConsistent: isWriteOrderConsistent, + Name: vgName, + ProtectionPolicyID: pp, }) if err != nil { return nil, status.Errorf(codes.Internal, "can't create volume group: %s", err.Error()) diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index c900ef0b..a3b93a5b 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -307,7 +307,7 @@ var _ = ginkgo.Describe("CSIControllerService", func() { EnsureProtectionPolicyExistsMockSync() - createGroupRequest := &gopowerstore.VolumeGroupCreate{Name: validGroupNameSync, ProtectionPolicyID: validPolicyID, IsWriteOrderConsistent: true} + createGroupRequest := &gopowerstore.VolumeGroupCreate{Name: validGroupNameSync, ProtectionPolicyID: validPolicyID} clientMock.On("CreateVolumeGroup", mock.Anything, createGroupRequest).Return(gopowerstore.CreateResponse{ID: validGroupID}, nil) clientMock.On("GetVolumeGroup", mock.Anything, validGroupID).Return(gopowerstore.VolumeGroup{ID: validGroupID, ProtectionPolicyID: validPolicyID}, nil) @@ -419,7 +419,7 @@ var _ = ginkgo.Describe("CSIControllerService", func() { clientMock.On("GetProtectionPolicyByName", mock.Anything, "pp-"+validNamespacedGroupNameSync). Return(gopowerstore.ProtectionPolicy{ID: validPolicyID}, nil) - createGroupRequest := &gopowerstore.VolumeGroupCreate{Name: validNamespacedGroupNameSync, ProtectionPolicyID: validPolicyID, IsWriteOrderConsistent: true} + createGroupRequest := &gopowerstore.VolumeGroupCreate{Name: validNamespacedGroupNameSync, ProtectionPolicyID: validPolicyID} clientMock.On("CreateVolumeGroup", mock.Anything, createGroupRequest).Return(gopowerstore.CreateResponse{ID: validGroupID}, nil) clientMock.On("GetVolumeGroup", mock.Anything, validGroupID).Return(gopowerstore.VolumeGroup{ID: validGroupID, ProtectionPolicyID: validPolicyID}, nil) clientMock.On("GetCustomHTTPHeaders").Return(make(http.Header)) @@ -534,7 +534,7 @@ var _ = ginkgo.Describe("CSIControllerService", func() { ginkgo.It("should fail create new volume with existing volumeGroup with policy and when IsWriteOrderConsistent is false - SYNC", func() { clientMock.On("GetVolumeGroupByName", mock.Anything, validGroupNameSync). - Return(gopowerstore.VolumeGroup{ID: validGroupID, ProtectionPolicyID: validPolicyID}, nil) + Return(gopowerstore.VolumeGroup{ID: validGroupID, ProtectionPolicyID: validPolicyID, IsWriteOrderConsistent: false}, nil) // Setting Replciation mode and corresponding attributes for SYNC req.Parameters[ctrlSvc.WithRP(controller.KeyReplicationMode)] = replicationModeSync req.Parameters[ctrlSvc.WithRP(controller.KeyReplicationRPO)] = zeroRPO @@ -638,7 +638,7 @@ var _ = ginkgo.Describe("CSIControllerService", func() { ginkgo.It("should fail create volume and update volumeGroup without policy, but policy exists when IsWriteOrderConsistent is false - SYNC", func() { clientMock.On("GetVolumeGroupByName", mock.Anything, validGroupNameSync). - Return(gopowerstore.VolumeGroup{ID: validGroupID, ProtectionPolicyID: validPolicyID}, nil) + Return(gopowerstore.VolumeGroup{ID: validGroupID, ProtectionPolicyID: validPolicyID, IsWriteOrderConsistent: false}, nil) EnsureProtectionPolicyExistsMockSync()