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
This commit is contained in:
Joshua Huber 2016-03-09 20:15:36 -05:00
parent 0066d554c6
commit 2f8e6c9134
2 changed files with 6 additions and 0 deletions

View 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',

View 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'],