[NetApp driver] NVE License not present fix

Since the addition of NVE support in the NetApp ONTAP driver,
the driver fails to start when a VE license is not present on
a 9.1 (or later) ONTAP box.

This patch fixes the problem by improving error handling.

Change-Id: I27bf9f0d1be666f4151281ca52d6bb3377f856ff
Closes-Bug: #1772026
This commit is contained in:
Rodrigo Barbieri 2018-06-11 09:40:20 -03:00 committed by Luiz Gavioli
parent 623f4e197b
commit 61f82e492e
3 changed files with 21 additions and 13 deletions

View File

@ -428,12 +428,9 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
vol_encryption_supported = result.get_child_content( vol_encryption_supported = result.get_child_content(
'vol-encryption-supported') or 'false' 'vol-encryption-supported') or 'false'
except netapp_api.NaApiError as e: except netapp_api.NaApiError as e:
if (e.code == netapp_api.EAPIERROR and LOG.debug("NVE disabled due to error code: %s - %s",
"key manager is not enabled" in e.message): e.code, e.message)
LOG.debug("%s", e.message) return False
return False
else:
raise
return strutils.bool_from_string(vol_encryption_supported) return strutils.bool_from_string(vol_encryption_supported)

View File

@ -189,7 +189,8 @@ class NetAppClientCmodeTestCase(test.TestCase):
def test_get_security_key_manager_nve_support_disabled(self): def test_get_security_key_manager_nve_support_disabled(self):
api_response = netapp_api.NaElement( api_response = netapp_api.NaElement(
fake.SECUTITY_KEY_MANAGER_NVE_SUPPORT_RESPONSE_FALSE) 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)) mock.Mock(return_value=api_response))
result = self.client.get_security_key_manager_nve_support( 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', mock.call('security-key-manager-volume-encryption-supported',
api_args)]) api_args)])
self.mock_object(self.client, 'send_request', self._mock_api_error()) def test_get_security_key_manager_nve_support_disabled_no_license(self):
self.assertRaises(netapp_api.NaApiError, self.mock_object(self.client,
self.client.get_security_key_manager_nve_support, 'send_request',
fake.NODE_NAME) self._mock_api_error())
self.mock_object(self.client, 'send_request', self._mock_api_error(
code=netapp_api.EAPIERROR, message=fake.FAKE_KEY_MANAGER_ERROR))
result = self.client.get_security_key_manager_nve_support( result = self.client.get_security_key_manager_nve_support(
fake.NODE_NAME) fake.NODE_NAME)
self.assertFalse(result) 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.data((True, True, True), (False, None, False))
@ddt.unpack @ddt.unpack
def test_send_volume_move_request_success(self, validation_only, def test_send_volume_move_request_success(self, validation_only,

View File

@ -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.