Use conductor in the servicegroup db driver.
This patch updates the servicegroup db driver to use the conductor API in the cases where it was accessing the db directly before. If the service is allowed to do direct db access, the conductor API will optimize the call to go straight to the db. Otherwise, it will invoke rpc to a remove conductor service to perform the operations. Part of bp no-db-compute. Change-Id: I96adffc6f80288c829d84f170414613a35b5c840
This commit is contained in:
@@ -45,6 +45,15 @@ class API(object):
|
||||
|
||||
@lockutils.synchronized('nova.servicegroup.api.new', 'nova-')
|
||||
def __new__(cls, *args, **kwargs):
|
||||
'''Create an instance of the servicegroup API.
|
||||
|
||||
args and kwargs are passed down to the servicegroup driver when it gets
|
||||
created. No args currently exist, though. Valid kwargs are:
|
||||
|
||||
db_allowed - Boolean. False if direct db access is not allowed and
|
||||
alternative data access (conductor) should be used
|
||||
instead.
|
||||
'''
|
||||
|
||||
if not cls._driver:
|
||||
LOG.debug(_('ServiceGroup driver defined as an instance of %s'),
|
||||
@@ -55,7 +64,8 @@ class API(object):
|
||||
except KeyError:
|
||||
raise TypeError(_("unknown ServiceGroup driver name: %s")
|
||||
% driver_name)
|
||||
cls._driver = importutils.import_object(driver_class)
|
||||
cls._driver = importutils.import_object(driver_class,
|
||||
*args, **kwargs)
|
||||
utils.check_isinstance(cls._driver, ServiceGroupDriver)
|
||||
# we don't have to check that cls._driver is not NONE,
|
||||
# check_isinstance does it
|
||||
|
||||
Reference in New Issue
Block a user