]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Pass new volume size when cloning (blockbridge)
authorJoshua Huber <jhuber@blockbridge.com>
Thu, 10 Mar 2016 01:15:36 +0000 (20:15 -0500)
committerJoshua Huber <jhuber@blockbridge.com>
Thu, 10 Mar 2016 01:15:36 +0000 (20:15 -0500)
When creating a cloned volume (using the Blockbridge driver), pass the
new volume capacity to the backend. After a successful clone, the
backend extends the new volume to the requested size.

Update unit test to ensure capacity param is supplied to the backend
API.

Change-Id: I5e9527691b4575e355143e61fd8ed0354ac2c3d9
Closes-Bug: #1554750

cinder/tests/unit/test_blockbridge.py
cinder/volume/drivers/blockbridge.py

index 6b0c9b87811748f4a851eb2080e01b9f1d735adc..5da78f434538ffc3a0fab5b76bef08a380ee5c1e 100644 (file)
@@ -297,6 +297,7 @@ class BlockbridgeISCSIDriverTestCase(test.TestCase):
             volume_id=self.snapshot['volume_id'])
         create_params = dict(
             name=self.volume_name,
+            capacity=self.volume_size * units.Gi,
             src=vol_src)
         kwargs = dict(
             method='PUT',
@@ -325,6 +326,7 @@ class BlockbridgeISCSIDriverTestCase(test.TestCase):
             volume_id=self.snapshot['volume_id'])
         create_params = dict(
             name=self.volume_name,
+            capacity=self.volume_size * units.Gi,
             src=vol_src)
         kwargs = dict(
             method='PUT',
@@ -348,6 +350,7 @@ class BlockbridgeISCSIDriverTestCase(test.TestCase):
 
         create_params = dict(
             name=self.volume_name,
+            capacity=self.volume_size * units.Gi,
             src=dict(volume_id=src_vref['id']))
         kwargs = dict(
             method='PUT',
@@ -380,6 +383,7 @@ class BlockbridgeISCSIDriverTestCase(test.TestCase):
 
         create_params = dict(
             name=self.volume_name,
+            capacity=self.volume_size * units.Gi,
             src=dict(volume_id=src_vref['id']))
         kwargs = dict(
             method='PUT',
index 69c817259349ce01a05d23aa4e24c86d09615b56..f961e66edd4288cd5ede6a8f127ef66891591918 100644 (file)
@@ -349,6 +349,7 @@ class BlockbridgeISCSIDriver(driver.ISCSIDriver):
 
         create_params = {
             'name': self._get_dbref_name(volume),
+            'capacity': int(volume['size'] * units.Gi),
             'src': {
                 'volume_id': src_vref['id'],
             },
@@ -401,6 +402,7 @@ class BlockbridgeISCSIDriver(driver.ISCSIDriver):
 
         create_params = {
             'name': self._get_dbref_name(volume),
+            'capacity': int(volume['size'] * units.Gi),
             'src': {
                 'volume_id': snapshot['volume_id'],
                 'snapshot_id': snapshot['id'],