diff options
| author | Rohit Karajgi <rohit.karajgi@nttdata.com> | 2012-12-28 04:43:14 -0800 |
|---|---|---|
| committer | Rohit Karajgi <rohit.karajgi@nttdata.com> | 2013-01-14 05:29:47 -0800 |
| commit | e34d5d9e3d416fc40f147a5914f7dceee26f5ba4 (patch) | |
| tree | e7de3414527f2351dbe942af8698d1fa634246b1 /nova/compute | |
| parent | aa18fca87fd4655c47e473639a30a6b61ed88fce (diff) | |
Add Compute API validations for block device map
This patch adds validations to return 400 BadRequest to
Create server(s) with block device mappings where appropriate
and related unit tests
Fixes bug 1094244
Change-Id: I778d3ed4b0871561774594e950ce98b6a1ecfcb9
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/api.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py index d0a039644..9b51ba13e 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -432,7 +432,11 @@ class API(base.Base): max_count = min_count block_device_mapping = block_device_mapping or [] - + if min_count > 1 or max_count > 1: + if any(map(lambda bdm: 'volume_id' in bdm, block_device_mapping)): + msg = _('Cannot attach one or more volumes to multiple' + ' instances') + raise exception.InvalidRequest(msg) if instance_type['disabled']: raise exception.InstanceTypeNotFound( instance_type_id=instance_type['id']) |
