From 42d9a892805225c13b87d5e68b6000fe01b7ae99 Mon Sep 17 00:00:00 2001 From: tony-saad Date: Fri, 9 Jun 2023 17:17:41 +0000 Subject: [PATCH] Dell Powerflex: Add new VOLUME_ALREADY_MAPPED_ERROR Dell Powerflex 4.x changed the error code of VOLUME_ALREADY_MAPPED_ERROR to 4037. This patch adds that error code. Closes-Bug: #2013749 Change-Id: I928c97ea977f6d0a0b654f15c80c00523c141406 --- os_brick/initiator/connectors/scaleio.py | 4 +++- os_brick/tests/initiator/connectors/test_scaleio.py | 9 +++++++++ releasenotes/notes/bug-2013749-3de9f827b82116a2.yaml | 9 +++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bug-2013749-3de9f827b82116a2.yaml diff --git a/os_brick/initiator/connectors/scaleio.py b/os_brick/initiator/connectors/scaleio.py index 2ddac4e0d..9a61406e7 100644 --- a/os_brick/initiator/connectors/scaleio.py +++ b/os_brick/initiator/connectors/scaleio.py @@ -49,6 +49,7 @@ class ScaleIOConnector(base.BaseLinuxConnector): OK_STATUS_CODE = 200 VOLUME_NOT_MAPPED_ERROR = 84 VOLUME_ALREADY_MAPPED_ERROR = 81 + VOLUME_ALREADY_MAPPED_ERROR_v4 = 4037 GET_GUID_OP_CODE = io('a', 14) RESCAN_VOLS_OP_CODE = io('a', 10) @@ -400,7 +401,8 @@ class ScaleIOConnector(base.BaseLinuxConnector): if r.status_code != self.OK_STATUS_CODE: response = r.json() error_code = response['errorCode'] - if error_code == self.VOLUME_ALREADY_MAPPED_ERROR: + if error_code == self.VOLUME_ALREADY_MAPPED_ERROR or \ + error_code == self.VOLUME_ALREADY_MAPPED_ERROR_v4: LOG.warning( "Ignoring error mapping volume %(volume_name)s: " "volume already mapped.", diff --git a/os_brick/tests/initiator/connectors/test_scaleio.py b/os_brick/tests/initiator/connectors/test_scaleio.py index 8f3d6a320..292cc99bb 100644 --- a/os_brick/tests/initiator/connectors/test_scaleio.py +++ b/os_brick/tests/initiator/connectors/test_scaleio.py @@ -285,6 +285,15 @@ class ScaleIOConnectorTestCase(test_connector.ConnectorTestCase): self.test_connect_volume() + def test_map_volume_already_mapped_v4(self): + """Ignore REST API failure for volume already mapped""" + self.mock_calls[self.action_format.format( + 'addMappedSdc')] = self.MockHTTPSResponse( + dict(errorCode=self.connector.VOLUME_ALREADY_MAPPED_ERROR_v4, + message='Test error map volume'), 500) + + self.test_connect_volume() + def test_error_disconnect_volume(self): """Fail to disconnect with REST API failure""" self.mock_calls[self.action_format.format( diff --git a/releasenotes/notes/bug-2013749-3de9f827b82116a2.yaml b/releasenotes/notes/bug-2013749-3de9f827b82116a2.yaml new file mode 100644 index 000000000..b18e9e524 --- /dev/null +++ b/releasenotes/notes/bug-2013749-3de9f827b82116a2.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + PowerFlex driver `Bug #2013749 + `_: Added + new error code for powerflex 4.x which was causing this error. + Added handling for the new error code returned from + Powerflex 4.x when a we try to map a volume which is already + mapped.