def start(self): LOG.debug("Creating RPC server for service %s", self.topic) target = messaging.Target(topic=self.topic, server=self.host, version=self.rpc_api_version) if not hasattr(self.manager_impl, 'target'): self.manager_impl.target = target endpoints = [self.manager_impl] self.rpcserver = rpc.get_server( target, endpoints, key=self.key, secure_serializer=self.secure_serializer) self.rpcserver.start() # TODO(hub-cap): Currently the context is none... do we _need_ it here? report_interval = CONF.report_interval if report_interval > 0: pulse = loopingcall.FixedIntervalLoopingCall( self.manager_impl.run_periodic_tasks, context=None) pulse.start(interval=report_interval, initial_delay=report_interval) pulse.wait()
def _create_guest_queue(self): """Call to construct, start and immediately stop rpc server in order to create a queue to communicate with the guestagent. This is method do nothing in case a queue is already created by the guest """ server = None target = messaging.Target(topic=self._get_routing_key(), server=self.id, version=rpc_version.RPC_API_VERSION) try: server = rpc.get_server(target, []) server.start() finally: if server is not None: server.stop()
def _create_guest_queue(self): """Call to construct, start and immediately stop rpc server in order to create a queue to communicate with the guestagent. This is method do nothing in case a queue is already created by the guest """ from trove.instance.models import DBInstance server = None target = messaging.Target(topic=self._get_routing_key(), server=self.id, version=self.API_BASE_VERSION) try: instance = DBInstance.get_by(id=self.id) instance_key = instance.key if instance else None server = rpc.get_server(target, [], key=instance_key) server.start() finally: if server is not None: server.stop() server.wait()
def start(self): LOG.debug("Creating RPC server for service %s", self.topic) target = messaging.Target(topic=self.topic, server=self.host, version=self.rpc_api_version) if not hasattr(self.manager_impl, 'target'): self.manager_impl.target = target endpoints = [self.manager_impl] self.rpcserver = rpc.get_server(target, endpoints) self.rpcserver.start() # TODO(hub-cap): Currently the context is none... do we _need_ it here? if self.report_interval > 0: pulse = loopingcall.FixedIntervalLoopingCall( self.manager_impl.run_periodic_tasks, context=None) pulse.start(interval=self.report_interval, initial_delay=self.report_interval) pulse.wait()