From a56511fd455c0f986781eb9bc437bb779ef278e4 Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Tue, 1 Sep 2015 16:22:40 -0700 Subject: [PATCH] 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 --- cinder/tests/unit/test_hp3par.py | 10 +++++----- cinder/volume/drivers/san/hp/hp_3par_common.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cinder/tests/unit/test_hp3par.py b/cinder/tests/unit/test_hp3par.py index 40451afe3..fc672a237 100644 --- a/cinder/tests/unit/test_hp3par.py +++ b/cinder/tests/unit/test_hp3par.py @@ -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})] diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/san/hp/hp_3par_common.py index ea31a735d..4d4761df4 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_common.py +++ b/cinder/volume/drivers/san/hp/hp_3par_common.py @@ -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) -- 2.45.2