Fix block-device-mapping when volume_size is empty

The Nova API responds with an validation error when a bdm is submitted
containing an empty volume_size. So instead omit that attribute when it
is empty.

Change-Id: Iba905fca8c440a03e828c20922f3b813bba3fa3a
Closes-Bug: 1677236
This commit is contained in:
Jens Rosenboom 2017-03-29 14:17:49 +00:00
parent ca06a09d4d
commit 61cde9c8e8
3 changed files with 8 additions and 3 deletions

View File

@ -544,7 +544,7 @@ class CreateServer(command.ShowOne):
else:
mapping['source_type'] = 'volume'
mapping['destination_type'] = 'volume'
if len(dev_map) > 2:
if len(dev_map) > 2 and dev_map[2]:
mapping['volume_size'] = dev_map[2]
if len(dev_map) > 3:
mapping['delete_on_termination'] = dev_map[3]

View File

@ -817,8 +817,7 @@ class TestServerCreate(TestServer):
'uuid': real_volume_mapping.split(':', 1)[0],
'destination_type': 'volume',
'source_type': 'volume',
'delete_on_termination': '0',
'volume_size': ''
'delete_on_termination': '0'
}],
nics=[],
scheduler_hints={},

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fix creating a server with a block-device-mapping when volume_size
is empty.
[Bug `1677236 <https://bugs.launchpad.net/bugs/1652827>`_]