summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell Bryant <rbryant@redhat.com>2012-11-19 16:17:30 -0500
committerRussell Bryant <rbryant@redhat.com>2012-11-19 16:51:05 -0500
commit3349417edfd86d995b144588059aa1c8d8e25a9d (patch)
tree0e44edeecb37bc6803776662a86f9a7eeb59f868
parentc1d7dd7af8b13b9f9baf589f2e58ba2f8afef75b (diff)
Pass rpc connection to pre_start_hook.
The pre_start_hook allows a manager to perform some additional service setup before the service starts reading messages from message queues. This patch moves the hook just a bit so that it's after creating the rpc connection, but before creating the default queues, and most importantly still before the service starts reading from the queues. The pre_start_hook now gets the rpc_connection as an argument. That will allow this hook to set up some additional queues beyond the ones that are set up by default in the base service code. Change-Id: I5bf7795fca21627566ef4f688d45dc83bb953d1b
-rw-r--r--nova/compute/manager.py2
-rw-r--r--nova/manager.py2
-rw-r--r--nova/service.py4
-rw-r--r--nova/tests/test_service.py2
4 files changed, 5 insertions, 5 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 0ad3cfc77..551ed1387 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 8beae2732..690471814 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 109fbc06c..c2b9022be 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 a1a28d05a..eef2d23e0 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()