Merge "[NetApp driver] NVE License not present fix"

This commit is contained in:
Zuul 2018-07-11 03:56:26 +00:00 committed by Gerrit Code Review
commit 5a33801059
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') 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)
LOG.debug("NVE disabled due to error code: %s - %s",
e.code, e.message)
return False
else:
raise
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):
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,

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.