Skip to content

Commit

Permalink
Pulled the latest gopowerstore changes
Browse files Browse the repository at this point in the history
Signed-off-by: Indukuri <rajendra.indukuri@dell.com>
  • Loading branch information
rajendraindukuri committed Oct 10, 2024
1 parent 5837fd7 commit 6d4e800
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
13 changes: 2 additions & 11 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 6d4e800

Please sign in to comment.