diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 0ad3cfc776..551ed13876 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -407,7 +407,7 @@ class ComputeManager(manager.SchedulerDependentManager): self._report_driver_status(context) self.publish_service_capabilities(context) - def pre_start_hook(self): + def pre_start_hook(self, **kwargs): """After the service is initialized, but before we fully bring the service up by listening on RPC queues, make sure to update our available resources. diff --git a/nova/manager.py b/nova/manager.py index 8beae2732e..6904718147 100644 --- a/nova/manager.py +++ b/nova/manager.py @@ -189,7 +189,7 @@ class Manager(base.Base): """ pass - def pre_start_hook(self): + def pre_start_hook(self, **kwargs): """Hook to provide the manager the ability to do additional start-up work before any RPC queues/consumers are created. This is called after other initialization has succeeded and a service diff --git a/nova/service.py b/nova/service.py index 109fbc06c7..c2b9022bed 100644 --- a/nova/service.py +++ b/nova/service.py @@ -400,8 +400,6 @@ class Service(object): except exception.NotFound: self._create_service_ref(ctxt) - self.manager.pre_start_hook() - if self.backdoor_port is not None: self.manager.backdoor_port = self.backdoor_port @@ -409,6 +407,8 @@ class Service(object): LOG.debug(_("Creating Consumer connection for Service %s") % self.topic) + self.manager.pre_start_hook(rpc_connection=self.conn) + rpc_dispatcher = self.manager.create_rpc_dispatcher() # Share this same connection for these Consumers diff --git a/nova/tests/test_service.py b/nova/tests/test_service.py index a1a28d05a4..eef2d23e0c 100644 --- a/nova/tests/test_service.py +++ b/nova/tests/test_service.py @@ -159,7 +159,7 @@ class ServiceTestCase(test.TestCase): self._service_start_mocks() # pre_start_hook is called after service record is created, # but before RPC consumer is created - self.manager_mock.pre_start_hook() + self.manager_mock.pre_start_hook(rpc_connection=mox.IgnoreArg()) self.manager_mock.create_rpc_dispatcher() # post_start_hook is called after RPC consumer is created. self.manager_mock.post_start_hook()