diff --git a/cinder/manager.py b/cinder/manager.py index 7bd679bb17d..226c71c6752 100644 --- a/cinder/manager.py +++ b/cinder/manager.py @@ -86,7 +86,19 @@ class Manager(base.Base, periodic_task.PeriodicTasks): def init_host(self): """Handle initialization if this is a standalone service. - Child classes should override this method. + A hook point for services to execute tasks before the services are made + available (i.e. showing up on RPC and starting to accept RPC calls) to + other components. Child classes should override this method. + + """ + pass + + def init_host_with_rpc(self): + """A hook for service to do jobs after RPC is ready. + + Like init_host(), this method is a hook where services get a chance + to execute tasks that *need* RPC. Child classes should override + this method. """ pass diff --git a/cinder/scheduler/manager.py b/cinder/scheduler/manager.py index c07a1268af6..9981750ab70 100644 --- a/cinder/scheduler/manager.py +++ b/cinder/scheduler/manager.py @@ -74,7 +74,7 @@ class SchedulerManager(manager.Manager): self.driver = importutils.import_object(scheduler_driver) super(SchedulerManager, self).__init__(*args, **kwargs) - def init_host(self): + def init_host_with_rpc(self): ctxt = context.get_admin_context() self.request_service_capabilities(ctxt) diff --git a/cinder/service.py b/cinder/service.py index 4d74db81cd1..12f81754e3a 100644 --- a/cinder/service.py +++ b/cinder/service.py @@ -159,6 +159,8 @@ class Service(service.Service): self.rpcserver = rpc.get_server(target, endpoints, serializer) self.rpcserver.start() + self.manager.init_host_with_rpc() + if self.report_interval: pulse = loopingcall.FixedIntervalLoopingCall( self.report_state)