From 6145f8583ad1b1b5c631534b1dc05d8bf89c330e Mon Sep 17 00:00:00 2001 From: David Vallee Delisle Date: Sun, 10 Feb 2019 09:59:15 -0500 Subject: [PATCH] VNX Driver: delete_hba() instead of remove_hba() The storops drivers doesn't have a remove_hba() function, it's called delete_hba(). The confusion comes from the fact that storops uses -removeHBA argument when calling naviseccli. Change-Id: I3f72481442436ddf78c10ab53c161663b05a330a Closes-bug: #1813525 --- .../tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml | 2 +- .../tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py | 4 ++-- cinder/volume/drivers/dell_emc/vnx/client.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml index 68483d9cf8d..4629df389a0 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml +++ b/cinder/tests/unit/volume/drivers/dell_emc/vnx/mocked_vnx.yaml @@ -2082,7 +2082,7 @@ test_terminate_connection_cleanup_deregister: get_alu_hlu_map: {} vnx: _methods: - remove_hba: + delete_hba: test_terminate_connection_cleanup_sg_is_not_empty: sg: diff --git a/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py b/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py index 34200b5817c..9558a09ff2b 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/vnx/test_adapter.py @@ -994,9 +994,9 @@ class TestCommonAdapter(test_base.TestCase): host = common.Host('fake_host', ['fake_initiator1', 'fake_initiator2']) sg = mocked_res['sg'] common_adapter.terminate_connection_cleanup(host, sg) - common_adapter.client.vnx.remove_hba.assert_any_call( + common_adapter.client.vnx.delete_hba.assert_any_call( 'fake_initiator1') - common_adapter.client.vnx.remove_hba.assert_any_call( + common_adapter.client.vnx.delete_hba.assert_any_call( 'fake_initiator2') @res_mock.patch_common_adapter diff --git a/cinder/volume/drivers/dell_emc/vnx/client.py b/cinder/volume/drivers/dell_emc/vnx/client.py index fd7ae283a26..46e3f1ebcbf 100644 --- a/cinder/volume/drivers/dell_emc/vnx/client.py +++ b/cinder/volume/drivers/dell_emc/vnx/client.py @@ -539,7 +539,10 @@ class Client(object): if not isinstance(initiators, list): initiators = [initiators] for initiator_uid in initiators: - self.vnx.remove_hba(initiator_uid) + try: + self.vnx.delete_hba(initiator_uid) + except AttributeError: + self.vnx.remove_hba(initiator_uid) def update_consistencygroup(self, cg, lun_ids_to_add, lun_ids_to_remove): lun_ids_in_cg = (set([l.lun_id for l in cg.lun_list]) if cg.lun_list