summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorWilliam Wolf <throughnothing@gmail.com>2011-07-21 12:02:01 -0400
committerWilliam Wolf <throughnothing@gmail.com>2011-07-21 12:02:01 -0400
commitdc616cd633007aa83d7576ae74cf807aa0df6776 (patch)
treed93c30b3088b00e66d3158ccfede23e197416c03 /nova/api
parent9a843b10f3145405ebc01ded5d32ce68d02fdd8d (diff)
fixed another issue with invalid flavor_id parsing, and added tests
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/create_instance_helper.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/nova/api/openstack/create_instance_helper.py b/nova/api/openstack/create_instance_helper.py
index 10aaa23b1..2b9256896 100644
--- a/nova/api/openstack/create_instance_helper.py
+++ b/nova/api/openstack/create_instance_helper.py
@@ -102,7 +102,11 @@ class CreateInstanceHelper(object):
if personality:
injected_files = self._get_injected_files(personality)
- flavor_id = self.controller._flavor_id_from_req_data(body)
+ try:
+ flavor_id = self.controller._flavor_id_from_req_data(body)
+ except ValueError as error:
+ msg = _("Invalid flavorRef provided.")
+ raise faults.Fault(exc.HTTPBadRequest(explanation=msg))
if not 'name' in body['server']:
msg = _("Server name is not defined")