Skip setting volume_size if not given

When the block-device parameters skip volume_size,
don't set it. Setting to an empty volume_size
would be invalid as it has to be an integer,
and Nova API will reject the request if api validation
is implemented. (proposed e.g. at
https://review.openstack.org/#/c/34749/)

Fixes bug LP #1199539

Change-Id: I7ab518886abf8d449caf1c70563a79a990d7765e
This commit is contained in:
Dirk Mueller 2013-06-27 19:13:01 +02:00
parent b526c9beff
commit f50ff361e2
2 changed files with 2 additions and 2 deletions
novaclient
tests/v1_1
v1_1

@ -275,7 +275,6 @@ class ShellTest(utils.TestCase):
'name': 'some-server',
'block_device_mapping': [
{
'volume_size': '',
'volume_id': 'blah',
'delete_on_termination': '0',
'device_name': 'vda'

@ -139,7 +139,8 @@ class BootingManagerWithFind(base.ManagerWithFind):
else:
bdm_dict['volume_id'] = id
if len(mapping_parts) > 2:
bdm_dict['volume_size'] = mapping_parts[2]
if mapping_parts[2]:
bdm_dict['volume_size'] = str(int(mapping_parts[2]))
if len(mapping_parts) > 3:
bdm_dict['delete_on_termination'] = mapping_parts[3]
bdm.append(bdm_dict)