5 from urlparse import urlparse
6 from sfa.util.sfalogging import logger
7 from sfa.util.config import Config
11 from nova import flags
12 from nova import context
13 from nova.auth.manager import AuthManager
14 from nova.compute.manager import ComputeManager
15 from nova.network.manager import NetworkManager
16 from nova.scheduler.manager import SchedulerManager
17 from sfa.openstack.client import GlanceClient
25 Wraps the module and injects the context when executing methods
27 def __init__(self, proxy, context):
29 self.context = context
31 def __getattr__(self, name):
32 def func(*args, **kwds):
33 result=getattr(self.proxy, name)(self.context, *args, **kwds)
39 A simple native shell to a nova backend.
40 This class can receive all nova calls to the underlying testbed
43 # dont care about limiting calls yet
48 # use the 'capability' auth mechanism for higher performance when the PLC db is local
49 def __init__ ( self, config ) :
52 self.auth_manager = None
53 self.compute_manager = None
54 self.network_manager = None
55 self.scheduler_manager = None
57 self.image_manager = None
60 logger.debug('nova access - native')
62 flags.FLAGS(['foo', '--flagfile=/etc/nova/nova.conf', 'foo', 'foo'])
63 # instantiate managers
64 self.auth_manager = AuthManager()
65 self.compute_manager = ComputeManager()
66 self.network_manager = NetworkManager()
67 self.scheduler_manager = SchedulerManager()
68 self.db = InjectContext(db, context.get_admin_context())
69 self.image_manager = GlanceClient(config)
71 logger.debug('nova access - REST')
72 raise SfaNotImplemented('nova access - Rest')