From a262a21a769eb4763aee883ae661a9c05e2b4bfd Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 2 Feb 2012 12:57:17 -0500 Subject: [PATCH] we still need a refrence to the nova.db for managing keys --- sfa/openstack/nova_shell.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sfa/openstack/nova_shell.py b/sfa/openstack/nova_shell.py index 8ad7c59a..9730ab86 100644 --- a/sfa/openstack/nova_shell.py +++ b/sfa/openstack/nova_shell.py @@ -4,6 +4,9 @@ import socket from urlparse import urlparse from sfa.util.sfalogging import logger try: + from nova import db + from nova import flags + from nova import context from nova.auth.manager import AuthManager from nova.compute.manager import ComputeManager from nova.network.manager import NetworkManager @@ -11,6 +14,16 @@ try: has_nova = True except: has_nova = False + + +def wrap_context(wrapped, context): + """ + Supplies the wrapped object with the specified context + when executing callables. + """ + def wrapper(*args, **kwds): + return wrapped(context, *args, **kwds) + return wrap_context class NovaShell: """ @@ -44,9 +57,13 @@ class NovaShell: if is_local and has_nova: logger.debug('nova access - native') # load the config + self.auth_manager = AuthManager() + self.compute_manager = ComputeManager() + self.network_manager = NetworkManager() + self.scheduler_manager = SchedulerManager() flags.FLAGS(['foo', '--flagfile=/etc/nova/nova.conf', 'foo', 'foo']) - self.auth = context.get_admin_context() - self.proxy = db + self.context = context.get_admin_context() + self.db = wrap_context(db, self.context) else: self.auth = None self.proxy = None -- 2.47.0