From: peter_wang Date: Fri, 11 Mar 2016 09:39:38 +0000 (-0500) Subject: Allow clone volume with different size X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=89d9fbe75d6a3da137bfd69b01a5023dff92a6c4;p=openstack-build%2Fcinder-build.git Allow clone volume with different size 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 --- diff --git a/cinder/tests/unit/test_emc_vnx.py b/cinder/tests/unit/test_emc_vnx.py index a3a00fc13..0f9e2cc2c 100644 --- a/cinder/tests/unit/test_emc_vnx.py +++ b/cinder/tests/unit/test_emc_vnx.py @@ -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), diff --git a/cinder/volume/drivers/emc/emc_vnx_cli.py b/cinder/volume/drivers/emc/emc_vnx_cli.py index 592f7ba76..3167f22d3 100644 --- a/cinder/volume/drivers/emc/emc_vnx_cli.py +++ b/cinder/volume/drivers/emc/emc_vnx_cli.py @@ -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