-#
-# (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
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 = \
AVG_BUSY_PERC = 'avg_busy_perc'
-class HP3PARBaseDriver(object):
+class HPE3PARBaseDriver(object):
class CommentMatcher(object):
def __init__(self, f, expect):
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'
'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}
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',
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}
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}
'degradedStates': [],
'failedStates': [],
'id': 5,
- 'name': HP3PAR_CPG,
+ 'name': HPE3PAR_CPG,
'numFPVVs': 2,
'numTPVVs': 0,
'numTDVVs': 1,
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'
}
}
'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,
'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,
'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,
'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,
'name': 'bad_persona',
'id': 'any_id',
'extra_specs': {
- 'hp3par:persona': '99 - invalid'
+ 'hpe3par:persona': '99 - invalid'
}
}
'extra_specs': {
'cpg': 'bogus',
'snap_cpg': 'bogus',
- 'hp3par:persona': '2 - Generic-ALUA'
+ 'hpe3par:persona': '2 - Generic-ALUA'
}
}
'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
}
'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
}
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):
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"
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"
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):
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()
# 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)
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 +
# 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
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 +
_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()
_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'])
'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')
'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'])
'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'])
_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
'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 +
_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
', "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 +
_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}
'"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',
_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()
_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,
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,
# 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},
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},
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,
{'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,
{'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,
_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,
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
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,
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,
# 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)
# 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)
mock.call.copyVolume(
self.VOLUME_3PAR_NAME,
'osv-0DM4qZEVSKON-AAAAAAAAA',
- HP3PAR_CPG2,
+ HPE3PAR_CPG2,
{'snapCPG': 'OpenStackCPGSnap', 'tpvv': True,
'tdvv': False, 'online': True})]
_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)
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}}
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',
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}}
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(),
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}}
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',
_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()
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":
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}}
'_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(
'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(
# 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(),
# 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,
# 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)
# 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)
# 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
# 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:
# 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_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()
'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),
_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()
{
'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),
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()
# 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,
}]
}
- 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(
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()
# 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'
# 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
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},
}
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
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},
}
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))
'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()
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()
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()
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()
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" %
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()
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()
}
}
- expected_snap_cpg = HP3PAR_CPG_SNAP
+ expected_snap_cpg = HPE3PAR_CPG_SNAP
expected_retype_modify = [
mock.call.modifyVolume(osv_matcher,
{'comment': self.CommentMatcher(
mock.call.modifyVolume(
osv_matcher,
{'action': 6,
- 'userCPG': HP3PAR_CPG,
+ 'userCPG': HPE3PAR_CPG,
'conversionOperation': 1, 'tuneOperation': 1}),
mock.call.getTask(1)
]
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()
'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()
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()
'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()
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()
'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,
{'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()
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()
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 = {}
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()
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()
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'
" '" + 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}
group)
expected = [
- mock.call.getCPG(HP3PAR_CPG),
+ mock.call.getCPG(HPE3PAR_CPG),
mock.call.createVolumeSet(
self.CONSIS_GROUP_NAME,
domain=None,
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'
" '" + 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}
group)
expected = [
- mock.call.getCPG(HP3PAR_CPG),
+ mock.call.getCPG(HPE3PAR_CPG),
mock.call.createVolumeSet(
self.CONSIS_GROUP_NAME,
domain=None,
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'
" '" + 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}
group)
expected = [
- mock.call.getCPG(HP3PAR_CPG),
+ mock.call.getCPG(HPE3PAR_CPG),
mock.call.createVolumeSet(
self.CONSIS_GROUP_NAME,
domain=None,
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'
" '" + 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}
group)
expected = [
- mock.call.getCPG(HP3PAR_CPG),
+ mock.call.getCPG(HPE3PAR_CPG),
mock.call.createVolumeSet(
self.CONSIS_GROUP_NAME,
domain=None,
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'
" '" + 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}
group)
expected = [
- mock.call.getCPG(HP3PAR_CPG),
+ mock.call.getCPG(HPE3PAR_CPG),
mock.call.createVolumeSet(
self.CONSIS_GROUP_NAME,
domain=None,
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'
' "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}
group)
expected = [
- mock.call.getCPG(HP3PAR_CPG),
+ mock.call.getCPG(HPE3PAR_CPG),
mock.call.createVolumeSet(
self.CONSIS_GROUP_NAME,
domain=None,
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'
' "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}
group)
expected = [
- mock.call.getCPG(HP3PAR_CPG),
+ mock.call.getCPG(HPE3PAR_CPG),
mock.call.createVolumeSet(
self.CONSIS_GROUP_NAME,
domain=None,
self.standard_logout)
-class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
+class TestHPE3PARFCDriver(HPE3PARBaseDriver, test.TestCase):
properties = {
'driver_volume_type': 'fibre_channel',
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 = (
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 +
# 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,
}
mock_client.getHostVLUNs.side_effect = [
- hpexceptions.HTTPNotFound('fake'),
+ hpeexceptions.HTTPNotFound('fake'),
[{'active': True,
'volumeName': self.VOLUME_3PAR_NAME,
'lun': 90, 'type': 0}]]
'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(
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']),
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,
}
mock_client.getHostVLUNs.side_effect = [
- hpexceptions.HTTPNotFound('fake'),
+ hpeexceptions.HTTPNotFound('fake'),
[{'active': True,
'volumeName': self.VOLUME_3PAR_NAME,
'lun': 90, 'type': 0,
['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),
# 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,
}
mock_client.getHostVLUNs.side_effect = [
- hpexceptions.HTTPNotFound('fake'),
+ hpeexceptions.HTTPNotFound('fake'),
[{'active': True,
'volumeName': self.VOLUME_3PAR_NAME,
'lun': 90, 'type': 0}]]
'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(
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']),
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
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,
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])
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': [{
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,
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])
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,
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
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()
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 +
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
"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()
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
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'
"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()
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 +
# 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,
'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()
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']),
# 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'}]}]
}]
}
- 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()
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']),
# 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': []},
'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()
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', {
# 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,
{'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()
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', {
# 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,
{'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()
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', {
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
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 = (
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 +
# 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': [{
'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(
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),
# 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': [{
}
mock_client.getHostVLUNs.side_effect = [
- hpexceptions.HTTPNotFound('fake'),
+ hpeexceptions.HTTPNotFound('fake'),
[{'active': True,
'volumeName': self.VOLUME_3PAR_NAME,
'lun': self.TARGET_LUN, 'type': 0,
'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(
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),
# 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': [{
'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(
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),
# 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': [{
'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(
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),
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
}
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
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 +
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
"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()
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
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'
"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()
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 +
# 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()
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(
# 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}
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()
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(
# 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': [{
}]
}
- 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()
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')]
# 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': [{
'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()
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(
# 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': []},
'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()
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,
# 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': []},
'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()
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(
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)
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)
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)
# 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()
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': {
{'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()
# 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()
# 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()
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()
# 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',
]
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()
# 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 = {
]
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()
# 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',
]
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()
# 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',
]
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()
'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)
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)
'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()
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()
-# (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
# 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
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.
"""
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
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'
AVG_BUSY_PERC = 'avg_busy_perc'
-class HP3PARCommon(object):
+class HPE3PARCommon(object):
"""Class that contains common code for the 3PAR drivers.
Version history:
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 = {}
'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
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)
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
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)
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)
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)
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,
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)
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)
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)
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'
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)
# 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)
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'.
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())
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,
cpg['SDUsage']['totalMiB']) *
const)
- except hpexceptions.HTTPNotFound:
+ except hpeexceptions.HTTPNotFound:
err = (_("CPG (%s) doesn't exist on array")
% cpg_name)
LOG.error(err)
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,
'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}
vluns = []
try:
vluns = self.client.getHostVLUNs(hostname)
- except hpexceptions.HTTPNotFound:
+ except hpeexceptions.HTTPNotFound:
LOG.debug("All VLUNs removed from host %s", hostname)
pass
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
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')
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:
# 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)
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)
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.
: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"),
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:
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}
# 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
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:
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:
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)
# 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",
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.
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:
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
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,
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:
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()
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:
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'])
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)
'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
(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)
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
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",
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",
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 "
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 "