task_id = 1234
interval = .001
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
waiter = common.TaskWaiter(mock_client, task_id, interval)
# 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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.driver.create_volume(self.volume)
comment = (
# 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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
return_model = self.driver.create_volume(self.volume_pool)
'snap_cpg': expected_type_snap_cpg,
'volume_type': self.volume_type}}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
'cpg': expected_cpg,
'volume_type': self.volume_type}}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
conf = self.setup_configuration()
expected_snap_cpg = conf.hp3par_cpg_snap
mock_client = self.setup_driver(config=conf)
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
conf.hp3par_cpg_snap = None
expected_cpg = conf.hp3par_cpg
mock_client = self.setup_driver(config=conf)
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
'tpvv': True,
'volume_type': self.volume_type}}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
return_model = self.driver.create_volume(self.volume_qos)
_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(exception.InvalidHost,
self.driver.retype,
mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF)
mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(hpexceptions.HTTPNotFound,
self.driver.retype,
mock_client.addVolumeToVolumeSet.side_effect = \
hpexceptions.HTTPForbidden
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(hpexceptions.HTTPForbidden,
self.driver.retype,
# Fail the QOS setting to test the revert of the snap CPG rename.
mock_client.deleteVolumeSet.side_effect = hpexceptions.HTTPForbidden
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(hpexceptions.HTTPForbidden,
self.driver.retype,
mock_client.getStorageSystemInfo.return_value = {
'serialNumber': 'XXXXXXX'}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(exception.InvalidHost,
self.driver.retype,
{'domain': 'domain2'},
]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(exception.Invalid3PARDomain,
self.driver.retype,
{'domain': 'snap_cpg_domain_1'},
]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(exception.Invalid3PARDomain,
self.driver.retype,
_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(exception.InvalidInput,
self.driver.retype,
mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF)
mock_client.getCPG.side_effect = hpexceptions.HTTPNotFound
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.assertRaises(exception.InvalidInput,
self.driver.retype,
volume = {'id': HP3PARBaseDriver.CLONE_ID}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
retyped = self.driver.retype(
cpg = "any_cpg"
snap_cpg = "any_cpg"
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
common._retype(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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
volume = {'name': HP3PARBaseDriver.VOLUME_NAME,
_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
src_vref = {}
'status': 'available',
'host': HP3PARBaseDriver.FAKE_HOST,
'source_volid': HP3PARBaseDriver.VOLUME_ID}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
'host': HP3PARBaseDriver.FAKE_HOST,
'source_volid': HP3PARBaseDriver.VOLUME_ID}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host = {'host': 'stack@3parfc1',
'capabilities': {'location_info': loc_info}}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
result = self.driver.migrate_volume(context.get_admin_context(),
volume, host)
'host': HP3PARBaseDriver.FAKE_HOST,
'source_volid': HP3PARBaseDriver.VOLUME_ID}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
'host': HP3PARBaseDriver.FAKE_HOST,
'source_volid': HP3PARBaseDriver.VOLUME_ID}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.driver.attach_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.driver.detach_volume(context.get_admin_context(), self.volume)
expected = [
# 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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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)
# 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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
model_update = self.driver.create_volume_from_snapshot(
}
mock_client = self.setup_driver(mock_conf=conf)
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
'tpvv': True,
'volume_type': self.volume_type}}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
_mock_volume_types.return_value = {
'name': 'gold',
}]
}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
self.driver.terminate_connection(
self.volume,
key = 'a'
value = 'b'
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
common.update_volume_key_value_pair(
# 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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
key = 'a'
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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
grow_size = 3
old_size = self.volume['size']
}
mock_client = self.setup_driver(mock_conf=conf)
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
grow_size = 3
old_size = self.volume['size']
}
mock_client = self.setup_driver(mock_conf=conf)
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
grow_size = 3
old_size = self.volume['size']
'type': 2,
'portPos': {'node': 0, 'slot': 6, 'cardPort': 3}}]}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
ports = common.get_ports()['members']
def test_get_by_qos_spec_with_scoping(self):
mock_client = self.setup_driver()
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
qos_ref = qos_specs.create(self.ctxt, 'qos-specs-1', self.QOS)
def test_get_by_qos_spec(self):
mock_client = self.setup_driver()
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
qos_ref = qos_specs.create(
def test_get_by_qos_by_type_only(self):
mock_client = self.setup_driver()
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
type_ref = volume_types.create(self.ctxt,
lun_id = 11
nsp = '1:2:3'
mock_client = self.setup_driver()
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
location = ("%(name)s,%(lunid)s,%(host)s,%(nsp)s" %
{'name': self.VOLUME_NAME,
def test__get_existing_volume_ref_name(self):
mock_client = self.setup_driver()
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
unm_matcher = common._get_3par_unm_name(self.volume['id'])
mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound('fake')
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
unm_matcher = common._get_3par_unm_name(self.volume['id'])
mock_client.getVolume.return_value = {'comment': comment}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
unm_matcher = common._get_3par_unm_name(self.volume['id'])
{'domain': 'domain3'},
]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
unm_matcher = common._get_3par_unm_name(self.volume['id'])
def test_manage_existing_get_size_invalid_reference(self):
mock_client = self.setup_driver()
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
volume = {}
existing_ref = {'source-name': self.VOLUME_3PAR_NAME}
mock_client = self.setup_driver()
mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound('fake')
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
unm_matcher = common._get_3par_unm_name(self.volume['id'])
def test_unmanage(self):
mock_client = self.setup_driver()
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
self.driver.unmanage(self.volume)
'nsp': 'something'})
mock_client.createVLUN.return_value = location
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
result = self.driver.initialize_connection(
self.volume,
['0987654321234']
}}}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
result = self.driver.initialize_connection(self.volume, connector)
mock.call.getHostVLUNs(self.FAKE_HOST),
mock.call.getPorts()]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
conn_info = self.driver.terminate_connection(self.volume,
self.connector)
mock.call.getHostVLUNs(self.FAKE_HOST),
mock.call.getPorts()]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
conn_info = self.driver.terminate_connection(self.volume,
self.connector)
self.FAKE_HOST),
mock.call.getHostVLUNs(self.FAKE_HOST)]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
conn_info = self.driver.terminate_connection(self.volume,
self.connector)
"usableFreeMiB": 1024.0 * 3
}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
'wwn': self.wwn[1]}]}]
mock_client.queryHost.return_value = None
mock_client.getVLUN.return_value = {'lun': 186}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host = self.driver._create_host(
}]
}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host = self.driver._create_host(
'FCPaths': [{'wwn': '123456789012345'}, {
'wwn': '123456789054321'}]}]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host = self.driver._create_host(
{'wwn': '123456789054321'}]}
mock_client.getHost.side_effect = [getHost_ret1, getHost_ret2]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host = self.driver._create_host(
{'wwn': 'xxxxxxxxxxxxxxx'}]}
mock_client.getHost.side_effect = [getHost_ret1, getHost_ret2]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host = self.driver._create_host(
'nsp': 'something'})
mock_client.createVLUN.return_value = location
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
result = self.driver.initialize_connection(
self.volume,
"usableFreeMiB": 1024.0 * 3
}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
stats = self.driver.get_volume_stats(True)
mock_client.queryHost.return_value = None
mock_client.getVLUN.return_value = {'lun': self.TARGET_LUN}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host, auth_username, auth_password = self.driver._create_host(
mock_client.getVolumeMetaData.side_effect = get_side_effect
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host, auth_username, auth_password = self.driver._create_host(
}]
}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host, auth_username, auth_password = self.driver._create_host(
'chapSecret': 'test-pass'
}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host, auth_username, auth_password = self.driver._create_host(
'FCPaths': [{'wwn': '123456789012345'},
{'wwn': '123456789054321'}]}]
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host, auth_username, auth_password = self.driver._create_host(
'chapSecret': 'test-pass'
}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
host, auth_username, auth_password = self.driver._create_host(
mock_client.getPorts.return_value = PORTS_RET
mock_client.getVLUNs.return_value = VLUNS1_RET
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
mock_client.getPorts.return_value = PORTS_RET
mock_client.getVLUNs.return_value = VLUNS1_RET
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
mock_client.getPorts.return_value = PORTS_RET
mock_client.getVLUNs.return_value = VLUNS1_RET
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
iscsi_ips = ["10.10.220.252", "10.10.220.253"]
self.driver.configuration.hp3par_iscsi_ips = iscsi_ips
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
self.driver.initialize_iscsi_ports(common)
{'portPos': {'node': 0, 'slot': 2, 'cardPort': 1}, 'active': True}]
mock_client.getVLUNs.return_value = {'members': ports}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
# in use count
# and return the mock HTTP 3PAR client
mock_client = self.setup_driver()
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
expected = []
config.hp3par_iscsi_chap_enabled = True
mock_client = self.setup_driver(config=config)
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
expected_mod_request = {
expected = []
expected_model = {'provider_auth': None}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
model = self.driver._do_export(common, volume)
]
expected_model = {'provider_auth': 'CHAP test-host random-pass'}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
model = self.driver._do_export(common, volume)
]
expected_model = {'provider_auth': 'CHAP test-host random-pass'}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
model = self.driver._do_export(common, volume)
]
expected_model = {'provider_auth': 'CHAP test-host random-pass'}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
model = self.driver._do_export(common, volume)
]
expected_model = {'provider_auth': 'CHAP test-host random-pass'}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
model = self.driver._do_export(common, volume)
'members': []
}
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
model = self.driver.ensure_export(None, volume)
mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound(
'fake')
- with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_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, '_create_client')\
- as mock_create_client:
+ with mock.patch.object(hpcommon.HP3PARCommon,
+ '_create_client') as mock_create_client:
mock_create_client.return_value = mock_client
common = self.driver._login()
2.0.31 - Removed usage of host name cache #1398914
2.0.32 - Update LOG usage to fix translations. bug #1384312
2.0.33 - Fix host persona to match WSAPI mapping bug #1403997
+ 2.0.34 - Fix log messages to match guidelines. bug #1411370
"""
- VERSION = "2.0.33"
+ VERSION = "2.0.34"
stats = {}
old_size = volume['size']
growth_size = int(new_size) - old_size
LOG.debug("Extending Volume %(vol)s from %(old)s to %(new)s, "
- " by %(diff)s GB." %
+ " by %(diff)s GB.",
{'vol': volume_name, 'old': old_size, 'new': new_size,
'diff': growth_size})
growth_size_mib = growth_size * units.Ki
return volume_settings
def create_volume(self, volume):
- LOG.debug("CREATE VOLUME (%s : %s %s)" %
+ LOG.debug("CREATE VOLUME (%s : %s %s)",
(volume['display_name'], volume['name'],
self._get_3par_vol_name(volume['id'])))
try:
def _copy_volume(self, src_name, dest_name, cpg, snap_cpg=None,
tpvv=True):
# Virtual volume sets are not supported with the -online option
- LOG.debug('Creating clone of a volume %(src)s to %(dest)s.' %
+ LOG.debug('Creating clone of a volume %(src)s to %(dest)s.',
{'src': src_name, 'dest': dest_name})
optional = {'tpvv': tpvv, 'online': True}
except hpexceptions.HTTPBadRequest as ex:
if ex.get_code() == 29:
if self.client.isOnlinePhysicalCopy(volume_name):
- LOG.debug("Found an online copy for %(volume)s"
- % {'volume': volume_name})
+ LOG.debug("Found an online copy for %(volume)s",
+ {'volume': volume_name})
# the volume is in process of being cloned.
# stopOnlinePhysicalCopy will also delete
# the volume once it stops the copy.
# This is a special case which means the
# volume is part of a volume set.
vvset_name = self.client.findVolumeSet(volume_name)
- LOG.debug("Returned vvset_name = %s" % vvset_name)
+ LOG.debug("Returned vvset_name = %s", vvset_name)
if vvset_name is not None and \
vvset_name.startswith('vvs-'):
# We have a single volume per volume set, so
"""Creates a volume from a snapshot.
"""
- LOG.debug("Create Volume from Snapshot\n%s\n%s" %
+ LOG.debug("Create Volume from Snapshot\n%s\n%s",
(pprint.pformat(volume['display_name']),
pprint.pformat(snapshot['display_name'])))
growth_size = volume['size'] - snapshot['volume_size']
if growth_size > 0:
try:
- LOG.debug('Converting to base volume type: %s.' %
+ LOG.debug('Converting to base volume type: %s.',
volume['id'])
model_update = self._convert_to_base_volume(volume)
growth_size_mib = growth_size * units.Gi / units.Mi
- LOG.debug('Growing volume: %(id)s by %(size)s GiB.' %
+ LOG.debug('Growing volume: %(id)s by %(size)s GiB.',
{'id': volume['id'], 'size': growth_size})
self.client.growVolume(volume_name, growth_size_mib)
except Exception as ex:
return model_update
def create_snapshot(self, snapshot):
- LOG.debug("Create Snapshot\n%s" % pprint.pformat(snapshot))
+ LOG.debug("Create Snapshot\n%s", pprint.pformat(snapshot))
try:
snap_name = self._get_3par_snap_name(snapshot['id'])
If key already exists, the value will be replaced.
"""
- LOG.debug("VOLUME (%s : %s %s) Updating KEY-VALUE pair: (%s : %s)" %
+ LOG.debug("VOLUME (%s : %s %s) Updating KEY-VALUE pair: (%s : %s)",
(volume['display_name'],
volume['name'],
self._get_3par_vol_name(volume['id']),
def clear_volume_key_value_pair(self, volume, key):
"""Clears key,value pairs metadata from virtual volume."""
- LOG.debug("VOLUME (%s : %s %s) Clearing Key : %s)" %
+ LOG.debug("VOLUME (%s : %s %s) Clearing Key : %s)",
(volume['display_name'], volume['name'],
self._get_3par_vol_name(volume['id']), key))
try:
raise exception.VolumeBackendAPIException(data=msg)
def attach_volume(self, volume, instance_uuid):
- LOG.debug("Attach Volume\n%s" % pprint.pformat(volume))
+ LOG.debug("Attach Volume\n%s", pprint.pformat(volume))
try:
self.update_volume_key_value_pair(volume,
'HPQ-CS-instance_uuid',
LOG.error(_LE("Error attaching volume %s"), volume)
def detach_volume(self, volume):
- LOG.debug("Detach Volume\n%s" % pprint.pformat(volume))
+ LOG.debug("Detach Volume\n%s", pprint.pformat(volume))
try:
self.clear_volume_key_value_pair(volume, 'HPQ-CS-instance_uuid')
except Exception:
dbg = {'id': volume['id'],
'host': host['host'],
'status': volume['status']}
- LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s.' % dbg)
+ LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s.', dbg)
ret = False, None
LOG.info(_LI('3PAR driver cannot perform migration. '
'Retype exception: %s'), e)
- LOG.debug('leave: migrate_volume: id=%(id)s, host=%(host)s.' % dbg)
- LOG.debug('migrate_volume result: %s, %s' % ret)
+ LOG.debug('leave: migrate_volume: id=%(id)s, host=%(host)s.', dbg)
+ LOG.debug('migrate_volume result: %s, %s', ret)
return ret
def _convert_to_base_volume(self, volume, new_cpg=None):
cpg, cpg, type_info['tpvv'])
LOG.debug('Copy volume scheduled: convert_to_base_volume: '
- 'id=%s.' % volume['id'])
+ 'id=%s.', volume['id'])
# Wait for the physical copy task to complete
def _wait_for_task(task_id):
status = self.client.getTask(task_id)
- LOG.debug("3PAR Task id %(id)s status = %(status)s" %
+ LOG.debug("3PAR Task id %(id)s status = %(status)s",
{'id': task_id,
'status': status['status']})
if status['status'] is not self.client.TASK_ACTIVE:
raise exception.CinderException(msg)
else:
LOG.debug('Copy volume completed: convert_to_base_volume: '
- 'id=%s.' % volume['id'])
+ 'id=%s.', volume['id'])
comment = self._get_3par_vol_comment(volume_name)
if comment:
self.client.modifyVolume(temp_vol_name, {'comment': comment})
LOG.debug('Volume rename completed: convert_to_base_volume: '
- 'id=%s.' % volume['id'])
+ 'id=%s.', volume['id'])
# Delete source volume after the copy is complete
self.client.deleteVolume(volume_name)
LOG.debug('Delete src volume completed: convert_to_base_volume: '
- 'id=%s.' % volume['id'])
+ 'id=%s.', volume['id'])
# Rename the new volume to the original name
self.client.modifyVolume(temp_vol_name, {'newName': volume_name})
return self._get_model_update(volume['host'], cpg)
def delete_snapshot(self, snapshot):
- LOG.debug("Delete Snapshot id %s %s" % (snapshot['id'],
- pprint.pformat(snapshot)))
+ LOG.debug("Delete Snapshot id %s %s", (snapshot['id'],
+ pprint.pformat(snapshot)))
try:
snap_name = self._get_3par_snap_name(snapshot['id'])
if 'snapCPG' in old_volume_info:
old_snap_cpg = old_volume_info['snapCPG']
- LOG.debug("retype old_volume_info=%s" % old_volume_info)
- LOG.debug("retype old_volume_settings=%s" % old_volume_settings)
- LOG.debug("retype new_volume_settings=%s" % new_volume_settings)
+ LOG.debug("retype old_volume_info=%s", old_volume_info)
+ LOG.debug("retype old_volume_settings=%s", old_volume_settings)
+ LOG.debug("retype new_volume_settings=%s", new_volume_settings)
self._retype(volume, volume_name, new_type_name, new_type_id,
host, new_persona, old_cpg, new_cpg,
is just skipped if host is None.
"""
LOG.debug(("enter: retype: id=%(id)s, new_type=%(new_type)s,"
- "diff=%(diff)s, host=%(host)s") % {'id': volume['id'],
- 'new_type': new_type,
- 'diff': diff,
- 'host': host})
+ "diff=%(diff)s, host=%(host)s"), {'id': volume['id'],
+ 'new_type': new_type,
+ 'diff': diff,
+ 'host': host})
old_volume_settings = self.get_volume_settings_from_type(volume, host)
return self._retype_from_old_to_new(volume, new_type,
old_volume_settings, host)
def _wait_for_task(self):
status = self.client.getTask(self.task_id)
- LOG.debug("3PAR Task id %(id)s status = %(status)s" %
+ LOG.debug("3PAR Task id %(id)s status = %(status)s",
{'id': self.task_id,
'status': status['status']})
if status['status'] is not self.client.TASK_ACTIVE: