From 2f8e6c9134508959eca3f0839673126bec54bde6 Mon Sep 17 00:00:00 2001 From: Joshua Huber Date: Wed, 9 Mar 2016 20:15:36 -0500 Subject: [PATCH] Pass new volume size when cloning (blockbridge) 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 | 4 ++++ cinder/volume/drivers/blockbridge.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/cinder/tests/unit/test_blockbridge.py b/cinder/tests/unit/test_blockbridge.py index 6b0c9b878..5da78f434 100644 --- a/cinder/tests/unit/test_blockbridge.py +++ b/cinder/tests/unit/test_blockbridge.py @@ -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', diff --git a/cinder/volume/drivers/blockbridge.py b/cinder/volume/drivers/blockbridge.py index 69c817259..f961e66ed 100644 --- a/cinder/volume/drivers/blockbridge.py +++ b/cinder/volume/drivers/blockbridge.py @@ -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'], -- 2.45.2