summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-07-03 19:03:26 +0000
committerGerrit Code Review <review@openstack.org>2012-07-03 19:03:26 +0000
commitb0255f5b35513f4cbf6c603b91776cbff53168bb (patch)
tree2845bac44205185adb59a989640d6e8692294e34 /nova/api
parentdde5b01ce129fb47050d126051775c31e36f3b89 (diff)
parent94a34e0e69a520e403a2d8e579186fad9acf14c7 (diff)
downloadnova-b0255f5b35513f4cbf6c603b91776cbff53168bb.tar.gz
nova-b0255f5b35513f4cbf6c603b91776cbff53168bb.tar.xz
nova-b0255f5b35513f4cbf6c603b91776cbff53168bb.zip
Merge "Add ServiceCatalog entries to enable Cinder usage"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/auth.py8
-rw-r--r--nova/api/ec2/__init__.py5
2 files changed, 11 insertions, 2 deletions
diff --git a/nova/api/auth.py b/nova/api/auth.py
index d8b5342c6..81e0a0377 100644
--- a/nova/api/auth.py
+++ b/nova/api/auth.py
@@ -18,6 +18,7 @@ Common Auth Middleware.
"""
+import json
import webob.dec
import webob.exc
@@ -95,13 +96,18 @@ class NovaKeystoneContext(wsgi.Middleware):
remote_address = req.remote_addr
if FLAGS.use_forwarded_for:
remote_address = req.headers.get('X-Forwarded-For', remote_address)
+
+ if req.headers.get('X_SERVICE_CATALOG') is not None:
+ service_catalog = json.loads(req.headers.get('X_SERVICE_CATALOG'))
+
ctx = context.RequestContext(user_id,
project_id,
user_name=user_name,
project_name=project_name,
roles=roles,
auth_token=auth_token,
- remote_address=remote_address)
+ remote_address=remote_address,
+ service_catalog=service_catalog)
req.environ['nova.context'] = ctx
return self.application
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py
index 11fa9d6d5..9613d0f8b 100644
--- a/nova/api/ec2/__init__.py
+++ b/nova/api/ec2/__init__.py
@@ -261,13 +261,16 @@ class EC2KeystoneAuth(wsgi.Middleware):
if FLAGS.use_forwarded_for:
remote_address = req.headers.get('X-Forwarded-For',
remote_address)
+
+ catalog = result['access']['serviceCatalog']
ctxt = context.RequestContext(user_id,
project_id,
user_name=user_name,
project_name=project_name,
roles=roles,
auth_token=token_id,
- remote_address=remote_address)
+ remote_address=remote_address,
+ service_catalog=catalog)
req.environ['nova.context'] = ctxt