summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/images.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py
index d43340e10..22c79e2e9 100644
--- a/nova/api/openstack/images.py
+++ b/nova/api/openstack/images.py
@@ -208,9 +208,14 @@ class ControllerV11(Controller):
msg = _("Expected serverRef attribute on server entity.")
raise webob.exc.HTTPBadRequest(explanation=msg)
- head, tail = os.path.split(server_ref)
-
- if head and head != os.path.join(req.application_url, 'servers'):
+ head, _sep, tail = server_ref.rpartition('/')
+
+ url, _sep, version = req.application_url.rpartition('/')
+ long_url = '%s:%s/%s' % (url, FLAGS.osapi_port, version)
+ valid_urls = ['%s/servers' % req.application_url,
+ '%s/servers' % long_url]
+ if head and head not in valid_urls:
+ LOG.warn(head)
msg = _("serverRef must match request url")
raise webob.exc.HTTPBadRequest(explanation=msg)