From 9bd456957b54328472675bf2bd3b9295bea64624 Mon Sep 17 00:00:00 2001 From: Utkarsh Dubey Date: Mon, 5 Feb 2024 15:35:15 +0530 Subject: [PATCH 1/2] update if check for failover failure --- go.mod | 2 +- go.sum | 6 ++---- pkg/controller/replication.go | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 7d6fa34a..dc6e78f9 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/dell/gofsutil v1.14.0 github.com/dell/goiscsi v1.8.0 github.com/dell/gonvme v1.6.0 - github.com/dell/gopowerstore v1.14.1 + github.com/dell/gopowerstore v1.14.2 github.com/fsnotify/fsnotify v1.7.0 github.com/go-openapi/strfmt v0.21.3 github.com/golang/mock v1.6.0 diff --git a/go.sum b/go.sum index b22ec192..6d2f7de7 100644 --- a/go.sum +++ b/go.sum @@ -138,10 +138,8 @@ github.com/dell/goiscsi v1.8.0 h1:kocGVOdgnufc6eGpfmwP66hyhY7OVgIafaS/+uM6ogU= github.com/dell/goiscsi v1.8.0/go.mod h1:PTlQGJaGKYgia95mGwwHSBgvfOr3BfLIjGNh1HT6p+s= github.com/dell/gonvme v1.6.0 h1:Y/g0Ml8E3oSB+bqGJN1/U+V621h9t0KJeYAF5aQ7NVU= github.com/dell/gonvme v1.6.0/go.mod h1:/UgJAlR03LbPSDIK2BfhiYUlzyY7lAMJ6ao8eYab2Eg= -github.com/dell/gopowerstore v1.14.1-0.20240123112046-ec40aaf31242 h1:kR8Opp5Rr3syF5uJnmDJNe94QrUbqmLXsjTDrENFG88= -github.com/dell/gopowerstore v1.14.1-0.20240123112046-ec40aaf31242/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w= -github.com/dell/gopowerstore v1.14.1 h1:xn9FFMLDRg42+L9OR8wOnIQfG+YGNauX9qT0vPeEfyw= -github.com/dell/gopowerstore v1.14.1/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w= +github.com/dell/gopowerstore v1.14.2 h1:1mtQBDbMEaVtLKYj1R1z6q5TBKlI2KnGHmWOcZCvcfA= +github.com/dell/gopowerstore v1.14.2/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w= 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/replication.go b/pkg/controller/replication.go index 61dce057..f5c1a204 100644 --- a/pkg/controller/replication.go +++ b/pkg/controller/replication.go @@ -394,7 +394,7 @@ func ExecuteAction(session *gopowerstore.ReplicationSession, pstoreClient gopowe _, err := pstoreClient.ExecuteActionOnReplicationSession(context.Background(), session.ID, action, failoverParams) if err != nil { - if apiError, ok := err.(gopowerstore.APIError); ok && !apiError.UnableToFailoverFromDestination() { + if apiError, ok := err.(gopowerstore.APIError); ok && apiError.UnableToFailoverFromDestination() { log.Error(fmt.Sprintf("Fail over: Failed to modify RS (%s) - Error (%s)", session.ID, err.Error())) return status.Errorf(codes.Internal, "Execute action: Failed to modify RS (%s) - Error (%s)", session.ID, err.Error()) } From faf2d220ebf5c6958636043602ed05fbcac7f996 Mon Sep 17 00:00:00 2001 From: Utkarsh Dubey Date: Tue, 6 Feb 2024 11:24:38 +0530 Subject: [PATCH 2/2] update unit test Signed-off-by: Utkarsh Dubey --- pkg/controller/replication_test.go | 2 +- tests/e2e/go.mod | 2 +- tests/e2e/go.sum | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/controller/replication_test.go b/pkg/controller/replication_test.go index a9881f51..bef7e2a6 100755 --- a/pkg/controller/replication_test.go +++ b/pkg/controller/replication_test.go @@ -925,7 +925,7 @@ var _ = ginkgo.Describe("Replication", func() { } session := gopowerstore.ReplicationSession{ID: "test", State: "Failed_Over"} - clientMock.On("ExecuteActionOnReplicationSession", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(gopowerstore.EmptyResponse(""), gopowerstore.APIError{ErrorMsg: &api.ErrorMsg{StatusCode: http.StatusNotFound}}) + clientMock.On("ExecuteActionOnReplicationSession", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(gopowerstore.EmptyResponse(""), gopowerstore.APIError{ErrorMsg: &api.ErrorMsg{StatusCode: http.StatusBadRequest}}) clientMock.On("GetReplicationSessionByLocalResourceID", mock.Anything, mock.Anything).Return(session, nil) params := make(map[string]string) diff --git a/tests/e2e/go.mod b/tests/e2e/go.mod index ca9390ce..038dc94c 100644 --- a/tests/e2e/go.mod +++ b/tests/e2e/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/dell/csi-powerstore/v2 v2.8.0 - github.com/dell/gopowerstore v1.14.1 + github.com/dell/gopowerstore v1.14.2 github.com/onsi/ginkgo/v2 v2.13.0 gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.29.0 diff --git a/tests/e2e/go.sum b/tests/e2e/go.sum index 308b3986..a79cf156 100644 --- a/tests/e2e/go.sum +++ b/tests/e2e/go.sum @@ -114,6 +114,7 @@ github.com/dell/gonvme v1.6.0 h1:Y/g0Ml8E3oSB+bqGJN1/U+V621h9t0KJeYAF5aQ7NVU= github.com/dell/gonvme v1.6.0/go.mod h1:/UgJAlR03LbPSDIK2BfhiYUlzyY7lAMJ6ao8eYab2Eg= github.com/dell/gopowerstore v1.14.1 h1:xn9FFMLDRg42+L9OR8wOnIQfG+YGNauX9qT0vPeEfyw= github.com/dell/gopowerstore v1.14.1/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w= +github.com/dell/gopowerstore v1.14.2/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w= 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/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=