diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index 47b0279dc2..8d73708aee 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -428,12 +428,9 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): vol_encryption_supported = result.get_child_content( 'vol-encryption-supported') or 'false' except netapp_api.NaApiError as e: - if (e.code == netapp_api.EAPIERROR and - "key manager is not enabled" in e.message): - LOG.debug("%s", e.message) - return False - else: - raise + LOG.debug("NVE disabled due to error code: %s - %s", + e.code, e.message) + return False return strutils.bool_from_string(vol_encryption_supported) diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py index 0b9e501fb6..29dc93d299 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py @@ -189,7 +189,8 @@ class NetAppClientCmodeTestCase(test.TestCase): def test_get_security_key_manager_nve_support_disabled(self): api_response = netapp_api.NaElement( fake.SECUTITY_KEY_MANAGER_NVE_SUPPORT_RESPONSE_FALSE) - self.mock_object(self.client, 'send_request', + self.mock_object(self.client, + 'send_request', mock.Mock(return_value=api_response)) result = self.client.get_security_key_manager_nve_support( @@ -201,16 +202,21 @@ class NetAppClientCmodeTestCase(test.TestCase): mock.call('security-key-manager-volume-encryption-supported', api_args)]) - self.mock_object(self.client, 'send_request', self._mock_api_error()) - self.assertRaises(netapp_api.NaApiError, - self.client.get_security_key_manager_nve_support, - fake.NODE_NAME) - self.mock_object(self.client, 'send_request', self._mock_api_error( - code=netapp_api.EAPIERROR, message=fake.FAKE_KEY_MANAGER_ERROR)) + def test_get_security_key_manager_nve_support_disabled_no_license(self): + self.mock_object(self.client, + 'send_request', + self._mock_api_error()) + result = self.client.get_security_key_manager_nve_support( fake.NODE_NAME) + self.assertFalse(result) + api_args = {'node': fake.NODE_NAME} + self.client.send_request.assert_has_calls([ + mock.call('security-key-manager-volume-encryption-supported', + api_args)]) + @ddt.data((True, True, True), (False, None, False)) @ddt.unpack def test_send_volume_move_request_success(self, validation_only, diff --git a/releasenotes/notes/bug-1772026-nve-license-not-present-fix-e5d2e0d6c5df9227.yaml b/releasenotes/notes/bug-1772026-nve-license-not-present-fix-e5d2e0d6c5df9227.yaml new file mode 100644 index 0000000000..64d174cfe5 --- /dev/null +++ b/releasenotes/notes/bug-1772026-nve-license-not-present-fix-e5d2e0d6c5df9227.yaml @@ -0,0 +1,5 @@ +fixes: + - | + Since the addition of NVE support, the Netapp driver used to fail to start + when a VE license is not present on an ONTAP > 9.1. Now the driver starts + but it reports NVE not supported. \ No newline at end of file