diff options
| author | Unmesh Gurjar <unmesh.gurjar@nttdata.com> | 2012-10-11 23:48:08 -0700 |
|---|---|---|
| committer | Unmesh Gurjar <unmesh.gurjar@nttdata.com> | 2012-10-22 05:33:49 -0700 |
| commit | 7c9761b3bb52788021b5bf0eb9726af833db4074 (patch) | |
| tree | fa1144a5447fe0f1a4b464c185c99617ac92e340 /nova/api | |
| parent | 8cb329b2a03f1d04f13c38244477e53ca4a321f0 (diff) | |
Fix error on invalid delete_on_termination value
1. Fixed 500 error when an invalid value is passed to 'delete_on_termination'
parameter in 'block_device_mapping' of create server API (json request).
Converted the value to 'bool' (similar to XML request workflow) to fix issue.
2. Also added unit test coverage.
Fixes LP: #1060955
Change-Id: Ib35040f17a3712dac45ec1e3c2f32fee17db7c03
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/servers.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 89eac8bfd..cdc95db0b 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -792,7 +792,11 @@ class Controller(wsgi.Controller): block_device_mapping = None if self.ext_mgr.is_loaded('os-volumes'): - block_device_mapping = server_dict.get('block_device_mapping') + block_device_mapping = server_dict.get('block_device_mapping', []) + for bdm in block_device_mapping: + if 'delete_on_termination' in bdm: + bdm['delete_on_termination'] = utils.bool_from_str( + bdm['delete_on_termination']) ret_resv_id = False # min_count and max_count are optional. If they exist, they may come |
