From 328185099087ae377d6dfcaec7538735e91a3bbc Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Tue, 22 Jan 2013 13:55:22 -0500 Subject: Ensure service's servicegroup API is created first. We want to make sure to create the servicegroup API instance early, before creating other things such as the manager, that will also create a servicegroup API instance. Internally, the servicegroup only allocates a single instance of the driver API and we want to make sure that the service's value of db_allowed is there when it gets created. For that to happen, when the service class creates a servicegroup API instance, it needs to be the first thing to do so. Part of bp no-db-compute. Change-Id: I41df39d34c4920fcbfcd50c8f0344ee1dd5547d1 --- nova/service.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nova/service.py b/nova/service.py index df8cf020f..5a2aa482c 100644 --- a/nova/service.py +++ b/nova/service.py @@ -399,6 +399,14 @@ class Service(object): self.binary = binary self.topic = topic self.manager_class_name = manager + # NOTE(russellb) We want to make sure to create the servicegroup API + # instance early, before creating other things such as the manager, + # that will also create a servicegroup API instance. Internally, the + # servicegroup only allocates a single instance of the driver API and + # we want to make sure that our value of db_allowed is there when it + # gets created. For that to happen, this has to be the first instance + # of the servicegroup API. + self.servicegroup_api = servicegroup.API(db_allowed=db_allowed) manager_class = importutils.import_class(self.manager_class_name) self.manager = manager_class(host=self.host, *args, **kwargs) self.report_interval = report_interval @@ -408,10 +416,8 @@ class Service(object): self.saved_args, self.saved_kwargs = args, kwargs self.timers = [] self.backdoor_port = None - self.db_allowed = db_allowed self.conductor_api = conductor.API(use_local=db_allowed) self.conductor_api.wait_until_ready(context.get_admin_context()) - self.servicegroup_api = servicegroup.API(db_allowed=db_allowed) def start(self): verstr = version.version_string_with_package() -- cgit