]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Allow clone volume with different size
authorpeter_wang <peter.wang13@emc.com>
Fri, 11 Mar 2016 09:39:38 +0000 (04:39 -0500)
committerpeter_wang <peter.wang13@emc.com>
Fri, 11 Mar 2016 10:24:59 +0000 (05:24 -0500)
Previously when cloning new volume, VNX driver ignores the size
of new volume, and take the size of source volume.

This fix will allow new size to be set for new cloned volume.

Closes-bug: #1554776
Change-Id: Ib75e1b5caa434746864b66bb79b532120aed0f20

cinder/tests/unit/test_emc_vnx.py
cinder/volume/drivers/emc/emc_vnx_cli.py

index a3a00fc133659870938910ba0b0928d5b4095c77..0f9e2cc2cd7e1c762c1a5d3b7a4c1ab7267a2491 100644 (file)
@@ -2967,6 +2967,8 @@ Time Remaining:  0 second(s)
         volume = self.testData.test_volume.copy()
         volume['id'] = '2'
         volume = EMCVNXCLIDriverTestData.convert_volume(volume)
+        # Make sure this size is used
+        volume.size = 10
         self.driver.create_cloned_volume(volume, self.testData.test_volume)
         tmp_snap = 'tmp-snap-' + volume.id
         expect_cmd = [
@@ -2981,7 +2983,7 @@ Time Remaining:  0 second(s)
                 *self.testData.SNAP_ATTACH_CMD(
                     name='volume-2', snapName=tmp_snap)),
             mock.call(*self.testData.LUN_CREATION_CMD(
-                build_migration_dest_name('volume-2'), 1,
+                build_migration_dest_name('volume-2'), 10,
                 'unit_test_pool', None, None)),
             mock.call(*self.testData.LUN_PROPERTY_ALL_CMD(
                 build_migration_dest_name('volume-2')), poll=False),
index 592f7ba76e3d2da7fcda263df5d2839bbbd1b181..3167f22d373608770067fd9a9f2b80c2db254395 100644 (file)
@@ -2958,7 +2958,7 @@ class EMCVnxCliBase(object):
         self._volume_creation_check(volume)
         base_lun_name = self._get_base_lun_name(src_vref)
         source_lun_id = self.get_lun_id(src_vref)
-        volume_size = src_vref['size']
+        volume_size = volume['size']
         source_volume_name = src_vref['name']
         consistencygroup_id = src_vref['consistencygroup_id']
         cgsnapshot_name = None