4 from urlparse import urlparse
5 from sfa.util.sfalogging import logger
9 from nova import context
10 from nova.auth.manager import AuthManager
11 from nova.compute.manager import ComputeManager
12 from nova.network.manager import NetworkManager
13 from nova.scheduler.manager import SchedulerManager
14 from nova.image.glance import GlanceImageService
22 Wraps the module and injects the context when executing methods
24 def __init__(self, proxy, context):
26 self.context = context
28 def __getattr__(self, name):
29 def func(*args, **kwds):
30 result=getattr(self.proxy, name)(self.context, *args, **kwds)
36 A simple native shell to a nova backend.
37 This class can receive all nova calls to the underlying testbed
40 # dont care about limiting calls yet
45 # use the 'capability' auth mechanism for higher performance when the PLC db is local
46 def __init__ ( self, config ) :
47 self.auth_manager = None
48 self.compute_manager = None
49 self.network_manager = None
50 self.scheduler_manager = None
52 self.image_manager = None
55 logger.debug('nova access - native')
57 flags.FLAGS(['foo', '--flagfile=/etc/nova/nova.conf', 'foo', 'foo'])
58 # instantiate managers
59 self.auth_manager = AuthManager()
60 self.compute_manager = ComputeManager()
61 self.network_manager = NetworkManager()
62 self.scheduler_manager = SchedulerManager()
63 self.db = InjectContext(db, context.get_admin_context())
64 self.image_manager = InjectContext(GlanceImageService(), context.get_admin_context())
66 logger.debug('nova access - REST')
67 raise SfaNotImplemented('nova access - Rest')