]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
3PAR Fix create_cloned_volume source volume id
authorWalter A. Boring IV <walter.boring@hp.com>
Tue, 1 Sep 2015 23:22:40 +0000 (16:22 -0700)
committerWalter A. Boring IV <walter.boring@hp.com>
Wed, 2 Sep 2015 02:13:37 +0000 (02:13 +0000)
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
cinder/volume/drivers/san/hp/hp_3par_common.py

index 40451afe386216b53bbfbc384948d0d4d4d4a6e2..fc672a237af869e2f8c8901f6758778bbca86632 100644 (file)
@@ -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})]
index ea31a735dc6421f7acbf7097d1dd1ede96b4b4d4..4d4761df40d1ae4060ae0cf8ed74ae73087a464f 100644 (file)
@@ -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)