From e7be0a988cf159cfea2e365409c69ff28ad4adf2 Mon Sep 17 00:00:00 2001 From: Anthony Lee Date: Thu, 29 Oct 2015 15:04:32 -0700 Subject: [PATCH] Refactor HP 3PAR drivers to now be HPE This patch refactors the HP 3PAR FC and iSCSI drivers to be HPE 3PAR FC and HPE 3PAR iSCI. This is being done because the company responsible for the HP 3PAR FC and iSCSI drivers is now called Hewlett Packard Enterprise (HPE). The drivers are now located in the cinder/volume/drivers/hpe folder. DocImpact Implements: blueprint rebrand-hp-3par-driver Change-Id: I529429e00ef5e1b7263d40d9d50ed8ac8535d34a --- cinder/tests/unit/fake_hp_lefthand_client.py | 2 +- ...3par_client.py => fake_hpe_3par_client.py} | 14 +- ...tions.py => fake_hpe_client_exceptions.py} | 4 +- .../unit/{test_hp3par.py => test_hpe3par.py} | 884 +++++++++--------- cinder/volume/drivers/hpe/__init__.py | 0 .../hpe_3par_common.py} | 335 +++---- .../hp/hp_3par_fc.py => hpe/hpe_3par_fc.py} | 51 +- .../hpe_3par_iscsi.py} | 77 +- cinder/volume/manager.py | 6 +- 9 files changed, 685 insertions(+), 688 deletions(-) rename cinder/tests/unit/{fake_hp_3par_client.py => fake_hpe_3par_client.py} (65%) rename cinder/tests/unit/{fake_hp_client_exceptions.py => fake_hpe_client_exceptions.py} (95%) rename cinder/tests/unit/{test_hp3par.py => test_hpe3par.py} (90%) create mode 100644 cinder/volume/drivers/hpe/__init__.py rename cinder/volume/drivers/{san/hp/hp_3par_common.py => hpe/hpe_3par_common.py} (92%) rename cinder/volume/drivers/{san/hp/hp_3par_fc.py => hpe/hpe_3par_fc.py} (93%) rename cinder/volume/drivers/{san/hp/hp_3par_iscsi.py => hpe/hpe_3par_iscsi.py} (93%) diff --git a/cinder/tests/unit/fake_hp_lefthand_client.py b/cinder/tests/unit/fake_hp_lefthand_client.py index ca3376d14..8a27921a6 100644 --- a/cinder/tests/unit/fake_hp_lefthand_client.py +++ b/cinder/tests/unit/fake_hp_lefthand_client.py @@ -19,7 +19,7 @@ import sys import mock -from cinder.tests.unit import fake_hp_client_exceptions as hpexceptions +from cinder.tests.unit import fake_hpe_client_exceptions as hpexceptions hplefthand = mock.Mock() hplefthand.version = "1.0.4" diff --git a/cinder/tests/unit/fake_hp_3par_client.py b/cinder/tests/unit/fake_hpe_3par_client.py similarity index 65% rename from cinder/tests/unit/fake_hp_3par_client.py rename to cinder/tests/unit/fake_hpe_3par_client.py index 99741ead7..2e5661a62 100644 --- a/cinder/tests/unit/fake_hp_3par_client.py +++ b/cinder/tests/unit/fake_hpe_3par_client.py @@ -1,4 +1,4 @@ -# (c) Copyright 2014 Hewlett-Packard Development Company, L.P. +# (c) Copyright 2014-2015 Hewlett Packard Enterprise Development LP # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -13,16 +13,16 @@ # License for the specific language governing permissions and limitations # under the License. # -"""Fake HP client for testing 3PAR without installing the client.""" +"""Fake HPE client for testing 3PAR without installing the client.""" import sys import mock -from cinder.tests.unit import fake_hp_client_exceptions as hpexceptions +from cinder.tests.unit import fake_hpe_client_exceptions as hpeexceptions -hp3par = mock.Mock() -hp3par.version = "3.1.2" -hp3par.exceptions = hpexceptions +hpe3par = mock.Mock() +hpe3par.version = "4.0.0" +hpe3par.exceptions = hpeexceptions -sys.modules['hp3parclient'] = hp3par +sys.modules['hpe3parclient'] = hpe3par diff --git a/cinder/tests/unit/fake_hp_client_exceptions.py b/cinder/tests/unit/fake_hpe_client_exceptions.py similarity index 95% rename from cinder/tests/unit/fake_hp_client_exceptions.py rename to cinder/tests/unit/fake_hpe_client_exceptions.py index eda6efabc..71593e929 100644 --- a/cinder/tests/unit/fake_hp_client_exceptions.py +++ b/cinder/tests/unit/fake_hpe_client_exceptions.py @@ -1,4 +1,4 @@ -# (c) Copyright 2014 Hewlett-Packard Development Company, L.P. +# (c) Copyright 2014-2015 Hewlett Packard Enterprise Development LP # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. # -"""Fake HP client exceptions to use when mocking HP clients.""" +"""Fake HPE client exceptions to use when mocking HPE clients.""" class UnsupportedVersion(Exception): diff --git a/cinder/tests/unit/test_hp3par.py b/cinder/tests/unit/test_hpe3par.py similarity index 90% rename from cinder/tests/unit/test_hp3par.py rename to cinder/tests/unit/test_hpe3par.py index 5a6c01939..eb665bbd0 100644 --- a/cinder/tests/unit/test_hp3par.py +++ b/cinder/tests/unit/test_hpe3par.py @@ -1,5 +1,4 @@ -# -# (c) Copyright 2013 Hewlett-Packard Development Company, L.P. +# (c) Copyright 2013-2015 Hewlett Packard Enterprise Development LP # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -25,28 +24,28 @@ from oslo_utils import units from cinder import context from cinder import exception from cinder import test -from cinder.tests.unit import fake_hp_3par_client as hp3parclient -from cinder.volume.drivers.san.hp import hp_3par_common as hpcommon -from cinder.volume.drivers.san.hp import hp_3par_fc as hpfcdriver -from cinder.volume.drivers.san.hp import hp_3par_iscsi as hpdriver +from cinder.tests.unit import fake_hpe_3par_client as hpe3parclient +from cinder.volume.drivers.hpe import hpe_3par_common as hpecommon +from cinder.volume.drivers.hpe import hpe_3par_fc as hpefcdriver +from cinder.volume.drivers.hpe import hpe_3par_iscsi as hpedriver from cinder.volume import qos_specs from cinder.volume import utils as volume_utils from cinder.volume import volume_types -hpexceptions = hp3parclient.hpexceptions +hpeexceptions = hpe3parclient.hpeexceptions CONF = cfg.CONF -HP3PAR_CPG = 'OpenStackCPG' -HP3PAR_CPG2 = 'fakepool' -HP3PAR_CPG_QOS = 'qospool' -HP3PAR_CPG_SNAP = 'OpenStackCPGSnap' -HP3PAR_USER_NAME = 'testUser' -HP3PAR_USER_PASS = 'testPassword' -HP3PAR_SAN_IP = '2.2.2.2' -HP3PAR_SAN_SSH_PORT = 999 -HP3PAR_SAN_SSH_CON_TIMEOUT = 44 -HP3PAR_SAN_SSH_PRIVATE = 'foobar' +HPE3PAR_CPG = 'OpenStackCPG' +HPE3PAR_CPG2 = 'fakepool' +HPE3PAR_CPG_QOS = 'qospool' +HPE3PAR_CPG_SNAP = 'OpenStackCPGSnap' +HPE3PAR_USER_NAME = 'testUser' +HPE3PAR_USER_PASS = 'testPassword' +HPE3PAR_SAN_IP = '2.2.2.2' +HPE3PAR_SAN_SSH_PORT = 999 +HPE3PAR_SAN_SSH_CON_TIMEOUT = 44 +HPE3PAR_SAN_SSH_PRIVATE = 'foobar' GOODNESS_FUNCTION = \ "stats.capacity_utilization < 0.6? 100:25" FILTER_FUNCTION = \ @@ -72,7 +71,7 @@ QUEUE_LENGTH = 'queue_length' AVG_BUSY_PERC = 'avg_busy_perc' -class HP3PARBaseDriver(object): +class HPE3PARBaseDriver(object): class CommentMatcher(object): def __init__(self, f, expect): @@ -100,7 +99,7 @@ class HP3PARBaseDriver(object): CGSNAPSHOT_BASE_NAME = 'oss-6Rxe1druToSHJByeMeeh8g' # fake host on the 3par FAKE_HOST = 'fakehost' - FAKE_CINDER_HOST = 'fakehost@foo#' + HP3PAR_CPG + FAKE_CINDER_HOST = 'fakehost@foo#' + HPE3PAR_CPG USER_ID = '2689d9a913974c008b1d859013f23607' PROJECT_ID = 'fac88235b9d64685a3530f73e490348f' VOLUME_ID_SNAP = '761fc5e5-5191-4ec7-aeba-33e36de44156' @@ -158,7 +157,7 @@ class HP3PARBaseDriver(object): 'id': VOLUME_ID, 'display_name': 'Foo Volume', 'size': 2, - 'host': volume_utils.append_host(FAKE_HOST, HP3PAR_CPG2), + 'host': volume_utils.append_host(FAKE_HOST, HPE3PAR_CPG2), 'volume_type': None, 'volume_type_id': None} @@ -211,7 +210,7 @@ class HP3PARBaseDriver(object): volume_type = {'name': 'gold', 'deleted': False, 'updated_at': None, - 'extra_specs': {'cpg': HP3PAR_CPG2, + 'extra_specs': {'cpg': HPE3PAR_CPG2, 'qos:maxIOPS': '1000', 'qos:maxBWS': '50', 'qos:minIOPS': '100', @@ -224,7 +223,7 @@ class HP3PARBaseDriver(object): volume_type_dedup = {'name': 'dedup', 'deleted': False, 'updated_at': None, - 'extra_specs': {'cpg': HP3PAR_CPG2, + 'extra_specs': {'cpg': HPE3PAR_CPG2, 'provisioning': 'dedup'}, 'deleted_at': None, 'id': VOLUME_TYPE_ID_DEDUP} @@ -232,8 +231,8 @@ class HP3PARBaseDriver(object): volume_type_flash_cache = {'name': 'flash-cache-on', 'deleted': False, 'updated_at': None, - 'extra_specs': {'cpg': HP3PAR_CPG2, - 'hp3par:flash_cache': 'true'}, + 'extra_specs': {'cpg': HPE3PAR_CPG2, + 'hpe3par:flash_cache': 'true'}, 'deleted_at': None, 'id': VOLUME_TYPE_ID_FLASH_CACHE} @@ -261,7 +260,7 @@ class HP3PARBaseDriver(object): 'degradedStates': [], 'failedStates': [], 'id': 5, - 'name': HP3PAR_CPG, + 'name': HPE3PAR_CPG, 'numFPVVs': 2, 'numTPVVs': 0, 'numTDVVs': 1, @@ -299,15 +298,15 @@ class HP3PARBaseDriver(object): u'host': u'mark-stack1@3parfc', u'capabilities': { 'QoS_support': True, - u'location_info': u'HP3PARDriver:1234567:MARK_TEST_CPG', + u'location_info': u'HPE3PARDriver:1234567:MARK_TEST_CPG', u'timestamp': u'2014-06-04T19:03:32.485540', u'allocated_capacity_gb': 0, u'volume_backend_name': u'3parfc', u'free_capacity_gb': u'infinite', - u'driver_version': u'2.0.3', + u'driver_version': u'3.0.0', u'total_capacity_gb': u'infinite', u'reserved_percentage': 0, - u'vendor_name': u'Hewlett-Packard', + u'vendor_name': u'Hewlett Packard Enterprise', u'storage_protocol': u'FC' } } @@ -329,8 +328,8 @@ class HP3PARBaseDriver(object): 'name': 'red', 'id': RETYPE_VOLUME_TYPE_ID, 'extra_specs': { - 'cpg': HP3PAR_CPG, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs': RETYPE_VVS_NAME, 'qos': RETYPE_QOS_SPECS, 'tpvv': True, @@ -343,8 +342,8 @@ class HP3PARBaseDriver(object): 'name': 'white', 'id': RETYPE_VOLUME_TYPE_ID, 'extra_specs': { - 'cpg': HP3PAR_CPG, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs': VVS_NAME, 'qos': QOS, 'tpvv': True, @@ -357,8 +356,8 @@ class HP3PARBaseDriver(object): 'name': 'blue', 'id': RETYPE_VOLUME_TYPE_ID, 'extra_specs': { - 'cpg': HP3PAR_CPG_QOS, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG_QOS, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs': RETYPE_VVS_NAME, 'qos': RETYPE_QOS_SPECS, 'tpvv': True, @@ -371,8 +370,8 @@ class HP3PARBaseDriver(object): 'name': 'purple', 'id': RETYPE_VOLUME_TYPE_ID, 'extra_specs': { - 'cpg': HP3PAR_CPG_QOS, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG_QOS, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs': RETYPE_VVS_NAME, 'qos': RETYPE_QOS_SPECS, 'tpvv': False, @@ -384,7 +383,7 @@ class HP3PARBaseDriver(object): 'name': 'bad_persona', 'id': 'any_id', 'extra_specs': { - 'hp3par:persona': '99 - invalid' + 'hpe3par:persona': '99 - invalid' } } @@ -394,7 +393,7 @@ class HP3PARBaseDriver(object): 'extra_specs': { 'cpg': 'bogus', 'snap_cpg': 'bogus', - 'hp3par:persona': '2 - Generic-ALUA' + 'hpe3par:persona': '2 - Generic-ALUA' } } @@ -433,8 +432,8 @@ class HP3PARBaseDriver(object): 'display_name': 'Retype Vol1', 'size': 1, 'host': RETYPE_HOST, - 'userCPG': HP3PAR_CPG, - 'snapCPG': HP3PAR_CPG_SNAP, + 'userCPG': HPE3PAR_CPG, + 'snapCPG': HPE3PAR_CPG_SNAP, 'provisioningType': 1, 'comment': RETYPE_TEST_COMMENT } @@ -447,8 +446,8 @@ class HP3PARBaseDriver(object): 'display_name': 'Retype Vol2', 'size': 1, 'host': RETYPE_HOST, - 'userCPG': HP3PAR_CPG, - 'snapCPG': HP3PAR_CPG_SNAP, + 'userCPG': HPE3PAR_CPG, + 'snapCPG': HPE3PAR_CPG_SNAP, 'provisioningType': 3, 'comment': RETYPE_TEST_COMMENT } @@ -497,47 +496,47 @@ class HP3PARBaseDriver(object): wsapi_version_latest = wsapi_version_for_flash_cache standard_login = [ - mock.call.login(HP3PAR_USER_NAME, HP3PAR_USER_PASS), + mock.call.login(HPE3PAR_USER_NAME, HPE3PAR_USER_PASS), mock.call.setSSHOptions( - HP3PAR_SAN_IP, - HP3PAR_USER_NAME, - HP3PAR_USER_PASS, + HPE3PAR_SAN_IP, + HPE3PAR_USER_NAME, + HPE3PAR_USER_PASS, missing_key_policy='AutoAddPolicy', - privatekey=HP3PAR_SAN_SSH_PRIVATE, + privatekey=HPE3PAR_SAN_SSH_PRIVATE, known_hosts_file=mock.ANY, - port=HP3PAR_SAN_SSH_PORT, - conn_timeout=HP3PAR_SAN_SSH_CON_TIMEOUT)] + port=HPE3PAR_SAN_SSH_PORT, + conn_timeout=HPE3PAR_SAN_SSH_CON_TIMEOUT)] standard_logout = [ mock.call.logout()] def setup_configuration(self): configuration = mock.Mock() - configuration.hp3par_debug = False - configuration.hp3par_username = HP3PAR_USER_NAME - configuration.hp3par_password = HP3PAR_USER_PASS - configuration.hp3par_api_url = 'https://1.1.1.1/api/v1' - configuration.hp3par_cpg = [HP3PAR_CPG, HP3PAR_CPG2] - configuration.hp3par_cpg_snap = HP3PAR_CPG_SNAP + configuration.hpe3par_debug = False + configuration.hpe3par_username = HPE3PAR_USER_NAME + configuration.hpe3par_password = HPE3PAR_USER_PASS + configuration.hpe3par_api_url = 'https://1.1.1.1/api/v1' + configuration.hpe3par_cpg = [HPE3PAR_CPG, HPE3PAR_CPG2] + configuration.hpe3par_cpg_snap = HPE3PAR_CPG_SNAP configuration.iscsi_ip_address = '1.1.1.2' configuration.iscsi_port = '1234' - configuration.san_ip = HP3PAR_SAN_IP - configuration.san_login = HP3PAR_USER_NAME - configuration.san_password = HP3PAR_USER_PASS - configuration.san_ssh_port = HP3PAR_SAN_SSH_PORT - configuration.ssh_conn_timeout = HP3PAR_SAN_SSH_CON_TIMEOUT - configuration.san_private_key = HP3PAR_SAN_SSH_PRIVATE - configuration.hp3par_snapshot_expiration = "" - configuration.hp3par_snapshot_retention = "" - configuration.hp3par_iscsi_ips = [] - configuration.hp3par_iscsi_chap_enabled = False + configuration.san_ip = HPE3PAR_SAN_IP + configuration.san_login = HPE3PAR_USER_NAME + configuration.san_password = HPE3PAR_USER_PASS + configuration.san_ssh_port = HPE3PAR_SAN_SSH_PORT + configuration.ssh_conn_timeout = HPE3PAR_SAN_SSH_CON_TIMEOUT + configuration.san_private_key = HPE3PAR_SAN_SSH_PRIVATE + configuration.hpe3par_snapshot_expiration = "" + configuration.hpe3par_snapshot_retention = "" + configuration.hpe3par_iscsi_ips = [] + configuration.hpe3par_iscsi_chap_enabled = False configuration.goodness_function = GOODNESS_FUNCTION configuration.filter_function = FILTER_FUNCTION configuration.image_volume_cache_enabled = False return configuration @mock.patch( - 'hp3parclient.client.HP3ParClient', + 'hpe3parclient.client.HPE3ParClient', spec=True, ) def setup_mock_client(self, _m_client, driver, conf=None, m_conf=None): @@ -557,13 +556,12 @@ class HP3PARBaseDriver(object): self.driver.do_setup(None) return _m_client - @mock.patch('hp3parclient.version', "3.0.9") + @mock.patch('hpe3parclient.version', "3.0.9") def test_unsupported_client_version(self): self.assertRaises(exception.InvalidInput, self.setup_driver) - @mock.patch('hp3parclient.version', "3.1.2") def test_ssh_options(self): expected_hosts_key_file = "test_hosts_key_file" @@ -573,29 +571,29 @@ class HP3PARBaseDriver(object): CONF.strict_ssh_host_key_policy = False self.ctxt = context.get_admin_context() - mock_client = self.setup_mock_client(driver=hpfcdriver.HP3PARFCDriver) + mock_client = self.setup_mock_client( + driver=hpefcdriver.HPE3PARFCDriver) CONF.ssh_hosts_key_file = orig_ssh_hosts_key_file CONF.strict_ssh_host_key_policy = orig_strict_ssh_host_key_policy expected = [ - mock.call.login(HP3PAR_USER_NAME, HP3PAR_USER_PASS), + mock.call.login(HPE3PAR_USER_NAME, HPE3PAR_USER_PASS), mock.call.setSSHOptions( - HP3PAR_SAN_IP, - HP3PAR_USER_NAME, - HP3PAR_USER_PASS, - privatekey=HP3PAR_SAN_SSH_PRIVATE, + HPE3PAR_SAN_IP, + HPE3PAR_USER_NAME, + HPE3PAR_USER_PASS, + privatekey=HPE3PAR_SAN_SSH_PRIVATE, known_hosts_file=expected_hosts_key_file, missing_key_policy="AutoAddPolicy", - port=HP3PAR_SAN_SSH_PORT, - conn_timeout=HP3PAR_SAN_SSH_CON_TIMEOUT), - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2)] + port=HPE3PAR_SAN_SSH_PORT, + conn_timeout=HPE3PAR_SAN_SSH_CON_TIMEOUT), + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2)] mock_client.assert_has_calls( expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.1.2") def test_ssh_options_strict(self): expected_hosts_key_file = "test_hosts_key_file" @@ -605,24 +603,25 @@ class HP3PARBaseDriver(object): CONF.strict_ssh_host_key_policy = True self.ctxt = context.get_admin_context() - mock_client = self.setup_mock_client(driver=hpfcdriver.HP3PARFCDriver) + mock_client = self.setup_mock_client( + driver=hpefcdriver.HPE3PARFCDriver) CONF.ssh_hosts_key_file = orig_ssh_hosts_key_file CONF.strict_ssh_host_key_policy = orig_strict_ssh_host_key_policy expected = [ - mock.call.login(HP3PAR_USER_NAME, HP3PAR_USER_PASS), + mock.call.login(HPE3PAR_USER_NAME, HPE3PAR_USER_PASS), mock.call.setSSHOptions( - HP3PAR_SAN_IP, - HP3PAR_USER_NAME, - HP3PAR_USER_PASS, - privatekey=HP3PAR_SAN_SSH_PRIVATE, + HPE3PAR_SAN_IP, + HPE3PAR_USER_NAME, + HPE3PAR_USER_PASS, + privatekey=HPE3PAR_SAN_SSH_PRIVATE, known_hosts_file=expected_hosts_key_file, missing_key_policy="RejectPolicy", - port=HP3PAR_SAN_SSH_PORT, - conn_timeout=HP3PAR_SAN_SSH_CON_TIMEOUT), - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2)] + port=HPE3PAR_SAN_SSH_PORT, + conn_timeout=HPE3PAR_SAN_SSH_CON_TIMEOUT), + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2)] mock_client.assert_has_calls(expected + self.standard_logout) def test_task_waiter(self): @@ -638,7 +637,7 @@ class HP3PARBaseDriver(object): task_id = 1234 interval = .001 - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -657,7 +656,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.create_volume(self.volume) @@ -668,12 +667,12 @@ class HP3PARBaseDriver(object): expected = [ mock.call.createVolume( self.VOLUME_3PAR_NAME, - HP3PAR_CPG, + HPE3PAR_CPG, 2048, { 'comment': comment, 'tpvv': True, 'tdvv': False, - 'snapCPG': HP3PAR_CPG_SNAP})] + 'snapCPG': HPE3PAR_CPG_SNAP})] mock_client.assert_has_calls( self.standard_login + @@ -685,7 +684,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client @@ -697,12 +696,12 @@ class HP3PARBaseDriver(object): expected = [ mock.call.createVolume( self.VOLUME_3PAR_NAME, - HP3PAR_CPG2, + HPE3PAR_CPG2, 2048, { 'comment': comment, 'tpvv': True, 'tdvv': False, - 'snapCPG': HP3PAR_CPG_SNAP})] + 'snapCPG': HPE3PAR_CPG_SNAP})] mock_client.assert_has_calls( self.standard_login + @@ -717,14 +716,14 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = { 'name': 'dedup', 'extra_specs': { - 'cpg': HP3PAR_CPG_QOS, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG_QOS, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs_name': self.VVS_NAME, 'qos': self.QOS, 'provisioning': 'dedup', 'volume_type': self.volume_type_dedup}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -742,17 +741,17 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = { 'name': 'gold', 'extra_specs': { - 'cpg': HP3PAR_CPG, + 'cpg': HPE3PAR_CPG, 'snap_cpg': expected_type_snap_cpg, 'volume_type': self.volume_type}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() result = common.get_volume_settings_from_type_id( - "mock", self.driver.configuration.hp3par_cpg) + "mock", self.driver.configuration.hpe3par_cpg) self.assertEqual(expected_type_snap_cpg, result['snap_cpg']) @@ -767,15 +766,15 @@ class HP3PARBaseDriver(object): 'cpg': expected_cpg, 'volume_type': self.volume_type}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() result = common.get_volume_settings_from_type_id( - "mock", self.driver.configuration.hp3par_cpg) + "mock", self.driver.configuration.hpe3par_cpg) - self.assertEqual(self.driver.configuration.hp3par_cpg_snap, + self.assertEqual(self.driver.configuration.hpe3par_cpg_snap, result['snap_cpg']) @mock.patch.object(volume_types, 'get_volume_type') @@ -787,15 +786,15 @@ class HP3PARBaseDriver(object): 'volume_type': self.volume_type}} conf = self.setup_configuration() - expected_snap_cpg = conf.hp3par_cpg_snap + expected_snap_cpg = conf.hpe3par_cpg_snap mock_client = self.setup_driver(config=conf) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() result = common.get_volume_settings_from_type_id( - "mock", self.driver.configuration.hp3par_cpg) + "mock", self.driver.configuration.hpe3par_cpg) self.assertEqual(expected_snap_cpg, result['snap_cpg']) @@ -808,16 +807,16 @@ class HP3PARBaseDriver(object): 'volume_type': self.volume_type}} conf = self.setup_configuration() - conf.hp3par_cpg_snap = None - expected_cpg = conf.hp3par_cpg + conf.hpe3par_cpg_snap = None + expected_cpg = conf.hpe3par_cpg mock_client = self.setup_driver(config=conf) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() result = common.get_volume_settings_from_type_id( - "mock", self.driver.configuration.hp3par_cpg) + "mock", self.driver.configuration.hpe3par_cpg) self.assertEqual(expected_cpg, result['snap_cpg']) @@ -830,15 +829,15 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = { 'name': 'gold', 'extra_specs': { - 'cpg': HP3PAR_CPG_QOS, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG_QOS, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs_name': self.VVS_NAME, 'qos': self.QOS, 'tpvv': True, 'tdvv': False, 'volume_type': self.volume_type}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client @@ -850,15 +849,15 @@ class HP3PARBaseDriver(object): '15-48a3-8dfc-35cdfcdc15a7", "qos": {}, "type": "OpenStack"}') expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolume( self.VOLUME_3PAR_NAME, - HP3PAR_CPG, + HPE3PAR_CPG, 2048, { 'comment': comment, 'tpvv': True, 'tdvv': False, - 'snapCPG': HP3PAR_CPG_SNAP})] + 'snapCPG': HPE3PAR_CPG_SNAP})] mock_client.assert_has_calls( self.standard_login + @@ -875,14 +874,14 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = { 'name': 'dedup', 'extra_specs': { - 'cpg': HP3PAR_CPG_QOS, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG_QOS, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs_name': self.VVS_NAME, 'qos': self.QOS, 'provisioning': 'dedup', 'volume_type': self.volume_type_dedup}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client @@ -895,15 +894,15 @@ class HP3PARBaseDriver(object): ', "qos": {}, "type": "OpenStack"}') expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolume( self.VOLUME_3PAR_NAME, - HP3PAR_CPG, + HPE3PAR_CPG, 2048, { 'comment': comment, 'tpvv': False, 'tdvv': True, - 'snapCPG': HP3PAR_CPG_SNAP})] + 'snapCPG': HPE3PAR_CPG_SNAP})] mock_client.assert_has_calls( self.standard_login + expected + @@ -919,16 +918,16 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = { 'name': 'flash-cache-on', 'extra_specs': { - 'cpg': HP3PAR_CPG2, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG2, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs_name': self.VVS_NAME, 'qos': self.QOS, 'tpvv': True, 'tdvv': False, - 'hp3par:flash_cache': 'true', + 'hpe3par:flash_cache': 'true', 'volume_type': self.volume_type_flash_cache}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client mock_client.getCPG.return_value = {'domain': None} @@ -945,16 +944,16 @@ class HP3PARBaseDriver(object): '"qos": {}, "type": "OpenStack"}') expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolume( self.VOLUME_3PAR_NAME, - HP3PAR_CPG, + HPE3PAR_CPG, 2048, { 'comment': comment, 'tpvv': True, 'tdvv': False, - 'snapCPG': HP3PAR_CPG_SNAP}), - mock.call.getCPG(HP3PAR_CPG), + 'snapCPG': HPE3PAR_CPG_SNAP}), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolumeSet('vvs-0DM4qZEVSKON-DXN-NwVpw', None), mock.call.createQoSRules( 'vvs-0DM4qZEVSKON-DXN-NwVpw', @@ -980,16 +979,16 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = { 'name': 'flash-cache-on', 'extra_specs': { - 'cpg': HP3PAR_CPG2, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG2, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs_name': self.VVS_NAME, 'qos': self.QOS, 'tpvv': True, 'tdvv': False, - 'hp3par:flash_cache': 'true', + 'hpe3par:flash_cache': 'true', 'volume_type': self.volume_type_flash_cache}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -1003,7 +1002,7 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_1 mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.assertRaises(exception.InvalidHost, @@ -1024,12 +1023,12 @@ class HP3PARBaseDriver(object): def test_retype_volume_not_found(self, _mock_volume_types): _mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_1 mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF) - mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound + mock_client.getVolume.side_effect = hpeexceptions.HTTPNotFound - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client - self.assertRaises(hpexceptions.HTTPNotFound, + self.assertRaises(hpeexceptions.HTTPNotFound, self.driver.retype, self.ctxt, self.RETYPE_VOLUME_INFO_0, @@ -1052,12 +1051,12 @@ class HP3PARBaseDriver(object): # Fail the QOS setting to test the revert of the snap CPG rename. mock_client.addVolumeToVolumeSet.side_effect = \ - hpexceptions.HTTPForbidden + hpeexceptions.HTTPForbidden - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client - self.assertRaises(hpexceptions.HTTPForbidden, + self.assertRaises(hpeexceptions.HTTPForbidden, self.driver.retype, self.ctxt, {'id': self.VOLUME_ID}, @@ -1090,12 +1089,12 @@ class HP3PARBaseDriver(object): mock_client.getVolume.return_value = self.RETYPE_VOLUME_INFO_1 # Fail the QOS setting to test the revert of the snap CPG rename. - mock_client.deleteVolumeSet.side_effect = hpexceptions.HTTPForbidden + mock_client.deleteVolumeSet.side_effect = hpeexceptions.HTTPForbidden - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client - self.assertRaises(hpexceptions.HTTPForbidden, + self.assertRaises(hpeexceptions.HTTPForbidden, self.driver.retype, self.ctxt, {'id': self.VOLUME_ID}, @@ -1119,7 +1118,7 @@ class HP3PARBaseDriver(object): mock_client.getStorageSystemInfo.return_value = { 'serialNumber': 'XXXXXXX'} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.assertRaises(exception.InvalidHost, @@ -1149,7 +1148,7 @@ class HP3PARBaseDriver(object): {'domain': 'domain2'}, ] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.assertRaises(exception.Invalid3PARDomain, @@ -1183,7 +1182,7 @@ class HP3PARBaseDriver(object): {'domain': 'snap_cpg_domain_1'}, ] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.assertRaises(exception.Invalid3PARDomain, @@ -1213,7 +1212,7 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_BAD_PERSONA mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.assertRaises(exception.InvalidInput, @@ -1249,9 +1248,9 @@ class HP3PARBaseDriver(object): type_ref = volume_types.get_volume_type(self.ctxt, type_ref['id']) - volume = {'id': HP3PARBaseDriver.CLONE_ID} + volume = {'id': HPE3PARBaseDriver.CLONE_ID} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client @@ -1283,14 +1282,14 @@ class HP3PARBaseDriver(object): cpg = "any_cpg" snap_cpg = "any_cpg" - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() common._retype(self.volume, - HP3PARBaseDriver.VOLUME_3PAR_NAME, + HPE3PARBaseDriver.VOLUME_3PAR_NAME, "old_type", "old_type_id", - HP3PARBaseDriver.RETYPE_HOST, + HPE3PARBaseDriver.RETYPE_HOST, None, cpg, cpg, snap_cpg, snap_cpg, True, False, False, True, None, None, self.QOS_SPECS, self.RETYPE_QOS_SPECS, @@ -1318,14 +1317,14 @@ class HP3PARBaseDriver(object): cpg = "any_cpg" snap_cpg = "any_cpg" - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() common._retype(self.volume, - HP3PARBaseDriver.VOLUME_3PAR_NAME, + HPE3PARBaseDriver.VOLUME_3PAR_NAME, "old_type", "old_type_id", - HP3PARBaseDriver.RETYPE_HOST, + HPE3PARBaseDriver.RETYPE_HOST, None, cpg, cpg, snap_cpg, snap_cpg, True, False, False, True, None, None, self.QOS_SPECS, self.RETYPE_QOS_SPECS, @@ -1345,7 +1344,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.delete_volume(self.volume) @@ -1362,18 +1361,18 @@ class HP3PARBaseDriver(object): # and return the mock HTTP 3PAR client mock_client = self.setup_driver() mock_client.copyVolume.return_value = {'taskid': 1} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client - volume = {'name': HP3PARBaseDriver.VOLUME_NAME, - 'id': HP3PARBaseDriver.CLONE_ID, + volume = {'name': HPE3PARBaseDriver.VOLUME_NAME, + 'id': HPE3PARBaseDriver.CLONE_ID, 'display_name': 'Foo Volume', 'size': 2, 'host': volume_utils.append_host(self.FAKE_HOST, - HP3PAR_CPG2), - 'source_volid': HP3PARBaseDriver.VOLUME_ID} - src_vref = {'id': HP3PARBaseDriver.VOLUME_ID} + HPE3PAR_CPG2), + 'source_volid': HPE3PARBaseDriver.VOLUME_ID} + src_vref = {'id': HPE3PARBaseDriver.VOLUME_ID} model_update = self.driver.create_cloned_volume(volume, src_vref) self.assertIsNone(model_update) @@ -1381,7 +1380,7 @@ class HP3PARBaseDriver(object): mock.call.copyVolume( self.VOLUME_3PAR_NAME, 'osv-0DM4qZEVSKON-AAAAAAAAA', - HP3PAR_CPG2, + HPE3PAR_CPG2, {'snapCPG': 'OpenStackCPGSnap', 'tpvv': True, 'tdvv': False, 'online': True})] @@ -1395,19 +1394,19 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_2 mock_client = self.setup_driver() mock_client.copyVolume.return_value = {'taskid': 1} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client - src_vref = {'id': HP3PARBaseDriver.CLONE_ID} + src_vref = {'id': HPE3PARBaseDriver.CLONE_ID} volume = self.volume_qos.copy() host = "TEST_HOST" pool = "TEST_POOL" volume_host = volume_utils.append_host(host, pool) expected_cpg = pool - volume['id'] = HP3PARBaseDriver.VOLUME_ID + volume['id'] = HPE3PARBaseDriver.VOLUME_ID volume['host'] = volume_host - volume['source_volid'] = HP3PARBaseDriver.CLONE_ID + volume['source_volid'] = HPE3PARBaseDriver.CLONE_ID model_update = self.driver.create_cloned_volume(volume, src_vref) self.assertEqual(None, model_update) @@ -1443,22 +1442,22 @@ class HP3PARBaseDriver(object): mock_client.modifyVolume.return_value = ("anyResponse", {'taskid': 1}) mock_client.getTask.return_value = self.STATUS_DONE - volume = {'name': HP3PARBaseDriver.VOLUME_NAME, - 'id': HP3PARBaseDriver.CLONE_ID, + volume = {'name': HPE3PARBaseDriver.VOLUME_NAME, + 'id': HPE3PARBaseDriver.CLONE_ID, 'display_name': 'Foo Volume', 'volume_type_id': None, 'size': 2, 'status': 'available', - 'host': HP3PARBaseDriver.FAKE_HOST, - 'source_volid': HP3PARBaseDriver.VOLUME_ID} - with mock.patch.object(hpcommon.HP3PARCommon, + 'host': HPE3PARBaseDriver.FAKE_HOST, + 'source_volid': HPE3PARBaseDriver.VOLUME_ID} + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() volume_name_3par = common._encode_name(volume['id']) - loc_info = 'HP3PARDriver:1234:CPG-FC1' + loc_info = 'HPE3PARDriver:1234:CPG-FC1' host = {'host': 'stack@3parfc1#CPG-FC1', 'capabilities': {'location_info': loc_info}} @@ -1473,7 +1472,7 @@ class HP3PARBaseDriver(object): mock.call.modifyVolume( osv_matcher, {'comment': '{"qos": {}, "display_name": "Foo Volume"}', - 'snapCPG': HP3PAR_CPG_SNAP}), + 'snapCPG': HPE3PAR_CPG_SNAP}), mock.call.modifyVolume(osv_matcher, {'action': 6, 'userCPG': 'CPG-FC1', @@ -1505,23 +1504,23 @@ class HP3PARBaseDriver(object): mock_client.getTask.return_value = self.STATUS_DONE display_name = 'Foo Volume' - volume = {'name': HP3PARBaseDriver.VOLUME_NAME, - 'id': HP3PARBaseDriver.CLONE_ID, + volume = {'name': HPE3PARBaseDriver.VOLUME_NAME, + 'id': HPE3PARBaseDriver.CLONE_ID, 'display_name': display_name, "volume_type_id": self.RETYPE_VOLUME_TYPE_2['id'], 'size': 2, 'status': 'available', - 'host': HP3PARBaseDriver.FAKE_HOST, - 'source_volid': HP3PARBaseDriver.VOLUME_ID} + 'host': HPE3PARBaseDriver.FAKE_HOST, + 'source_volid': HPE3PARBaseDriver.VOLUME_ID} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() volume_name_3par = common._encode_name(volume['id']) - loc_info = 'HP3PARDriver:1234:CPG-FC1' + loc_info = 'HPE3PARDriver:1234:CPG-FC1' instance_host = 'stack@3parfc1#CPG-FC1' host = {'host': instance_host, 'capabilities': {'location_info': loc_info}} @@ -1568,20 +1567,20 @@ class HP3PARBaseDriver(object): mock_client = self.setup_driver(mock_conf=conf) - volume = {'name': HP3PARBaseDriver.VOLUME_NAME, - 'id': HP3PARBaseDriver.CLONE_ID, + volume = {'name': HPE3PARBaseDriver.VOLUME_NAME, + 'id': HPE3PARBaseDriver.CLONE_ID, 'display_name': 'Foo Volume', 'volume_type_id': None, 'size': 2, 'status': 'available', - 'host': HP3PARBaseDriver.FAKE_HOST, - 'source_volid': HP3PARBaseDriver.VOLUME_ID} + 'host': HPE3PARBaseDriver.FAKE_HOST, + 'source_volid': HPE3PARBaseDriver.VOLUME_ID} - loc_info = 'HP3PARDriver:1234:CPG-FC1' + loc_info = 'HPE3PARDriver:1234:CPG-FC1' host = {'host': 'stack@3parfc1', 'capabilities': {'location_info': loc_info}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client result = self.driver.migrate_volume(context.get_admin_context(), @@ -1609,23 +1608,23 @@ class HP3PARBaseDriver(object): mock_client.modifyVolume.return_value = ("anyResponse", {'taskid': 1}) mock_client.getTask.return_value = self.STATUS_DONE - volume = {'name': HP3PARBaseDriver.VOLUME_NAME, - 'id': HP3PARBaseDriver.CLONE_ID, + volume = {'name': HPE3PARBaseDriver.VOLUME_NAME, + 'id': HPE3PARBaseDriver.CLONE_ID, 'display_name': 'Foo Volume', 'volume_type_id': None, 'size': 2, 'status': 'available', - 'host': HP3PARBaseDriver.FAKE_HOST, - 'source_volid': HP3PARBaseDriver.VOLUME_ID} + 'host': HPE3PARBaseDriver.FAKE_HOST, + 'source_volid': HPE3PARBaseDriver.VOLUME_ID} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() volume_name_3par = common._encode_name(volume['id']) - loc_info = 'HP3PARDriver:1234:CPG-FC1' + loc_info = 'HPE3PARDriver:1234:CPG-FC1' host = {'host': 'stack@3parfc1#CPG-FC1', 'capabilities': {'location_info': loc_info}} @@ -1640,7 +1639,7 @@ class HP3PARBaseDriver(object): mock.call.modifyVolume( osv_matcher, {'comment': '{"qos": {}, "display_name": "Foo Volume"}', - 'snapCPG': HP3PAR_CPG_SNAP}), + 'snapCPG': HPE3PAR_CPG_SNAP}), mock.call.modifyVolume(osv_matcher, {'action': 6, 'userCPG': 'CPG-FC1', @@ -1656,16 +1655,16 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_1 mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF) - volume = {'name': HP3PARBaseDriver.VOLUME_NAME, + volume = {'name': HPE3PARBaseDriver.VOLUME_NAME, 'volume_type_id': None, - 'id': HP3PARBaseDriver.CLONE_ID, + 'id': HPE3PARBaseDriver.CLONE_ID, 'display_name': 'Foo Volume', 'size': 2, 'status': 'in-use', - 'host': HP3PARBaseDriver.FAKE_HOST, - 'source_volid': HP3PARBaseDriver.VOLUME_ID} + 'host': HPE3PARBaseDriver.FAKE_HOST, + 'source_volid': HPE3PARBaseDriver.VOLUME_ID} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -1673,7 +1672,7 @@ class HP3PARBaseDriver(object): volume_name_3par = common._encode_name(volume['id']) osv_matcher = 'osv-' + volume_name_3par - loc_info = 'HP3PARDriver:1234567:CPG-FC1' + loc_info = 'HPE3PARDriver:1234567:CPG-FC1' protocol = "FC" if self.properties['driver_volume_type'] == "iscsi": @@ -1714,16 +1713,16 @@ class HP3PARBaseDriver(object): protocol = "OTHER" - volume = {'name': HP3PARBaseDriver.VOLUME_NAME, + volume = {'name': HPE3PARBaseDriver.VOLUME_NAME, 'volume_type_id': None, - 'id': HP3PARBaseDriver.CLONE_ID, + 'id': HPE3PARBaseDriver.CLONE_ID, 'display_name': 'Foo Volume', 'size': 2, 'status': 'in-use', - 'host': HP3PARBaseDriver.FAKE_HOST, - 'source_volid': HP3PARBaseDriver.VOLUME_ID} + 'host': HPE3PARBaseDriver.FAKE_HOST, + 'source_volid': HPE3PARBaseDriver.VOLUME_ID} - loc_info = 'HP3PARDriver:1234567:CPG-FC1' + loc_info = 'HPE3PARDriver:1234567:CPG-FC1' host = {'host': 'stack@3parfc1', 'capabilities': {'location_info': loc_info, 'storage_protocol': protocol}} @@ -1744,7 +1743,7 @@ class HP3PARBaseDriver(object): '_name_id': self.CLONE_ID, 'provider_location': provider_location} original_volume_status = 'available' - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client actual_update = self.driver.update_migrated_volume( @@ -1764,7 +1763,7 @@ class HP3PARBaseDriver(object): 'provider_location': provider_location} original_volume_status = 'in-use' - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client actual_update = self.driver.update_migrated_volume( @@ -1779,7 +1778,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.attach_volume(context.get_admin_context(), @@ -1810,7 +1809,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.detach_volume(context.get_admin_context(), self.volume, @@ -1834,7 +1833,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.create_snapshot(self.snapshot) @@ -1863,7 +1862,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.delete_snapshot(self.snapshot) @@ -1880,13 +1879,13 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.create_snapshot(self.snapshot) self.driver.create_volume_from_snapshot(self.volume, self.snapshot) - ex = hpexceptions.HTTPConflict("In use") + ex = hpeexceptions.HTTPConflict("In use") mock_client.deleteVolume = mock.Mock(side_effect=ex) # Deleting the snapshot that a volume is dependent on should fail @@ -1899,13 +1898,13 @@ class HP3PARBaseDriver(object): # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.create_snapshot(self.snapshot) try: - ex = hpexceptions.HTTPNotFound("not found") + ex = hpeexceptions.HTTPNotFound("not found") mock_client.deleteVolume = mock.Mock(side_effect=ex) self.driver.delete_snapshot(self.snapshot) except Exception: @@ -1916,7 +1915,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client @@ -1960,7 +1959,7 @@ class HP3PARBaseDriver(object): } mock_client = self.setup_driver(mock_conf=conf) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -1989,7 +1988,7 @@ class HP3PARBaseDriver(object): 'comment': comment, 'readOnly': False}), mock.call.copyVolume( - osv_matcher, omv_matcher, HP3PAR_CPG, mock.ANY), + osv_matcher, omv_matcher, HPE3PAR_CPG, mock.ANY), mock.call.getTask(mock.ANY), mock.call.getVolume(osv_matcher), mock.call.deleteVolume(osv_matcher), @@ -2017,15 +2016,15 @@ class HP3PARBaseDriver(object): _mock_volume_types.return_value = { 'name': 'gold', 'extra_specs': { - 'cpg': HP3PAR_CPG_QOS, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG_QOS, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs_name': self.VVS_NAME, 'qos': self.QOS, 'tpvv': True, 'tdvv': False, 'volume_type': self.volume_type}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2053,9 +2052,9 @@ class HP3PARBaseDriver(object): { 'comment': comment, 'readOnly': False}), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.copyVolume( - osv_matcher, omv_matcher, HP3PAR_CPG, mock.ANY), + osv_matcher, omv_matcher, HPE3PAR_CPG, mock.ANY), mock.call.getTask(mock.ANY), mock.call.getVolume(osv_matcher), mock.call.deleteVolume(osv_matcher), @@ -2080,7 +2079,7 @@ class HP3PARBaseDriver(object): mock_client = self.setup_driver(mock_conf=conf) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client volume = self.volume.copy() @@ -2095,14 +2094,14 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client _mock_volume_types.return_value = { 'name': 'gold', 'extra_specs': { - 'cpg': HP3PAR_CPG, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs_name': self.VVS_NAME, 'qos': self.QOS, 'tpvv': True, @@ -2150,7 +2149,7 @@ class HP3PARBaseDriver(object): }] } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver.terminate_connection( @@ -2185,7 +2184,7 @@ class HP3PARBaseDriver(object): key = 'a' value = 'b' - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2212,7 +2211,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client key = 'a' @@ -2235,7 +2234,7 @@ class HP3PARBaseDriver(object): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client grow_size = 3 @@ -2250,7 +2249,7 @@ class HP3PARBaseDriver(object): mock_client.assert_has_calls(expected) def test_extend_volume_non_base(self): - extend_ex = hpexceptions.HTTPForbidden(error={'code': 150}) + extend_ex = hpeexceptions.HTTPForbidden(error={'code': 150}) conf = { 'getTask.return_value': { 'status': 1}, @@ -2263,7 +2262,7 @@ class HP3PARBaseDriver(object): } mock_client = self.setup_driver(mock_conf=conf) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client grow_size = 3 @@ -2274,7 +2273,7 @@ class HP3PARBaseDriver(object): self.assertEqual(2, mock_client.growVolume.call_count) def test_extend_volume_non_base_failure(self): - extend_ex = hpexceptions.HTTPForbidden(error={'code': 150}) + extend_ex = hpeexceptions.HTTPForbidden(error={'code': 150}) conf = { 'getTask.return_value': { 'status': 1}, @@ -2286,13 +2285,13 @@ class HP3PARBaseDriver(object): } mock_client = self.setup_driver(mock_conf=conf) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client grow_size = 3 old_size = self.volume['size'] new_size = old_size + grow_size - self.assertRaises(hpexceptions.HTTPForbidden, + self.assertRaises(hpeexceptions.HTTPForbidden, self.driver.extend_volume, self.volume, str(new_size)) @@ -2330,7 +2329,7 @@ class HP3PARBaseDriver(object): 'type': 2, 'portPos': {'node': 0, 'slot': 6, 'cardPort': 3}}]} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2339,7 +2338,7 @@ class HP3PARBaseDriver(object): def test_get_by_qos_spec_with_scoping(self): mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2362,7 +2361,7 @@ class HP3PARBaseDriver(object): def test_get_by_qos_spec(self): mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2388,7 +2387,7 @@ class HP3PARBaseDriver(object): def test_get_by_qos_by_type_only(self): mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2410,7 +2409,7 @@ class HP3PARBaseDriver(object): lun_id = 11 nsp = '1:2:3' mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client location = ("%(name)s,%(lunid)s,%(host)s,%(nsp)s" % @@ -2447,7 +2446,7 @@ class HP3PARBaseDriver(object): def test__get_existing_volume_ref_name(self): mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2488,7 +2487,7 @@ class HP3PARBaseDriver(object): mock_client.modifyVolume.return_value = ("anyResponse", {'taskid': 1}) mock_client.getTask.return_value = self.STATUS_DONE - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2524,7 +2523,7 @@ class HP3PARBaseDriver(object): } } - expected_snap_cpg = HP3PAR_CPG_SNAP + expected_snap_cpg = HPE3PAR_CPG_SNAP expected_retype_modify = [ mock.call.modifyVolume(osv_matcher, {'comment': self.CommentMatcher( @@ -2545,7 +2544,7 @@ class HP3PARBaseDriver(object): mock.call.modifyVolume( osv_matcher, {'action': 6, - 'userCPG': HP3PAR_CPG, + 'userCPG': HPE3PAR_CPG, 'conversionOperation': 1, 'tuneOperation': 1}), mock.call.getTask(1) ] @@ -2577,7 +2576,7 @@ class HP3PARBaseDriver(object): mock_client.modifyVolume.return_value = ("anyResponse", {'taskid': 1}) mock_client.getTask.return_value = self.STATUS_DONE - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2628,7 +2627,7 @@ class HP3PARBaseDriver(object): 'volume_type_id': 'acfa9fa4-54a0-4340-a3d8-bfcf19aea65e', 'id': id} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2697,7 +2696,7 @@ class HP3PARBaseDriver(object): mock_client.getVolume.return_value = {'comment': comment, 'userCPG': 'testUserCpg0'} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2775,9 +2774,9 @@ class HP3PARBaseDriver(object): 'volume_type': None, 'id': '007dbfce-7579-40bc-8f90-a20b3902283e'} - mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound('fake') + mock_client.getVolume.side_effect = hpeexceptions.HTTPNotFound('fake') - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2808,7 +2807,7 @@ class HP3PARBaseDriver(object): mock_client.getVolume.return_value = {'comment': comment} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2834,8 +2833,8 @@ class HP3PARBaseDriver(object): 'name': 'gold', 'id': 'gold-id', 'extra_specs': { - 'cpg': HP3PAR_CPG, - 'snap_cpg': HP3PAR_CPG_SNAP, + 'cpg': HPE3PAR_CPG, + 'snap_cpg': HPE3PAR_CPG_SNAP, 'vvs_name': self.VVS_NAME, 'qos': self.QOS, 'tpvv': True, @@ -2857,7 +2856,7 @@ class HP3PARBaseDriver(object): {'domain': 'domain3'}, ] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2898,7 +2897,7 @@ class HP3PARBaseDriver(object): mock_client = self.setup_driver() mock_client.getVolume.return_value = {'sizeMiB': 2048} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2919,7 +2918,7 @@ class HP3PARBaseDriver(object): def test_manage_existing_get_size_invalid_reference(self): mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client volume = {} @@ -2947,9 +2946,9 @@ class HP3PARBaseDriver(object): def test_manage_existing_get_size_invalid_input(self): mock_client = self.setup_driver() - mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound('fake') + mock_client.getVolume.side_effect = hpeexceptions.HTTPNotFound('fake') - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2971,7 +2970,7 @@ class HP3PARBaseDriver(object): def test_unmanage(self): mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -2992,11 +2991,10 @@ class HP3PARBaseDriver(object): def test__safe_hostname(self): long_hostname = "abc123abc123abc123abc123abc123abc123" fixed_hostname = "abc123abc123abc123abc123abc123a" - common = hpcommon.HP3PARCommon(None) + common = hpecommon.HPE3PARCommon(None) safe_host = common._safe_hostname(long_hostname) self.assertEqual(fixed_hostname, safe_host) - @mock.patch('hp3parclient.version', "3.2.2") def test_create_consistency_group(self): class fake_consitencygroup_object(object): volume_type_id = '49fa96b5-828e-4653-b622-873a1b7e6f1c' @@ -3014,7 +3012,7 @@ class HP3PARBaseDriver(object): " '" + self.CONSIS_GROUP_ID + "'," " 'description': 'consistency group'}") - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client mock_client.getCPG.return_value = {'domain': None} @@ -3024,7 +3022,7 @@ class HP3PARBaseDriver(object): group) expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolumeSet( self.CONSIS_GROUP_NAME, domain=None, @@ -3036,7 +3034,6 @@ class HP3PARBaseDriver(object): expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.2.2") def test_create_consistency_group_from_src(self): class fake_consitencygroup_object(object): volume_type_id = '49fa96b5-828e-4653-b622-873a1b7e6f1c' @@ -3062,7 +3059,7 @@ class HP3PARBaseDriver(object): " '" + self.CONSIS_GROUP_ID + "'," " 'description': 'consistency group'}") - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client mock_client.getCPG.return_value = {'domain': None} @@ -3073,7 +3070,7 @@ class HP3PARBaseDriver(object): group) expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolumeSet( self.CONSIS_GROUP_NAME, domain=None, @@ -3126,7 +3123,6 @@ class HP3PARBaseDriver(object): expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.2.2") def test_delete_consistency_group(self): class fake_consitencygroup_object(object): volume_type_id = '49fa96b5-828e-4653-b622-873a1b7e6f1c' @@ -3144,7 +3140,7 @@ class HP3PARBaseDriver(object): " '" + self.CONSIS_GROUP_ID + "'," " 'description': 'consistency group'}") - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client mock_client.getCPG.return_value = {'domain': None} @@ -3155,7 +3151,7 @@ class HP3PARBaseDriver(object): group) expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolumeSet( self.CONSIS_GROUP_NAME, domain=None, @@ -3183,7 +3179,6 @@ class HP3PARBaseDriver(object): expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.2.2") def test_update_consistency_group_add_vol(self): class fake_consitencygroup_object(object): volume_type_id = '49fa96b5-828e-4653-b622-873a1b7e6f1c' @@ -3202,7 +3197,7 @@ class HP3PARBaseDriver(object): " '" + self.CONSIS_GROUP_ID + "'," " 'description': 'consistency group'}") - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client mock_client.getCPG.return_value = {'domain': None} @@ -3213,7 +3208,7 @@ class HP3PARBaseDriver(object): group) expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolumeSet( self.CONSIS_GROUP_NAME, domain=None, @@ -3243,7 +3238,6 @@ class HP3PARBaseDriver(object): expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.2.2") def test_update_consistency_group_remove_vol(self): class fake_consitencygroup_object(object): volume_type_id = '49fa96b5-828e-4653-b622-873a1b7e6f1c' @@ -3262,7 +3256,7 @@ class HP3PARBaseDriver(object): " '" + self.CONSIS_GROUP_ID + "'," " 'description': 'consistency group'}") - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client mock_client.getCPG.return_value = {'domain': None} @@ -3273,7 +3267,7 @@ class HP3PARBaseDriver(object): group) expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolumeSet( self.CONSIS_GROUP_NAME, domain=None, @@ -3321,7 +3315,6 @@ class HP3PARBaseDriver(object): expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.2.2") def test_create_cgsnapshot(self): class fake_consitencygroup_object(object): volume_type_id = '49fa96b5-828e-4653-b622-873a1b7e6f1c' @@ -3347,7 +3340,7 @@ class HP3PARBaseDriver(object): ' "cgsnapshot_id": "e91c5ed5-daee-4e84-8724-1c9e31e7a1f2"}', 'readOnly': False}) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client mock_client.getCPG.return_value = {'domain': None} @@ -3358,7 +3351,7 @@ class HP3PARBaseDriver(object): group) expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolumeSet( self.CONSIS_GROUP_NAME, domain=None, @@ -3405,7 +3398,6 @@ class HP3PARBaseDriver(object): expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.2.2") def test_delete_cgsnapshot(self): class fake_consitencygroup_object(object): volume_type_id = '49fa96b5-828e-4653-b622-873a1b7e6f1c' @@ -3432,7 +3424,7 @@ class HP3PARBaseDriver(object): ' "cgsnapshot_id": "e91c5ed5-daee-4e84-8724-1c9e31e7a1f2"}', 'readOnly': False}) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client mock_client.getCPG.return_value = {'domain': None} @@ -3443,7 +3435,7 @@ class HP3PARBaseDriver(object): group) expected = [ - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.createVolumeSet( self.CONSIS_GROUP_NAME, domain=None, @@ -3496,7 +3488,7 @@ class HP3PARBaseDriver(object): self.standard_logout) -class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): +class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase): properties = { 'driver_volume_type': 'fibre_channel', @@ -3517,7 +3509,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): mock_client = self.setup_mock_client( conf=config, m_conf=mock_conf, - driver=hpfcdriver.HP3PARFCDriver) + driver=hpefcdriver.HPE3PARFCDriver) if wsapi_version: mock_client.getWsApiVersion.return_value = ( @@ -3527,8 +3519,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): self.wsapi_version_latest) expected = [ - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2)] + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2)] mock_client.assert_has_calls( self.standard_login + expected + @@ -3540,10 +3532,10 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST, 'FCPaths': [{'driverVersion': None, 'firmwareVersion': None, @@ -3568,7 +3560,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): } mock_client.getHostVLUNs.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), [{'active': True, 'volumeName': self.VOLUME_3PAR_NAME, 'lun': 90, 'type': 0}]] @@ -3580,7 +3572,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): 'nsp': 'something'}) mock_client.createVLUN.return_value = location - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client result = self.driver.initialize_connection( @@ -3589,7 +3581,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume(self.VOLUME_3PAR_NAME), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(wwns=['123456789012345', '123456789054321']), @@ -3624,10 +3616,10 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): return fake_map mock_lookup.return_value = fake_lookup_object() mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST, 'FCPaths': [{'driverVersion': None, 'firmwareVersion': None, @@ -3644,7 +3636,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): } mock_client.getHostVLUNs.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), [{'active': True, 'volumeName': self.VOLUME_3PAR_NAME, 'lun': 90, 'type': 0, @@ -3674,14 +3666,14 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): ['0987654321234'] }}} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client result = self.driver.initialize_connection(self.volume, connector) expected = [ mock.call.getVolume(self.VOLUME_3PAR_NAME), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.ANY, mock.call.getHost(self.FAKE_HOST), @@ -3706,10 +3698,10 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST, 'FCPaths': [{'driverVersion': None, 'firmwareVersion': None, @@ -3734,7 +3726,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): } mock_client.getHostVLUNs.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), [{'active': True, 'volumeName': self.VOLUME_3PAR_NAME, 'lun': 90, 'type': 0}]] @@ -3746,7 +3738,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): 'nsp': 'something'}) mock_client.createVLUN.return_value = location - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client result = self.driver.initialize_connection( @@ -3755,7 +3747,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume(self.VOLUME_3PAR_NAME), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(wwns=['123456789012345', '123456789054321']), @@ -3785,8 +3777,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): effects = [ [{'active': True, 'volumeName': self.VOLUME_3PAR_NAME, 'lun': None, 'type': 0}], - hpexceptions.HTTPNotFound, - hpexceptions.HTTPNotFound] + hpeexceptions.HTTPNotFound, + hpeexceptions.HTTPNotFound] mock_client.getHostVLUNs.side_effect = effects @@ -3808,7 +3800,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): mock.call.getHostVLUNs(self.FAKE_HOST), mock.call.getPorts()] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client conn_info = self.driver.terminate_connection(self.volume, @@ -3824,9 +3816,9 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): mock_client.getHostVLUNs.side_effect = effects # mock some deleteHost exceptions that are handled - delete_with_vlun = hpexceptions.HTTPConflict( + delete_with_vlun = hpeexceptions.HTTPConflict( error={'message': "has exported VLUN"}) - delete_with_hostset = hpexceptions.HTTPConflict( + delete_with_hostset = hpeexceptions.HTTPConflict( error={'message': "host is a member of a set"}) mock_client.deleteHost = mock.Mock( side_effect=[delete_with_vlun, delete_with_hostset]) @@ -3866,8 +3858,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): effects = [ [{'active': True, 'volumeName': self.VOLUME_3PAR_NAME, 'lun': None, 'type': 0}], - hpexceptions.HTTPNotFound, - hpexceptions.HTTPNotFound] + hpeexceptions.HTTPNotFound, + hpeexceptions.HTTPNotFound] mock_client.queryHost.return_value = { 'members': [{ @@ -3889,7 +3881,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): mock.call.getHostVLUNs(self.FAKE_HOST), mock.call.getPorts()] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client conn_info = self.driver.terminate_connection(self.volume, @@ -3905,9 +3897,9 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): mock_client.getHostVLUNs.side_effect = effects # mock some deleteHost exceptions that are handled - delete_with_vlun = hpexceptions.HTTPConflict( + delete_with_vlun = hpeexceptions.HTTPConflict( error={'message': "has exported VLUN"}) - delete_with_hostset = hpexceptions.HTTPConflict( + delete_with_hostset = hpeexceptions.HTTPConflict( error={'message': "host is a member of a set"}) mock_client.deleteHost = mock.Mock( side_effect=[delete_with_vlun, delete_with_hostset]) @@ -3957,7 +3949,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): mock.call.getHostVLUNs(self.FAKE_HOST), mock.call.getHostVLUNs(self.FAKE_HOST)] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client conn_info = self.driver.terminate_connection(self.volume, @@ -3968,7 +3960,6 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): self.standard_logout) self.assertNotIn('initiator_target_map', conn_info['data']) - @mock.patch('hp3parclient.version', "3.2.2") def test_get_volume_stats1(self): # setup_mock_client drive with the configuration # and return the mock HTTP 3PAR client @@ -3998,7 +3989,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): mock_client.getCPGStatData.return_value = stat_capabilities - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -4033,12 +4024,12 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getStorageSystemInfo(), - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPGStatData(HP3PAR_CPG, 'daily', '7d'), - mock.call.getCPGAvailableSpace(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2), - mock.call.getCPGStatData(HP3PAR_CPG2, 'daily', '7d'), - mock.call.getCPGAvailableSpace(HP3PAR_CPG2)] + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPGStatData(HPE3PAR_CPG, 'daily', '7d'), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2), + mock.call.getCPGStatData(HPE3PAR_CPG2, 'daily', '7d'), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG2)] mock_client.assert_has_calls( self.standard_login + @@ -4114,10 +4105,9 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): stats['pools'][0][QUEUE_LENGTH]) self.assertEqual(stat_capabilities[AVG_BUSY_PERC], stats['pools'][0][AVG_BUSY_PERC]) - common.client.deleteCPG(HP3PAR_CPG) - common.client.createCPG(HP3PAR_CPG, {}) + common.client.deleteCPG(HPE3PAR_CPG) + common.client.createCPG(HPE3PAR_CPG, {}) - @mock.patch('hp3parclient.version', "3.2.2") def test_get_volume_stats2(self): # Testing when the API_VERSION is incompatible with getCPGStatData srstatld_api_version = 30201200 @@ -4139,7 +4129,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): "usableFreeMiB": 1024.0 * 3 } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver._login() @@ -4163,17 +4153,16 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getStorageSystemInfo(), - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPGAvailableSpace(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2), - mock.call.getCPGAvailableSpace(HP3PAR_CPG2)] + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG2)] mock_client.assert_has_calls( self.standard_login + expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.2.1") def test_get_volume_stats3(self): # Testing when the client version is incompatible with getCPGStatData # setup_mock_client drive with the configuration @@ -4181,7 +4170,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): config = self.setup_configuration() config.filter_function = FILTER_FUNCTION config.goodness_function = GOODNESS_FUNCTION - mock_client = self.setup_driver(config=config) + mock_client = self.setup_driver(config=config, + wsapi_version=self.wsapi_version_312) mock_client.getCPG.return_value = self.cpgs[0] mock_client.getStorageSystemInfo.return_value = { 'serialNumber': '1234' @@ -4194,7 +4184,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): "usableFreeMiB": 1024.0 * 3 } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver._login() @@ -4218,10 +4208,10 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getStorageSystemInfo(), - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPGAvailableSpace(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2), - mock.call.getCPGAvailableSpace(HP3PAR_CPG2)] + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG2)] mock_client.assert_has_calls( self.standard_login + @@ -4232,10 +4222,10 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST, 'FCPaths': [{'driverVersion': None, 'firmwareVersion': None, @@ -4255,7 +4245,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): 'wwn': self.wwn[1]}]}] mock_client.queryHost.return_value = None mock_client.getVLUN.return_value = {'lun': 186} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -4265,7 +4255,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): self.connector) expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(wwns=['123456789012345', '123456789054321']), @@ -4284,10 +4274,10 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('Host not found.'), { + hpeexceptions.HTTPNotFound('Host not found.'), { 'name': 'fakehost.foo', 'FCPaths': [{'wwn': '123456789012345'}, { 'wwn': '123456789054321'}]}] @@ -4297,7 +4287,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): }] } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -4308,7 +4298,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost('fakehost'), mock.call.queryHost(wwns=['123456789012345', '123456789054321']), @@ -4322,7 +4312,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [{ 'name': self.FAKE_HOST, 'FCPaths': []}, @@ -4330,7 +4320,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): 'FCPaths': [{'wwn': '123456789012345'}, { 'wwn': '123456789054321'}]}] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -4340,7 +4330,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): self.connector) expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost('fakehost'), mock.call.modifyHost( 'fakehost', { @@ -4357,7 +4347,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} getHost_ret1 = { 'name': self.FAKE_HOST, @@ -4368,7 +4358,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): {'wwn': '123456789054321'}]} mock_client.getHost.side_effect = [getHost_ret1, getHost_ret2] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -4379,7 +4369,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost('fakehost'), mock.call.modifyHost( 'fakehost', { @@ -4395,7 +4385,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} getHost_ret1 = { 'name': self.FAKE_HOST, @@ -4408,7 +4398,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): {'wwn': 'xxxxxxxxxxxxxxx'}]} mock_client.getHost.side_effect = [getHost_ret1, getHost_ret2] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -4419,7 +4409,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost('fakehost'), mock.call.modifyHost( 'fakehost', { @@ -4432,7 +4422,7 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): self.assertEqual(3, len(host['FCPaths'])) -class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): +class TestHPE3PARISCSIDriver(HPE3PARBaseDriver, test.TestCase): TARGET_IQN = 'iqn.2000-05.com.3pardata:21810002ac00383d' TARGET_LUN = 186 @@ -4462,7 +4452,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): mock_client = self.setup_mock_client( conf=config, m_conf=mock_conf, - driver=hpdriver.HP3PARISCSIDriver) + driver=hpedriver.HPE3PARISCSIDriver) if wsapi_version: mock_client.getWsApiVersion.return_value = ( @@ -4472,8 +4462,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): self.wsapi_version_latest) expected_get_cpgs = [ - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2)] + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2)] expected_get_ports = [mock.call.getPorts()] mock_client.assert_has_calls( self.standard_login + @@ -4490,10 +4480,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST}] mock_client.queryHost.return_value = { 'members': [{ @@ -4517,7 +4507,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'nsp': 'something'}) mock_client.createVLUN.return_value = location - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client result = self.driver.initialize_connection( @@ -4526,7 +4516,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume(self.VOLUME_3PAR_NAME), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(iqns=['iqn.1993-08.org.debian:01:222']), mock.call.getHost(self.FAKE_HOST), @@ -4543,10 +4533,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST}] mock_client.queryHost.return_value = { 'members': [{ @@ -4555,7 +4545,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): } mock_client.getHostVLUNs.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), [{'active': True, 'volumeName': self.VOLUME_3PAR_NAME, 'lun': self.TARGET_LUN, 'type': 0, @@ -4573,7 +4563,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'iSCSIName': self.TARGET_IQN, }] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client result = self.driver.initialize_connection( @@ -4582,7 +4572,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume(self.VOLUME_3PAR_NAME), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(iqns=['iqn.1993-08.org.debian:01:222']), mock.call.getHost(self.FAKE_HOST), @@ -4607,10 +4597,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST}] mock_client.queryHost.return_value = { 'members': [{ @@ -4632,7 +4622,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'iSCSIName': self.TARGET_IQN, }] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client result = self.driver.initialize_connection( @@ -4641,7 +4631,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume(self.VOLUME_3PAR_NAME), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(iqns=['iqn.1993-08.org.debian:01:222']), mock.call.getHost(self.FAKE_HOST), @@ -4660,10 +4650,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST}] mock_client.queryHost.return_value = { 'members': [{ @@ -4687,7 +4677,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'nsp': 'something'}) mock_client.createVLUN.return_value = location - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client result = self.driver.initialize_connection( @@ -4696,7 +4686,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume(self.VOLUME_3PAR_NAME), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(iqns=['iqn.1993-08.org.debian:01:222']), mock.call.getHost(self.FAKE_HOST), @@ -4711,7 +4701,6 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected_properties['data']['encrypted'] = True self.assertDictMatch(result, self.properties) - @mock.patch('hp3parclient.version', "3.2.2") def test_get_volume_stats(self): # setup_mock_client drive with the configuration # and return the mock HTTP 3PAR client @@ -4739,7 +4728,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): } mock_client.getCPGStatData.return_value = stat_capabilities - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client @@ -4773,12 +4762,12 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getStorageSystemInfo(), - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPGStatData(HP3PAR_CPG, 'daily', '7d'), - mock.call.getCPGAvailableSpace(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2), - mock.call.getCPGStatData(HP3PAR_CPG2, 'daily', '7d'), - mock.call.getCPGAvailableSpace(HP3PAR_CPG2)] + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPGStatData(HPE3PAR_CPG, 'daily', '7d'), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2), + mock.call.getCPGStatData(HPE3PAR_CPG2, 'daily', '7d'), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG2)] mock_client.assert_has_calls( self.standard_login + @@ -4829,7 +4818,6 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): self.assertEqual(stat_capabilities[AVG_BUSY_PERC], stats['pools'][0][AVG_BUSY_PERC]) - @mock.patch('hp3parclient.version', "3.2.2") def test_get_volume_stats2(self): # Testing when the API_VERSION is incompatible with getCPGStatData srstatld_api_version = 30201200 @@ -4851,7 +4839,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): "usableFreeMiB": 1024.0 * 3 } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver._login() @@ -4875,17 +4863,16 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getStorageSystemInfo(), - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPGAvailableSpace(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2), - mock.call.getCPGAvailableSpace(HP3PAR_CPG2)] + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG2)] mock_client.assert_has_calls( self.standard_login + expected + self.standard_logout) - @mock.patch('hp3parclient.version', "3.2.1") def test_get_volume_stats3(self): # Testing when the client version is incompatible with getCPGStatData # setup_mock_client drive with the configuration @@ -4893,7 +4880,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): config = self.setup_configuration() config.filter_function = FILTER_FUNCTION config.goodness_function = GOODNESS_FUNCTION - mock_client = self.setup_driver(config=config) + mock_client = self.setup_driver(config=config, + wsapi_version=self.wsapi_version_312) mock_client.getCPG.return_value = self.cpgs[0] mock_client.getStorageSystemInfo.return_value = { 'serialNumber': '1234' @@ -4906,7 +4894,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): "usableFreeMiB": 1024.0 * 3 } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client self.driver._login() @@ -4930,10 +4918,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getStorageSystemInfo(), - mock.call.getCPG(HP3PAR_CPG), - mock.call.getCPGAvailableSpace(HP3PAR_CPG), - mock.call.getCPG(HP3PAR_CPG2), - mock.call.getCPGAvailableSpace(HP3PAR_CPG2)] + mock.call.getCPG(HPE3PAR_CPG), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG2), + mock.call.getCPGAvailableSpace(HPE3PAR_CPG2)] mock_client.assert_has_calls( self.standard_login + @@ -4945,15 +4933,15 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST}] mock_client.queryHost.return_value = None mock_client.getVLUN.return_value = {'lun': self.TARGET_LUN} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -4961,7 +4949,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): common, self.volume, self.connector) expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(iqns=['iqn.1993-08.org.debian:01:222']), mock.call.createHost( @@ -4980,13 +4968,13 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client config = self.setup_configuration() - config.hp3par_iscsi_chap_enabled = True + config.hpe3par_iscsi_chap_enabled = True mock_client = self.setup_driver(config=config) - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('fake'), + hpeexceptions.HTTPNotFound('fake'), {'name': self.FAKE_HOST}] mock_client.queryHost.return_value = None mock_client.getVLUN.return_value = {'lun': self.TARGET_LUN} @@ -5008,7 +4996,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): mock_client.getVolumeMetaData.side_effect = get_side_effect - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5016,7 +5004,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): common, self.volume, self.connector) expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getVolumeMetaData( 'osv-0DM4qZEVSKON-DXN-NwVpw', CHAP_USER_KEY), mock.call.getVolumeMetaData( @@ -5043,10 +5031,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('Host not found.'), + hpeexceptions.HTTPNotFound('Host not found.'), {'name': 'fakehost.foo'}] mock_client.queryHost.return_value = { 'members': [{ @@ -5054,7 +5042,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): }] } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5063,7 +5051,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.queryHost(iqns=['iqn.1993-08.org.debian:01:222']), mock.call.getHost('fakehost.foo')] @@ -5078,13 +5066,13 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client config = self.setup_configuration() - config.hp3par_iscsi_chap_enabled = True + config.hpe3par_iscsi_chap_enabled = True mock_client = self.setup_driver(config=config) - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ - hpexceptions.HTTPNotFound('Host not found.'), + hpeexceptions.HTTPNotFound('Host not found.'), {'name': 'fakehost.foo'}] mock_client.queryHost.return_value = { 'members': [{ @@ -5109,7 +5097,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'chapSecret': 'test-pass' } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5118,7 +5106,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getVolumeMetaData( 'osv-0DM4qZEVSKON-DXN-NwVpw', CHAP_USER_KEY), mock.call.getVolumeMetaData( @@ -5141,7 +5129,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with default configuration # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ {'name': self.FAKE_HOST, 'FCPaths': []}, @@ -5149,7 +5137,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'FCPaths': [{'wwn': '123456789012345'}, {'wwn': '123456789054321'}]}] - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5158,7 +5146,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getHost(self.FAKE_HOST), mock.call.modifyHost( self.FAKE_HOST, @@ -5177,10 +5165,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client config = self.setup_configuration() - config.hp3par_iscsi_chap_enabled = True + config.hpe3par_iscsi_chap_enabled = True mock_client = self.setup_driver(config=config) - mock_client.getVolume.return_value = {'userCPG': HP3PAR_CPG} + mock_client.getVolume.return_value = {'userCPG': HPE3PAR_CPG} mock_client.getCPG.return_value = {} mock_client.getHost.side_effect = [ {'name': self.FAKE_HOST, 'FCPaths': []}, @@ -5205,7 +5193,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'chapSecret': 'test-pass' } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5214,7 +5202,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [ mock.call.getVolume('osv-0DM4qZEVSKON-DXN-NwVpw'), - mock.call.getCPG(HP3PAR_CPG), + mock.call.getCPG(HPE3PAR_CPG), mock.call.getVolumeMetaData( 'osv-0DM4qZEVSKON-DXN-NwVpw', CHAP_USER_KEY), mock.call.getVolumeMetaData( @@ -5245,14 +5233,14 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): mock_client.getPorts.return_value = PORTS_RET mock_client.getVLUNs.return_value = VLUNS1_RET - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() # Setup a single ISCSI IP iscsi_ips = ["10.10.220.253"] - self.driver.configuration.hp3par_iscsi_ips = iscsi_ips + self.driver.configuration.hpe3par_iscsi_ips = iscsi_ips self.driver.initialize_iscsi_ports(common) @@ -5267,14 +5255,14 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): mock_client.getPorts.return_value = PORTS_RET mock_client.getVLUNs.return_value = VLUNS1_RET - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() # Setup two ISCSI IPs iscsi_ips = ["10.10.220.252", "10.10.220.253"] - self.driver.configuration.hp3par_iscsi_ips = iscsi_ips + self.driver.configuration.hpe3par_iscsi_ips = iscsi_ips self.driver.initialize_iscsi_ports(common) @@ -5291,14 +5279,14 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): mock_client.getPorts.return_value = PORTS_RET mock_client.getVLUNs.return_value = VLUNS1_RET - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() # Setup two ISCSI IPs iscsi_ips = ["10.10.220.252", "10.10.220.253"] - self.driver.configuration.hp3par_iscsi_ips = iscsi_ips + self.driver.configuration.hpe3par_iscsi_ips = iscsi_ips self.driver.initialize_iscsi_ports(common) @@ -5320,9 +5308,9 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # Setup two ISCSI IPs iscsi_ips = ["10.10.220.252", "10.10.220.253"] - self.driver.configuration.hp3par_iscsi_ips = iscsi_ips + self.driver.configuration.hpe3par_iscsi_ips = iscsi_ips - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5334,7 +5322,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): def test_invalid_iscsi_ip(self): config = self.setup_configuration() - config.hp3par_iscsi_ips = ['10.10.220.250', '10.10.220.251'] + config.hpe3par_iscsi_ips = ['10.10.220.250', '10.10.220.251'] config.iscsi_ip_address = '10.10.10.10' mock_conf = { 'getPorts.return_value': { @@ -5379,7 +5367,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): {'portPos': {'node': 0, 'slot': 2, 'cardPort': 1}, 'active': True}] mock_client.getVLUNs.return_value = {'members': ports} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5452,7 +5440,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # and return the mock HTTP 3PAR client mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5464,10 +5452,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client config = self.setup_configuration() - config.hp3par_iscsi_chap_enabled = True + config.hpe3par_iscsi_chap_enabled = True mock_client = self.setup_driver(config=config) - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5511,7 +5499,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): expected = [] expected_model = {'provider_auth': None} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5525,7 +5513,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client config = self.setup_configuration() - config.hp3par_iscsi_chap_enabled = True + config.hpe3par_iscsi_chap_enabled = True mock_client = self.setup_driver(config=config) volume = {'host': 'test-host@3pariscsi', @@ -5557,7 +5545,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): ] expected_model = {'provider_auth': 'CHAP test-host random-pass'} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5570,13 +5558,13 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client config = self.setup_configuration() - config.hp3par_iscsi_chap_enabled = True + config.hpe3par_iscsi_chap_enabled = True mock_client = self.setup_driver(config=config) volume = {'host': 'test-host@3pariscsi', 'id': 'd03338a9-9115-48a3-8dfc-35cdfcdc15a7'} mock_utils.return_value = "random-pass" - mock_client.getHostVLUNs.side_effect = hpexceptions.HTTPNotFound( + mock_client.getHostVLUNs.side_effect = hpeexceptions.HTTPNotFound( 'fake') mock_client.getVolumeMetaData.return_value = { @@ -5592,7 +5580,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): ] expected_model = {'provider_auth': 'CHAP test-host random-pass'} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5605,7 +5593,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client config = self.setup_configuration() - config.hp3par_iscsi_chap_enabled = True + config.hpe3par_iscsi_chap_enabled = True mock_client = self.setup_driver(config=config) volume = {'host': 'test-host@3pariscsi', @@ -5637,7 +5625,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): ] expected_model = {'provider_auth': 'CHAP test-host random-pass'} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5650,7 +5638,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): # setup_mock_client drive with CHAP enabled configuration # and return the mock HTTP 3PAR client config = self.setup_configuration() - config.hp3par_iscsi_chap_enabled = True + config.hpe3par_iscsi_chap_enabled = True mock_client = self.setup_driver(config=config) volume = {'host': 'test-host@3pariscsi', @@ -5680,7 +5668,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): ] expected_model = {'provider_auth': 'CHAP test-host random-pass'} - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5701,7 +5689,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'members': [] } - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client model = self.driver.ensure_export(None, volume) @@ -5760,10 +5748,10 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): volume = {'host': 'test-host@3pariscsi', 'id': 'd03338a9-9115-48a3-8dfc-35cdfcdc15a7'} - mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound( + mock_client.getVolume.side_effect = hpeexceptions.HTTPNotFound( 'fake') - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client model = self.driver.ensure_export(None, volume) @@ -5785,7 +5773,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): 'id': 'gold-id', 'extra_specs': {}} mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() @@ -5798,7 +5786,7 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase): def test_get_model_update(self): mock_client = self.setup_driver() - with mock.patch.object(hpcommon.HP3PARCommon, + with mock.patch.object(hpecommon.HPE3PARCommon, '_create_client') as mock_create_client: mock_create_client.return_value = mock_client common = self.driver._login() diff --git a/cinder/volume/drivers/hpe/__init__.py b/cinder/volume/drivers/hpe/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py similarity index 92% rename from cinder/volume/drivers/san/hp/hp_3par_common.py rename to cinder/volume/drivers/hpe/hpe_3par_common.py index 5e791f97c..56d685d08 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -1,4 +1,4 @@ -# (c) Copyright 2012-2015 Hewlett-Packard Development Company, L.P. +# (c) Copyright 2012-2015 Hewlett Packard Enterprise Development LP # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -14,12 +14,12 @@ # under the License. # """ -Volume driver common utilities for HP 3PAR Storage array +Volume driver common utilities for HPE 3PAR Storage array The 3PAR drivers requires 3.1.3 firmware on the 3PAR array. -You will need to install the python hp3parclient. -sudo pip install hp3parclient +You will need to install the python hpe3parclient module. +sudo pip install python-3parclient The drivers uses both the REST service and the SSH command line to correctly operate. Since the @@ -29,7 +29,7 @@ we need to have settings for both. The drivers requires the use of the san_ip, san_login, san_password settings for ssh connections into the 3PAR array. It also requires the setting of -hp3par_api_url, hp3par_username, hp3par_password +hpe3par_api_url, hpe3par_username, hpe3par_password for credentials to talk to the REST service on the 3PAR array. """ @@ -45,10 +45,10 @@ import uuid from oslo_utils import importutils -hp3parclient = importutils.try_import("hp3parclient") -if hp3parclient: - from hp3parclient import client - from hp3parclient import exceptions as hpexceptions +hpe3parclient = importutils.try_import("hpe3parclient") +if hpe3parclient: + from hpe3parclient import client + from hpe3parclient import exceptions as hpeexceptions from oslo_config import cfg from oslo_log import log as logging @@ -71,54 +71,62 @@ from taskflow.patterns import linear_flow LOG = logging.getLogger(__name__) -MIN_CLIENT_VERSION = '3.1.2' -GETCPGSTATDATA_VERSION = '3.2.2' -MIN_CG_CLIENT_VERSION = '3.2.2' +MIN_CLIENT_VERSION = '4.0.0' DEDUP_API_VERSION = 30201120 FLASH_CACHE_API_VERSION = 30201200 SRSTATLD_API_VERSION = 30201200 -hp3par_opts = [ - cfg.StrOpt('hp3par_api_url', +hpe3par_opts = [ + cfg.StrOpt('hpe3par_api_url', default='', help="3PAR WSAPI Server Url like " - "https://<3par ip>:8080/api/v1"), - cfg.StrOpt('hp3par_username', + "https://<3par ip>:8080/api/v1", + deprecated_name='hp3par_api_url'), + cfg.StrOpt('hpe3par_username', default='', - help="3PAR username with the 'edit' role"), - cfg.StrOpt('hp3par_password', + help="3PAR username with the 'edit' role", + deprecated_name='hp3par_username'), + cfg.StrOpt('hpe3par_password', default='', - help="3PAR password for the user specified in hp3par_username", - secret=True), - cfg.ListOpt('hp3par_cpg', + help="3PAR password for the user specified in hpe3par_username", + secret=True, + deprecated_name='hp3par_password'), + cfg.ListOpt('hpe3par_cpg', default=["OpenStack"], - help="List of the CPG(s) to use for volume creation"), - cfg.StrOpt('hp3par_cpg_snap', + help="List of the CPG(s) to use for volume creation", + deprecated_name='hp3par_cpg'), + cfg.StrOpt('hpe3par_cpg_snap', default="", help="The CPG to use for Snapshots for volumes. " - "If empty the userCPG will be used."), - cfg.StrOpt('hp3par_snapshot_retention', + "If empty the userCPG will be used.", + deprecated_name='hp3par_cpg_snap'), + cfg.StrOpt('hpe3par_snapshot_retention', default="", help="The time in hours to retain a snapshot. " - "You can't delete it before this expires."), - cfg.StrOpt('hp3par_snapshot_expiration', + "You can't delete it before this expires.", + deprecated_name='hp3par_snapshot_retention'), + cfg.StrOpt('hpe3par_snapshot_expiration', default="", help="The time in hours when a snapshot expires " - " and is deleted. This must be larger than expiration"), - cfg.BoolOpt('hp3par_debug', + " and is deleted. This must be larger than expiration", + deprecated_name='hp3par_snapshot_expiration'), + cfg.BoolOpt('hpe3par_debug', default=False, - help="Enable HTTP debugging to 3PAR"), - cfg.ListOpt('hp3par_iscsi_ips', + help="Enable HTTP debugging to 3PAR", + deprecated_name='hp3par_debug'), + cfg.ListOpt('hpe3par_iscsi_ips', default=[], - help="List of target iSCSI addresses to use."), - cfg.BoolOpt('hp3par_iscsi_chap_enabled', + help="List of target iSCSI addresses to use.", + deprecated_name='hp3par_iscsi_ips'), + cfg.BoolOpt('hpe3par_iscsi_chap_enabled', default=False, - help="Enable CHAP authentication for iSCSI connections."), + help="Enable CHAP authentication for iSCSI connections.", + deprecated_name='hp3par_iscsi_chap_enabled'), ] CONF = cfg.CONF -CONF.register_opts(hp3par_opts) +CONF.register_opts(hpe3par_opts) # Input/output (total read/write) operations per second. THROUGHPUT = 'throughput' @@ -134,7 +142,7 @@ QUEUE_LENGTH = 'queue_length' AVG_BUSY_PERC = 'avg_busy_perc' -class HP3PARCommon(object): +class HPE3PARCommon(object): """Class that contains common code for the 3PAR drivers. Version history: @@ -203,10 +211,11 @@ class HP3PARCommon(object): 2.0.51 - Adds consistency group support 2.0.52 - Added update_migrated_volume. bug #1492023 2.0.53 - Fix volume size conversion. bug #1513158 + 3.0.0 - Rebranded HP to HPE. """ - VERSION = "2.0.53" + VERSION = "3.0.0" stats = {} @@ -237,11 +246,11 @@ class HP3PARCommon(object): '9 - OpenVMS', '10 - HPUX', '11 - WindowsServer'] - hp_qos_keys = ['minIOPS', 'maxIOPS', 'minBWS', 'maxBWS', 'latency', - 'priority'] + hpe_qos_keys = ['minIOPS', 'maxIOPS', 'minBWS', 'maxBWS', 'latency', + 'priority'] qos_priority_level = {'low': 1, 'normal': 2, 'high': 3} - hp3par_valid_keys = ['cpg', 'snap_cpg', 'provisioning', 'persona', 'vvs', - 'flash_cache'] + hpe3par_valid_keys = ['cpg', 'snap_cpg', 'provisioning', 'persona', 'vvs', + 'flash_cache'] def __init__(self, config): self.config = config @@ -260,35 +269,29 @@ class HP3PARCommon(object): raise exception.InvalidInput(reason=msg) def _create_client(self): - cl = client.HP3ParClient(self.config.hp3par_api_url) - client_version = hp3parclient.version + cl = client.HPE3ParClient(self.config.hpe3par_api_url) + client_version = hpe3parclient.version if client_version < MIN_CLIENT_VERSION: - ex_msg = (_('Invalid hp3parclient version found (%(found)s). ' - 'Version %(minimum)s or greater required.') + ex_msg = (_('Invalid hpe3parclient version found (%(found)s). ' + 'Version %(minimum)s or greater required. Run "pip' + ' install --upgrade python-3parclient" to upgrade' + ' the hpe3parclient.') % {'found': client_version, 'minimum': MIN_CLIENT_VERSION}) LOG.error(ex_msg) raise exception.InvalidInput(reason=ex_msg) - if client_version < GETCPGSTATDATA_VERSION: - # getCPGStatData is only found in client version 3.2.2 or later - LOG.warning(_LW("getCPGStatData requires " - "hp3parclient version " - "'%(getcpgstatdata_version)s' " - "version '%(version)s' is installed.") % - {'getcpgstatdata_version': GETCPGSTATDATA_VERSION, - 'version': client_version}) return cl def client_login(self): try: LOG.debug("Connecting to 3PAR") - self.client.login(self.config.hp3par_username, - self.config.hp3par_password) - except hpexceptions.HTTPUnauthorized as ex: + self.client.login(self.config.hpe3par_username, + self.config.hpe3par_password) + except hpeexceptions.HTTPUnauthorized as ex: msg = (_("Failed to Login to 3PAR (%(url)s) because %(err)s") % - {'url': self.config.hp3par_api_url, 'err': ex}) + {'url': self.config.hpe3par_api_url, 'err': ex}) LOG.error(msg) raise exception.InvalidInput(reason=msg) @@ -311,23 +314,25 @@ class HP3PARCommon(object): self.client.logout() def do_setup(self, context): - if hp3parclient is None: - msg = _('You must install hp3parclient before using 3PAR drivers.') + if hpe3parclient is None: + msg = _('You must install hpe3parclient before using 3PAR' + ' drivers. Run "pip install python-3parclient" to' + ' install the hpe3parclient.') raise exception.VolumeBackendAPIException(data=msg) try: self.client = self._create_client() wsapi_version = self.client.getWsApiVersion() self.API_VERSION = wsapi_version['build'] - except hpexceptions.UnsupportedVersion as ex: + except hpeexceptions.UnsupportedVersion as ex: raise exception.InvalidInput(ex) if context: # The context is None except at driver startup. - LOG.info(_LI("HP3PARCommon %(common_ver)s," - "hp3parclient %(rest_ver)s"), + LOG.info(_LI("HPE3PARCommon %(common_ver)s," + "hpe3parclient %(rest_ver)s"), {"common_ver": self.VERSION, - "rest_ver": hp3parclient.get_version_string()}) - if self.config.hp3par_debug: + "rest_ver": hpe3parclient.get_version_string()}) + if self.config.hpe3par_debug: self.client.debug_rest(True) if self.API_VERSION < SRSTATLD_API_VERSION: # Firmware version not compatible with srstatld @@ -351,7 +356,7 @@ class HP3PARCommon(object): def check_for_setup_error(self): self.client_login() try: - cpg_names = self.config.hp3par_cpg + cpg_names = self.config.hpe3par_cpg for cpg_name in cpg_names: self.validate_cpg(cpg_name) @@ -361,7 +366,7 @@ class HP3PARCommon(object): def validate_cpg(self, cpg_name): try: self.client.getCPG(cpg_name) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: err = (_("CPG (%s) doesn't exist on array") % cpg_name) LOG.error(err) raise exception.InvalidInput(reason=err) @@ -369,7 +374,7 @@ class HP3PARCommon(object): def get_domain(self, cpg_name): try: cpg = self.client.getCPG(cpg_name) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: err = (_("Failed to get domain because CPG (%s) doesn't " "exist on array.") % cpg_name) LOG.error(err) @@ -438,11 +443,11 @@ class HP3PARCommon(object): try: cg_name = self._get_3par_vvs_name(group.id) self.client.deleteVolumeSet(cg_name) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: err = (_LW("Virtual Volume Set '%s' doesn't exist on array.") % cg_name) LOG.warning(err) - except hpexceptions.HTTPConflict as e: + except hpeexceptions.HTTPConflict as e: err = (_LE("Conflict detected in Virtual Volume Set" " %(volume_set)s: %(error)s")) LOG.error(err, @@ -467,7 +472,7 @@ class HP3PARCommon(object): volume_name = self._get_3par_vol_name(volume['id']) try: self.client.addVolumeToVolumeSet(volume_set_name, volume_name) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: msg = (_LE('Virtual Volume Set %s does not exist.') % volume_set_name) LOG.error(msg) @@ -478,7 +483,7 @@ class HP3PARCommon(object): try: self.client.removeVolumeFromVolumeSet( volume_set_name, volume_name) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: msg = (_LE('Virtual Volume Set %s does not exist.') % volume_set_name) LOG.error(msg) @@ -500,13 +505,13 @@ class HP3PARCommon(object): optional = {'comment': json.dumps(extra), 'readOnly': False} - if self.config.hp3par_snapshot_expiration: + if self.config.hpe3par_snapshot_expiration: optional['expirationHours'] = ( - int(self.config.hp3par_snapshot_expiration)) + int(self.config.hpe3par_snapshot_expiration)) - if self.config.hp3par_snapshot_retention: + if self.config.hpe3par_snapshot_retention: optional['retentionHours'] = ( - int(self.config.hp3par_snapshot_retention)) + int(self.config.hpe3par_snapshot_retention)) self.client.createSnapshotOfVolumeSet(snap_shot_name, copy_of_name, optional=optional) @@ -533,16 +538,16 @@ class HP3PARCommon(object): try: snap_name = cgsnap_name + "-" + six.text_type(i) self.client.deleteVolume(snap_name) - except hpexceptions.HTTPForbidden as ex: + except hpeexceptions.HTTPForbidden as ex: LOG.error(_LE("Exception: %s."), ex) raise exception.NotAuthorized() - except hpexceptions.HTTPNotFound as ex: + except hpeexceptions.HTTPNotFound as ex: # We'll let this act as if it worked # it helps clean up the cinder entries. LOG.warning(_LW("Delete Snapshot id not found. Removing from " "cinder: %(id)s Ex: %(msg)s"), {'id': snapshot['id'], 'msg': ex}) - except hpexceptions.HTTPConflict as ex: + except hpeexceptions.HTTPConflict as ex: LOG.error(_LE("Exception: %s."), ex) raise exception.SnapshotIsBusy(snapshot_name=snapshot['id']) snapshot['status'] = 'deleted' @@ -565,7 +570,7 @@ class HP3PARCommon(object): vol = self.client.getVolume(target_vol_name) if 'comment' in vol: old_comment_str = vol['comment'] - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: err = (_("Virtual volume '%s' doesn't exist on array.") % target_vol_name) LOG.error(err) @@ -675,7 +680,7 @@ class HP3PARCommon(object): # Check for the existence of the virtual volume. try: vol = self.client.getVolume(target_vol_name) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: err = (_("Virtual volume '%s' doesn't exist on array.") % target_vol_name) LOG.error(err) @@ -728,7 +733,7 @@ class HP3PARCommon(object): except Exception as ex: with excutils.save_and_reraise_exception() as ex_ctxt: if (not _convert_to_base and - isinstance(ex, hpexceptions.HTTPForbidden) and + isinstance(ex, hpeexceptions.HTTPForbidden) and ex.get_code() == 150): # Error code 150 means 'invalid operation: Cannot grow # this type of volume'. @@ -826,7 +831,7 @@ class HP3PARCommon(object): return vlun_info - except hpexceptions.HTTPBadRequest as e: + except hpeexceptions.HTTPBadRequest as e: if 'must be in the same domain' in e.get_description(): LOG.error(e.get_description()) raise exception.Invalid3PARDomain(err=e.get_description()) @@ -905,11 +910,10 @@ class HP3PARCommon(object): pools = [] info = self.client.getStorageSystemInfo() - for cpg_name in self.config.hp3par_cpg: + for cpg_name in self.config.hpe3par_cpg: try: cpg = self.client.getCPG(cpg_name) - if (self.API_VERSION >= SRSTATLD_API_VERSION - and hp3parclient.version >= GETCPGSTATDATA_VERSION): + if (self.API_VERSION >= SRSTATLD_API_VERSION): interval = 'daily' history = '7d' stat_capabilities = self.client.getCPGStatData(cpg_name, @@ -957,7 +961,7 @@ class HP3PARCommon(object): cpg['SDUsage']['totalMiB']) * const) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: err = (_("CPG (%s) doesn't exist on array") % cpg_name) LOG.error(err) @@ -974,7 +978,7 @@ class HP3PARCommon(object): self.config.safe_get('max_over_subscription_ratio')), 'reserved_percentage': ( self.config.safe_get('reserved_percentage')), - 'location_info': ('HP3PARDriver:%(sys_id)s:%(dest_cpg)s' % + 'location_info': ('HPE3PARDriver:%(sys_id)s:%(dest_cpg)s' % {'sys_id': info['serialNumber'], 'dest_cpg': cpg_name}), 'total_volumes': total_volumes, @@ -988,16 +992,14 @@ class HP3PARCommon(object): 'filter_function': filter_function, 'goodness_function': goodness_function, 'multiattach': True, + 'consistencygroup_support': True, } - if hp3parclient.version >= MIN_CG_CLIENT_VERSION: - pool['consistencygroup_support'] = True - pools.append(pool) - self.stats = {'driver_version': '1.0', + self.stats = {'driver_version': '3.0', 'storage_protocol': None, - 'vendor_name': 'Hewlett-Packard', + 'vendor_name': 'Hewlett Packard Enterprise', 'volume_backend_name': None, 'pools': pools} @@ -1089,7 +1091,7 @@ class HP3PARCommon(object): vluns = [] try: vluns = self.client.getHostVLUNs(hostname) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: LOG.debug("All VLUNs removed from host %s", hostname) pass @@ -1126,9 +1128,9 @@ class HP3PARCommon(object): ctxt = context.get_admin_context() return volume_types.get_volume_type(ctxt, type_id) - def _get_key_value(self, hp3par_keys, key, default=None): - if hp3par_keys is not None and key in hp3par_keys: - return hp3par_keys[key] + def _get_key_value(self, hpe3par_keys, key, default=None): + if hpe3par_keys is not None and key in hpe3par_keys: + return hpe3par_keys[key] else: return default @@ -1156,20 +1158,20 @@ class HP3PARCommon(object): if 'qos:' in key: fields = key.split(':') key = fields[1] - if key in self.hp_qos_keys: + if key in self.hpe_qos_keys: qos[key] = value return qos def _get_keys_by_volume_type(self, volume_type): - hp3par_keys = {} + hpe3par_keys = {} specs = volume_type.get('extra_specs') for key, value in specs.items(): if ':' in key: fields = key.split(':') key = fields[1] - if key in self.hp3par_valid_keys: - hp3par_keys[key] = value - return hp3par_keys + if key in self.hpe3par_valid_keys: + hpe3par_keys[key] = value + return hpe3par_keys def _set_qos_rule(self, qos, vvs_name): min_io = self._get_qos_value(qos, 'minIOPS') @@ -1207,10 +1209,10 @@ class HP3PARCommon(object): with excutils.save_and_reraise_exception(): LOG.error(_LE("Error creating QOS rule %s"), qosRule) - def get_flash_cache_policy(self, hp3par_keys): - if hp3par_keys is not None: + def get_flash_cache_policy(self, hpe3par_keys): + if hpe3par_keys is not None: # First check list of extra spec keys - val = self._get_key_value(hp3par_keys, 'flash_cache', None) + val = self._get_key_value(hpe3par_keys, 'flash_cache', None) if val is not None: # If requested, see if supported on back end if self.API_VERSION < FLASH_CACHE_API_VERSION: @@ -1247,7 +1249,7 @@ class HP3PARCommon(object): # Admin has set a volume set name to add the volume to try: self.client.addVolumeToVolumeSet(vvs_name, volume_name) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: msg = _('VV Set %s does not exist.') % vvs_name LOG.error(msg) raise exception.InvalidInput(reason=msg) @@ -1302,14 +1304,14 @@ class HP3PARCommon(object): persona_id = persona_value.split(' ') return persona_id[0] - def get_persona_type(self, volume, hp3par_keys=None): + def get_persona_type(self, volume, hpe3par_keys=None): default_persona = self.valid_persona_values[0] type_id = volume.get('volume_type_id', None) if type_id is not None: volume_type = self._get_volume_type(type_id) - if hp3par_keys is None: - hp3par_keys = self._get_keys_by_volume_type(volume_type) - persona_value = self._get_key_value(hp3par_keys, 'persona', + if hpe3par_keys is None: + hpe3par_keys = self._get_keys_by_volume_type(volume_type) + persona_value = self._get_key_value(hpe3par_keys, 'persona', default_persona) return self.validate_persona(persona_value) @@ -1319,19 +1321,19 @@ class HP3PARCommon(object): Reconciles VV Set, old-style extra-specs, and QOS specs and returns commonly used info about the type. - :returns: hp3par_keys, qos, volume_type, vvs_name + :returns: hpe3par_keys, qos, volume_type, vvs_name """ volume_type = None vvs_name = None - hp3par_keys = {} + hpe3par_keys = {} qos = {} if type_id is not None: volume_type = self._get_volume_type(type_id) - hp3par_keys = self._get_keys_by_volume_type(volume_type) - vvs_name = self._get_key_value(hp3par_keys, 'vvs') + hpe3par_keys = self._get_keys_by_volume_type(volume_type) + vvs_name = self._get_key_value(hpe3par_keys, 'vvs') if vvs_name is None: qos = self._get_qos_by_volume_type(volume_type) - return hp3par_keys, qos, volume_type, vvs_name + return hpe3par_keys, qos, volume_type, vvs_name def get_volume_settings_from_type_id(self, type_id, pool): """Get 3PAR volume settings given a type_id. @@ -1345,21 +1347,21 @@ class HP3PARCommon(object): :return: dict """ - hp3par_keys, qos, volume_type, vvs_name = self.get_type_info(type_id) + hpe3par_keys, qos, volume_type, vvs_name = self.get_type_info(type_id) # Default to pool extracted from host. # If that doesn't work use the 1st CPG in the config as the default. - default_cpg = pool or self.config.hp3par_cpg[0] + default_cpg = pool or self.config.hpe3par_cpg[0] - cpg = self._get_key_value(hp3par_keys, 'cpg', default_cpg) + cpg = self._get_key_value(hpe3par_keys, 'cpg', default_cpg) if cpg is not default_cpg: # The cpg was specified in a volume type extra spec so it # needs to be validated that it's in the correct domain. # log warning here - msg = _LW("'hp3par:cpg' is not supported as an extra spec " + msg = _LW("'hpe3par:cpg' is not supported as an extra spec " "in a volume type. CPG's are chosen by " "the cinder scheduler, as a pool, from the " - "cinder.conf entry 'hp3par_cpg', which can " + "cinder.conf entry 'hpe3par_cpg', which can " "be a list of CPGs.") versionutils.report_deprecated_feature(LOG, msg) LOG.info(_LI("Using pool %(pool)s instead of %(cpg)s"), @@ -1368,17 +1370,17 @@ class HP3PARCommon(object): cpg = pool self.validate_cpg(cpg) # Look to see if the snap_cpg was specified in volume type - # extra spec, if not use hp3par_cpg_snap from config as the + # extra spec, if not use hpe3par_cpg_snap from config as the # default. - snap_cpg = self.config.hp3par_cpg_snap - snap_cpg = self._get_key_value(hp3par_keys, 'snap_cpg', snap_cpg) + snap_cpg = self.config.hpe3par_cpg_snap + snap_cpg = self._get_key_value(hpe3par_keys, 'snap_cpg', snap_cpg) # If it's still not set or empty then set it to the cpg. if not snap_cpg: snap_cpg = cpg # if provisioning is not set use thin default_prov = self.valid_prov_values[0] - prov_value = self._get_key_value(hp3par_keys, 'provisioning', + prov_value = self._get_key_value(hpe3par_keys, 'provisioning', default_prov) # check for valid provisioning type if prov_value not in self.valid_prov_values: @@ -1406,7 +1408,7 @@ class HP3PARCommon(object): LOG.error(err) raise exception.InvalidInput(reason=err) - return {'hp3par_keys': hp3par_keys, + return {'hpe3par_keys': hpe3par_keys, 'cpg': cpg, 'snap_cpg': snap_cpg, 'vvs_name': vvs_name, 'qos': qos, 'tpvv': tpvv, 'tdvv': tdvv, 'volume_type': volume_type} @@ -1436,7 +1438,7 @@ class HP3PARCommon(object): # check for valid persona even if we don't use it until # attach time, this will give the end user notice that the # persona type is invalid at volume creation time - self.get_persona_type(volume, volume_settings['hp3par_keys']) + self.get_persona_type(volume, volume_settings['hpe3par_keys']) return volume_settings @@ -1465,7 +1467,8 @@ class HP3PARCommon(object): snap_cpg = type_info['snap_cpg'] tpvv = type_info['tpvv'] tdvv = type_info['tdvv'] - flash_cache = self.get_flash_cache_policy(type_info['hp3par_keys']) + flash_cache = self.get_flash_cache_policy( + type_info['hpe3par_keys']) cg_id = volume.get('consistencygroup_id', None) if cg_id: @@ -1501,11 +1504,11 @@ class HP3PARCommon(object): self.client.deleteVolume(volume_name) LOG.error(_LE("Exception: %s"), ex) raise exception.CinderException(ex) - except hpexceptions.HTTPConflict: + except hpeexceptions.HTTPConflict: msg = _("Volume (%s) already exists on array") % volume_name LOG.error(msg) raise exception.Duplicate(msg) - except hpexceptions.HTTPBadRequest as ex: + except hpeexceptions.HTTPBadRequest as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.Invalid(ex.get_description()) except exception.InvalidInput as ex: @@ -1594,9 +1597,9 @@ class HP3PARCommon(object): return self._get_model_update(volume['host'], cpg) - except hpexceptions.HTTPForbidden: + except hpeexceptions.HTTPForbidden: raise exception.NotAuthorized() - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: raise exception.NotFound() except Exception as ex: LOG.error(_LE("Exception: %s"), ex) @@ -1610,7 +1613,7 @@ class HP3PARCommon(object): # volume set name in the error. try: self.client.deleteVolume(volume_name) - except hpexceptions.HTTPBadRequest as ex: + except hpeexceptions.HTTPBadRequest as ex: if ex.get_code() == 29: if self.client.isOnlinePhysicalCopy(volume_name): LOG.debug("Found an online copy for %(volume)s", @@ -1625,7 +1628,7 @@ class HP3PARCommon(object): else: LOG.error(_LE("Exception: %s"), ex) raise - except hpexceptions.HTTPConflict as ex: + except hpeexceptions.HTTPConflict as ex: if ex.get_code() == 34: # This is a special case which means the # volume is part of a volume set. @@ -1657,16 +1660,16 @@ class HP3PARCommon(object): LOG.error(_LE("Exception: %s"), ex) raise exception.VolumeIsBusy(message=ex.get_description()) - except hpexceptions.HTTPNotFound as ex: + except hpeexceptions.HTTPNotFound as ex: # We'll let this act as if it worked # it helps clean up the cinder entries. LOG.warning(_LW("Delete volume id not found. Removing from " "cinder: %(id)s Ex: %(msg)s"), {'id': volume['id'], 'msg': ex}) - except hpexceptions.HTTPForbidden as ex: + except hpeexceptions.HTTPForbidden as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.NotAuthorized(ex.get_description()) - except hpexceptions.HTTPConflict as ex: + except hpeexceptions.HTTPConflict as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.VolumeIsBusy(message=ex.get_description()) except Exception as ex: @@ -1699,7 +1702,7 @@ class HP3PARCommon(object): type_id = volume.get('volume_type_id', None) - hp3par_keys, qos, _volume_type, vvs = self.get_type_info( + hpe3par_keys, qos, _volume_type, vvs = self.get_type_info( type_id) if vvs: vvs_name = vvs @@ -1737,11 +1740,11 @@ class HP3PARCommon(object): raise exception.CinderException(ex) # Check for flash cache setting in extra specs - flash_cache = self.get_flash_cache_policy(hp3par_keys) + flash_cache = self.get_flash_cache_policy(hpe3par_keys) if qos or vvs_name or flash_cache is not None: - cpg_names = self._get_key_value(hp3par_keys, 'cpg', - self.config.hp3par_cpg) + cpg_names = self._get_key_value(hpe3par_keys, 'cpg', + self.config.hpe3par_cpg) try: self._add_volume_to_volume_set(volume, volume_name, cpg_names[0], vvs_name, @@ -1751,10 +1754,10 @@ class HP3PARCommon(object): self.client.deleteVolume(volume_name) LOG.error(_LE("Exception: %s"), ex) raise exception.CinderException(ex) - except hpexceptions.HTTPForbidden as ex: + except hpeexceptions.HTTPForbidden as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.NotAuthorized() - except hpexceptions.HTTPNotFound as ex: + except hpeexceptions.HTTPNotFound as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.NotFound() except Exception as ex: @@ -1786,19 +1789,19 @@ class HP3PARCommon(object): optional = {'comment': json.dumps(extra), 'readOnly': True} - if self.config.hp3par_snapshot_expiration: + if self.config.hpe3par_snapshot_expiration: optional['expirationHours'] = ( - int(self.config.hp3par_snapshot_expiration)) + int(self.config.hpe3par_snapshot_expiration)) - if self.config.hp3par_snapshot_retention: + if self.config.hpe3par_snapshot_retention: optional['retentionHours'] = ( - int(self.config.hp3par_snapshot_retention)) + int(self.config.hpe3par_snapshot_retention)) self.client.createSnapshot(snap_name, vol_name, optional) - except hpexceptions.HTTPForbidden as ex: + except hpeexceptions.HTTPForbidden as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.NotAuthorized() - except hpexceptions.HTTPNotFound as ex: + except hpeexceptions.HTTPNotFound as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.NotFound() @@ -2004,11 +2007,11 @@ class HP3PARCommon(object): LOG.info(_LI('Completed: convert_to_base_volume: ' 'id=%s.'), volume['id']) - except hpexceptions.HTTPConflict: + except hpeexceptions.HTTPConflict: msg = _("Volume (%s) already exists on array.") % volume_name LOG.error(msg) raise exception.Duplicate(msg) - except hpexceptions.HTTPBadRequest as ex: + except hpeexceptions.HTTPBadRequest as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.Invalid(ex.get_description()) except exception.InvalidInput as ex: @@ -2030,16 +2033,16 @@ class HP3PARCommon(object): try: snap_name = self._get_3par_snap_name(snapshot['id']) self.client.deleteVolume(snap_name) - except hpexceptions.HTTPForbidden as ex: + except hpeexceptions.HTTPForbidden as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.NotAuthorized() - except hpexceptions.HTTPNotFound as ex: + except hpeexceptions.HTTPNotFound as ex: # We'll let this act as if it worked # it helps clean up the cinder entries. LOG.warning(_LW("Delete Snapshot id not found. Removing from " "cinder: %(id)s Ex: %(msg)s"), {'id': snapshot['id'], 'msg': ex}) - except hpexceptions.HTTPConflict as ex: + except hpeexceptions.HTTPConflict as ex: LOG.error(_LE("Exception: %s"), ex) raise exception.SnapshotIsBusy(snapshot_name=snapshot['id']) @@ -2081,7 +2084,7 @@ class HP3PARCommon(object): try: self.delete_vlun(volume, hostname) return - except hpexceptions.HTTPNotFound as e: + except hpeexceptions.HTTPNotFound as e: if 'host does not exist' in e.get_description(): # use the wwn to see if we can find the hostname hostname = self._get_3par_hostname_from_wwn_iqn(wwn, iqn) @@ -2166,7 +2169,7 @@ class HP3PARCommon(object): 'tuneOperation': 1, 'userCPG': new_cpg, 'conversionOperation': cop}) - except hpexceptions.HTTPBadRequest as ex: + except hpeexceptions.HTTPBadRequest as ex: if ex.get_code() == 40 and "keepVV" in six.text_type(ex): # Cannot retype with snapshots because we don't want to # use keepVV and have straggling volumes. Log additional @@ -2200,8 +2203,8 @@ class HP3PARCommon(object): (host_type, host_id, _host_cpg) = ( host['capabilities']['location_info']).split(':') - if not (host_type == 'HP3PARDriver'): - reason = (_("Cannot retype from HP3PARDriver to %s.") % + if not (host_type == 'HPE3PARDriver'): + reason = (_("Cannot retype from HPE3PARDriver to %s.") % host_type) raise exception.InvalidHost(reason) @@ -2302,15 +2305,15 @@ class HP3PARCommon(object): new_qos = new_volume_settings['qos'] new_vvs = new_volume_settings['vvs_name'] new_persona = None - new_hp3par_keys = new_volume_settings['hp3par_keys'] - if 'persona' in new_hp3par_keys: - new_persona = new_hp3par_keys['persona'] - new_flash_cache = self.get_flash_cache_policy(new_hp3par_keys) + new_hpe3par_keys = new_volume_settings['hpe3par_keys'] + if 'persona' in new_hpe3par_keys: + new_persona = new_hpe3par_keys['persona'] + new_flash_cache = self.get_flash_cache_policy(new_hpe3par_keys) old_qos = old_volume_settings['qos'] old_vvs = old_volume_settings['vvs_name'] - old_hp3par_keys = old_volume_settings['hp3par_keys'] - old_flash_cache = self.get_flash_cache_policy(old_hp3par_keys) + old_hpe3par_keys = old_volume_settings['hpe3par_keys'] + old_flash_cache = self.get_flash_cache_policy(old_hpe3par_keys) # Get the current volume info because we can get in a bad state # if we trust that all the volume type settings are still the @@ -2397,7 +2400,7 @@ class HP3PARCommon(object): if vlun['volumeName'] == vol_name: existing_vlun = vlun break - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: # ignore, no existing VLUNs were found LOG.debug("No existing VLUNs were found for host/volume " "combination: %(host)s, %(vol)s", @@ -2417,7 +2420,7 @@ class HP3PARCommon(object): if vlun['volumeName'] == vol_name: existing_vluns.append(vlun) break - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: # ignore, no existing VLUNs were found LOG.debug("No existing VLUNs were found for host/volume " "combination: %(host)s, %(vol)s", @@ -2608,7 +2611,7 @@ class ModifySpecsTask(flow_utils.CinderTask): try: common.client.deleteVolumeSet(vvs_name) self.needs_revert = True - except hpexceptions.HTTPNotFound as ex: + except hpeexceptions.HTTPNotFound as ex: # HTTPNotFound(code=102) is OK. Set does not exist. if ex.get_code() != 102: LOG.error(_LE("Unexpected error when retype() tried to " @@ -2630,7 +2633,7 @@ class ModifySpecsTask(flow_utils.CinderTask): vvs_name = common._get_3par_vvs_name(volume['id']) try: common.client.deleteVolumeSet(vvs_name) - except hpexceptions.HTTPNotFound as ex: + except hpeexceptions.HTTPNotFound as ex: # HTTPNotFound(code=102) is OK. Set does not exist. if ex.get_code() != 102: LOG.error(_LE("Unexpected error when retype() revert " diff --git a/cinder/volume/drivers/san/hp/hp_3par_fc.py b/cinder/volume/drivers/hpe/hpe_3par_fc.py similarity index 93% rename from cinder/volume/drivers/san/hp/hp_3par_fc.py rename to cinder/volume/drivers/hpe/hpe_3par_fc.py index 4a03b408f..dbc8120e8 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_fc.py +++ b/cinder/volume/drivers/hpe/hpe_3par_fc.py @@ -1,4 +1,4 @@ -# (c) Copyright 2013 Hewlett-Packard Development Company, L.P. +# (c) Copyright 2013-2015 Hewlett Packard Enterprise Development LP # All Rights Reserved. # # Copyright 2012 OpenStack Foundation @@ -16,43 +16,43 @@ # under the License. # """ -Volume driver for HP 3PAR Storage array. +Volume driver for HPE 3PAR Storage array. This driver requires 3.1.3 firmware on the 3PAR array, using -the 3.x version of the hp3parclient. +the 4.x version of the hpe3parclient. -You will need to install the python hp3parclient. -sudo pip install --upgrade "hp3parclient>=3.0" +You will need to install the python hpe3parclient. +sudo pip install --upgrade "hpe3parclient>=4.0" Set the following in the cinder.conf file to enable the 3PAR Fibre Channel Driver along with the required flags: -volume_driver=cinder.volume.drivers.san.hp.hp_3par_fc.HP3PARFCDriver +volume_driver=cinder.volume.drivers.hpe.hpe_3par_fc.HPE3PARFCDriver """ try: - from hp3parclient import exceptions as hpexceptions + from hpe3parclient import exceptions as hpeexceptions except ImportError: - hpexceptions = None + hpeexceptions = None from oslo_log import log as logging from cinder import exception from cinder.i18n import _, _LI from cinder.volume import driver -from cinder.volume.drivers.san.hp import hp_3par_common as hpcommon +from cinder.volume.drivers.hpe import hpe_3par_common as hpecommon from cinder.volume.drivers.san import san from cinder.zonemanager import utils as fczm_utils LOG = logging.getLogger(__name__) -class HP3PARFCDriver(driver.TransferVD, - driver.ManageableVD, - driver.ExtendVD, - driver.SnapshotVD, - driver.MigrateVD, - driver.ConsistencyGroupVD, - driver.BaseVD): +class HPE3PARFCDriver(driver.TransferVD, + driver.ManageableVD, + driver.ExtendVD, + driver.SnapshotVD, + driver.MigrateVD, + driver.ConsistencyGroupVD, + driver.BaseVD): """OpenStack Fibre Channel driver to enable 3PAR storage array. Version history: @@ -89,19 +89,20 @@ class HP3PARFCDriver(driver.TransferVD, 2.0.19 - Adds consistency group support 2.0.20 - Update driver to use ABC metaclasses 2.0.21 - Added update_migrated_volume. bug # 1492023 + 3.0.0 - Rebranded HP to HPE. """ - VERSION = "2.0.21" + VERSION = "3.0.0" def __init__(self, *args, **kwargs): - super(HP3PARFCDriver, self).__init__(*args, **kwargs) - self.configuration.append_config_values(hpcommon.hp3par_opts) + super(HPE3PARFCDriver, self).__init__(*args, **kwargs) + self.configuration.append_config_values(hpecommon.hpe3par_opts) self.configuration.append_config_values(san.san_opts) self.lookup_service = fczm_utils.create_lookup_service() def _init_common(self): - return hpcommon.HP3PARCommon(self.configuration) + return hpecommon.HPE3PARCommon(self.configuration) def _login(self): common = self._init_common() @@ -114,8 +115,8 @@ class HP3PARFCDriver(driver.TransferVD, def _check_flags(self, common): """Sanity check to ensure we have required options set.""" - required_flags = ['hp3par_api_url', 'hp3par_username', - 'hp3par_password', + required_flags = ['hpe3par_api_url', 'hpe3par_username', + 'hpe3par_password', 'san_ip', 'san_login', 'san_password'] common.check_flags(self.configuration, required_flags) @@ -285,7 +286,7 @@ class HP3PARFCDriver(driver.TransferVD, try: common.client.getHostVLUNs(hostname) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: # No more exports for this host. LOG.info(_LI("Need to remove FC Zone, building initiator " "target map")) @@ -378,7 +379,7 @@ class HP3PARFCDriver(driver.TransferVD, domain = common.get_domain(cpg) try: host = common._get_3par_host(hostname) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: # get persona from the volume type extra specs persona_id = common.get_persona_type(volume) # host doesn't exist, we have to create it @@ -556,7 +557,7 @@ class HP3PARFCDriver(driver.TransferVD, common = self._login() try: return common.get_cpg(volume) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: reason = (_("Volume %s doesn't exist on array.") % volume) LOG.error(reason) raise exception.InvalidVolume(reason) diff --git a/cinder/volume/drivers/san/hp/hp_3par_iscsi.py b/cinder/volume/drivers/hpe/hpe_3par_iscsi.py similarity index 93% rename from cinder/volume/drivers/san/hp/hp_3par_iscsi.py rename to cinder/volume/drivers/hpe/hpe_3par_iscsi.py index 39d474ce2..a9fbe00c6 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_iscsi.py +++ b/cinder/volume/drivers/hpe/hpe_3par_iscsi.py @@ -1,4 +1,4 @@ -# (c) Copyright 2012-2014 Hewlett-Packard Development Company, L.P. +# (c) Copyright 2012-2015 Hewlett Packard Enterprise Development LP # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -14,26 +14,26 @@ # under the License. # """ -Volume driver for HP 3PAR Storage array. +Volume driver for HPE 3PAR Storage array. This driver requires 3.1.3 firmware on the 3PAR array, using -the 3.x version of the hp3parclient. +the 4.x version of the hpe3parclient. -You will need to install the python hp3parclient. -sudo pip install --upgrade "hp3parclient>=3.1" +You will need to install the python hpe3parclient. +sudo pip install --upgrade "hpe3parclient>=4.0" Set the following in the cinder.conf file to enable the 3PAR iSCSI Driver along with the required flags: -volume_driver=cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver +volume_driver=cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver """ import re import sys try: - from hp3parclient import exceptions as hpexceptions + from hpe3parclient import exceptions as hpeexceptions except ImportError: - hpexceptions = None + hpeexceptions = None from oslo_log import log as logging import six @@ -41,7 +41,7 @@ import six from cinder import exception from cinder.i18n import _, _LE, _LW from cinder.volume import driver -from cinder.volume.drivers.san.hp import hp_3par_common as hpcommon +from cinder.volume.drivers.hpe import hpe_3par_common as hpecommon from cinder.volume.drivers.san import san from cinder.volume import utils as volume_utils @@ -51,13 +51,13 @@ CHAP_USER_KEY = "HPQ-cinder-CHAP-name" CHAP_PASS_KEY = "HPQ-cinder-CHAP-secret" -class HP3PARISCSIDriver(driver.TransferVD, - driver.ManageableVD, - driver.ExtendVD, - driver.SnapshotVD, - driver.MigrateVD, - driver.ConsistencyGroupVD, - driver.BaseVD): +class HPE3PARISCSIDriver(driver.TransferVD, + driver.ManageableVD, + driver.ExtendVD, + driver.SnapshotVD, + driver.MigrateVD, + driver.ConsistencyGroupVD, + driver.BaseVD): """OpenStack iSCSI driver to enable 3PAR storage array. Version history: @@ -99,18 +99,19 @@ class HP3PARISCSIDriver(driver.TransferVD, 2.0.21 - Adds consistency group support 2.0.22 - Update driver to use ABC metaclasses 2.0.23 - Added update_migrated_volume. bug # 1492023 + 3.0.0 - Rebranded HP to HPE. """ - VERSION = "2.0.23" + VERSION = "3.0.0" def __init__(self, *args, **kwargs): - super(HP3PARISCSIDriver, self).__init__(*args, **kwargs) - self.configuration.append_config_values(hpcommon.hp3par_opts) + super(HPE3PARISCSIDriver, self).__init__(*args, **kwargs) + self.configuration.append_config_values(hpecommon.hpe3par_opts) self.configuration.append_config_values(san.san_opts) def _init_common(self): - return hpcommon.HP3PARCommon(self.configuration) + return hpecommon.HPE3PARCommon(self.configuration) def _login(self): common = self._init_common() @@ -123,8 +124,8 @@ class HP3PARISCSIDriver(driver.TransferVD, def _check_flags(self, common): """Sanity check to ensure we have required options set.""" - required_flags = ['hp3par_api_url', 'hp3par_username', - 'hp3par_password', 'san_ip', 'san_login', + required_flags = ['hpe3par_api_url', 'hpe3par_username', + 'hpe3par_password', 'san_ip', 'san_login', 'san_password'] common.check_flags(self.configuration, required_flags) @@ -164,9 +165,9 @@ class HP3PARISCSIDriver(driver.TransferVD, temp_iscsi_ip = {} # use the 3PAR ip_addr list for iSCSI configuration - if len(self.configuration.hp3par_iscsi_ips) > 0: + if len(self.configuration.hpe3par_iscsi_ips) > 0: # add port values to ip_addr, if necessary - for ip_addr in self.configuration.hp3par_iscsi_ips: + for ip_addr in self.configuration.hpe3par_iscsi_ips: ip = ip_addr.split(':') if len(ip) == 1: temp_iscsi_ip[ip_addr] = {'ip_port': DEFAULT_ISCSI_PORT} @@ -207,7 +208,7 @@ class HP3PARISCSIDriver(driver.TransferVD, # lets see if there are invalid iSCSI IPs left in the temp dict if len(temp_iscsi_ip) > 0: LOG.warning(_LW("Found invalid iSCSI IP address(s) in " - "configuration option(s) hp3par_iscsi_ips or " + "configuration option(s) hpe3par_iscsi_ips or " "iscsi_ip_address '%s.'"), (", ".join(temp_iscsi_ip))) @@ -340,7 +341,7 @@ class HP3PARISCSIDriver(driver.TransferVD, target_luns.append(vlun['lun']) else: LOG.warning(_LW("iSCSI IP: '%s' was not found in " - "hp3par_iscsi_ips list defined in " + "hpe3par_iscsi_ips list defined in " "cinder.conf."), iscsi_ip) info = {'driver_volume_type': 'iscsi', @@ -394,7 +395,7 @@ class HP3PARISCSIDriver(driver.TransferVD, } } - if self.configuration.hp3par_iscsi_chap_enabled: + if self.configuration.hpe3par_iscsi_chap_enabled: info['data']['auth_method'] = 'CHAP' info['data']['auth_username'] = username info['data']['auth_password'] = password @@ -428,14 +429,14 @@ class HP3PARISCSIDriver(driver.TransferVD, try: common.client.removeVolumeMetaData(vol_name, CHAP_USER_KEY) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: pass except Exception: raise try: common.client.removeVolumeMetaData(vol_name, CHAP_PASS_KEY) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: pass except Exception: raise @@ -476,7 +477,7 @@ class HP3PARISCSIDriver(driver.TransferVD, def _set_3par_chaps(self, common, hostname, volume, username, password): """Sets a 3PAR host's CHAP credentials.""" - if not self.configuration.hp3par_iscsi_chap_enabled: + if not self.configuration.hpe3par_iscsi_chap_enabled: return mod_request = {'chapOperation': common.client.HOST_EDIT_ADD, @@ -496,7 +497,7 @@ class HP3PARISCSIDriver(driver.TransferVD, domain = common.get_domain(cpg) # Get the CHAP secret if CHAP is enabled - if self.configuration.hp3par_iscsi_chap_enabled: + if self.configuration.hpe3par_iscsi_chap_enabled: vol_name = common._get_3par_vol_name(volume['id']) username = common.client.getVolumeMetaData( vol_name, CHAP_USER_KEY)['value'] @@ -505,7 +506,7 @@ class HP3PARISCSIDriver(driver.TransferVD, try: host = common._get_3par_host(hostname) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: # get persona from the volume type extra specs persona_id = common.get_persona_type(volume) # host doesn't exist, we have to create it @@ -529,7 +530,7 @@ class HP3PARISCSIDriver(driver.TransferVD, password) host = common._get_3par_host(hostname) elif (not host['initiatorChapEnabled'] and - self.configuration.hp3par_iscsi_chap_enabled): + self.configuration.hpe3par_iscsi_chap_enabled): LOG.warning(_LW("Host exists without CHAP credentials set and " "has iSCSI attachments but CHAP is enabled. " "Updating host with new CHAP credentials.")) @@ -546,7 +547,7 @@ class HP3PARISCSIDriver(driver.TransferVD, """Gets the associated account, generates CHAP info and updates.""" model_update = {} - if not self.configuration.hp3par_iscsi_chap_enabled: + if not self.configuration.hpe3par_iscsi_chap_enabled: model_update['provider_auth'] = None return model_update @@ -564,7 +565,7 @@ class HP3PARISCSIDriver(driver.TransferVD, if not host_info['initiatorChapEnabled']: LOG.warning(_LW("Host has no CHAP key, but CHAP is enabled.")) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: chap_password = volume_utils.generate_password(16) LOG.warning(_LW("No host or VLUNs exist. Generating new " "CHAP key.")) @@ -590,7 +591,7 @@ class HP3PARISCSIDriver(driver.TransferVD, vlun['volumeName'], CHAP_PASS_KEY)['value'] chap_exists = True break - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: LOG.debug("The VLUN %s is missing CHAP credentials " "but CHAP is enabled. Skipping.", vlun['remoteName']) @@ -630,7 +631,7 @@ class HP3PARISCSIDriver(driver.TransferVD, try: vol_name = common._get_3par_vol_name(volume['id']) common.client.getVolume(vol_name) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: LOG.error(_LE("Volume %s doesn't exist on array."), vol_name) else: metadata = common.client.getAllVolumeMetaData(vol_name) @@ -853,7 +854,7 @@ class HP3PARISCSIDriver(driver.TransferVD, common = self._login() try: return common.get_cpg(volume) - except hpexceptions.HTTPNotFound: + except hpeexceptions.HTTPNotFound: reason = (_("Volume %s doesn't exist on array.") % volume) LOG.error(reason) raise exception.InvalidVolume(reason) diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 01af2021a..743dcd87d 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -122,7 +122,11 @@ MAPPING = { 'cinder.volume.drivers.hds.nfs.HDSNFSDriver': 'cinder.volume.drivers.hitachi.hnas_nfs.HDSNFSDriver', 'cinder.volume.drivers.hds.iscsi.HDSISCSIDriver': - 'cinder.volume.drivers.hitachi.hnas_iscsi.HDSISCSIDriver'} + 'cinder.volume.drivers.hitachi.hnas_iscsi.HDSISCSIDriver', + 'cinder.volume.drivers.san.hp.hp_3par_fc.HP3PARFCDriver': + 'cinder.volume.drivers.hpe.hpe_3par_fc.HPE3PARFCDriver', + 'cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver': + 'cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver', } def locked_volume_operation(f): -- 2.45.2