3PAR Fix create_cloned_volume source volume id
This patch fixes where we are getting the source volume id from. Previously we were reading the source volume id from the destination volume object in volume['source_volid']. There are cases where this value doesn't exist. We are now reading the value from the src_vref['id'] instead. Change-Id: I7cf3137048d4b46099077402ec76faf20bd66b83 Closes-Bug: 1491175
This commit is contained in:
@@ -1372,7 +1372,7 @@ class HP3PARBaseDriver(object):
|
||||
'host': volume_utils.append_host(self.FAKE_HOST,
|
||||
HP3PAR_CPG2),
|
||||
'source_volid': HP3PARBaseDriver.VOLUME_ID}
|
||||
src_vref = {}
|
||||
src_vref = {'id': HP3PARBaseDriver.VOLUME_ID}
|
||||
model_update = self.driver.create_cloned_volume(volume, src_vref)
|
||||
self.assertIsNone(model_update)
|
||||
|
||||
@@ -1398,23 +1398,23 @@ class HP3PARBaseDriver(object):
|
||||
'_create_client') as mock_create_client:
|
||||
mock_create_client.return_value = mock_client
|
||||
|
||||
src_vref = {}
|
||||
src_vref = {'id': HP3PARBaseDriver.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.CLONE_ID
|
||||
volume['id'] = HP3PARBaseDriver.VOLUME_ID
|
||||
volume['host'] = volume_host
|
||||
volume['source_volid'] = HP3PARBaseDriver.VOLUME_ID
|
||||
volume['source_volid'] = HP3PARBaseDriver.CLONE_ID
|
||||
model_update = self.driver.create_cloned_volume(volume, src_vref)
|
||||
self.assertEqual(None, model_update)
|
||||
|
||||
expected = [
|
||||
mock.call.getCPG(expected_cpg),
|
||||
mock.call.copyVolume(
|
||||
self.VOLUME_3PAR_NAME,
|
||||
'osv-0DM4qZEVSKON-AAAAAAAAA',
|
||||
self.VOLUME_3PAR_NAME,
|
||||
expected_cpg,
|
||||
{'snapCPG': 'OpenStackCPGSnap', 'tpvv': True,
|
||||
'tdvv': False, 'online': True})]
|
||||
|
||||
@@ -1571,7 +1571,7 @@ class HP3PARCommon(object):
|
||||
|
||||
def create_cloned_volume(self, volume, src_vref):
|
||||
try:
|
||||
orig_name = self._get_3par_vol_name(volume['source_volid'])
|
||||
orig_name = self._get_3par_vol_name(src_vref['id'])
|
||||
vol_name = self._get_3par_vol_name(volume['id'])
|
||||
|
||||
type_info = self.get_volume_settings_from_type(volume)
|
||||
|
||||
Reference in New Issue
Block a user