summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-03-06 23:30:41 +0000
committerGerrit Code Review <review@openstack.org>2012-03-06 23:30:41 +0000
commita8f562845b4980c947df836419eb8d2a8b3dc6e7 (patch)
treee7f73d1aae66f6c38b072a5c64244b0e724b651b /nova/api
parent67715309a1cda8cc56bf4e528774f75e652bf6d5 (diff)
parent86bf2276d9adf2365e46a880d7ec4a276780d3ed (diff)
Merge "Only pass image uuids to compute api rebuild"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/servers.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index 5dc5cff49..2bfbfb745 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -633,14 +633,7 @@ class Controller(wsgi.Controller):
name = name.strip()
image_href = self._image_ref_from_req_data(body)
-
- # If the image href was generated by nova api, strip image_href
- # down to an id and use the default glance connection params
- image_href = image_href.split('/').pop()
-
- if not utils.is_uuid_like(str(image_href)):
- msg = _("Invalid imageRef provided.")
- raise exc.HTTPBadRequest(explanation=msg)
+ image_href = self._image_uuid_from_href(image_href)
personality = server_dict.get('personality')
config_drive = server_dict.get('config_drive')
@@ -933,6 +926,17 @@ class Controller(wsgi.Controller):
msg = _("Missing imageRef attribute")
raise exc.HTTPBadRequest(explanation=msg)
+ def _image_uuid_from_href(self, image_href):
+ # If the image href was generated by nova api, strip image_href
+ # down to an id and use the default glance connection params
+ image_uuid = image_href.split('/').pop()
+
+ if not utils.is_uuid_like(image_uuid):
+ msg = _("Invalid imageRef provided.")
+ raise exc.HTTPBadRequest(explanation=msg)
+
+ return image_uuid
+
def _flavor_id_from_req_data(self, data):
try:
flavor_ref = data['server']['flavorRef']
@@ -1010,6 +1014,8 @@ class Controller(wsgi.Controller):
msg = _("Could not parse imageRef from request.")
raise exc.HTTPBadRequest(explanation=msg)
+ image_href = self._image_uuid_from_href(image_href)
+
try:
password = body['adminPass']
except (KeyError, TypeError):