summaryrefslogtreecommitdiffstats
path: root/nova/context.py
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2012-02-06 16:29:30 -0800
committerVishvananda Ishaya <vishvananda@gmail.com>2012-02-07 17:14:56 -0800
commit13b82dbbcfe280eda15fd9248a494cb8ce4e5056 (patch)
tree736df371cc415bd2f80706a3c3ca7a78d12cfa29 /nova/context.py
parentb0a708f67407256a449414a000b070752e51dba2 (diff)
downloadnova-13b82dbbcfe280eda15fd9248a494cb8ce4e5056.tar.gz
nova-13b82dbbcfe280eda15fd9248a494cb8ce4e5056.tar.xz
nova-13b82dbbcfe280eda15fd9248a494cb8ce4e5056.zip
Optimizes ec2 keystone usage and handles errors
* breaks out gen_request_id so we can return it in error msg * breaks out ec2_error so we can use it in multiple middlewares * adds new middleware (remove old after devstack change) * skips extra call to keystone for second authentication * fixes bug 922373 Change-Id: If765d149289255b0bf0e0c1b647ebb547ce5759b
Diffstat (limited to 'nova/context.py')
-rw-r--r--nova/context.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/nova/context.py b/nova/context.py
index b0c0603a8..dbeb18652 100644
--- a/nova/context.py
+++ b/nova/context.py
@@ -20,12 +20,15 @@
"""RequestContext: context for requests that persist through all of nova."""
import copy
-import uuid
from nova import local
from nova import utils
+def generate_request_id():
+ return 'req-' + str(utils.gen_uuid())
+
+
class RequestContext(object):
"""Security context and request information.
@@ -59,7 +62,7 @@ class RequestContext(object):
timestamp = utils.parse_strtime(timestamp)
self.timestamp = timestamp
if not request_id:
- request_id = 'req-' + str(utils.gen_uuid())
+ request_id = generate_request_id()
self.request_id = request_id
self.auth_token = auth_token
self.strategy = strategy