Exemplo n.º 1
0
 def __init__(self, engine_id):
     _client = rpc_messaging.get_rpc_client(
         topic=rpc_api.LISTENER_TOPIC,
         version=self.BASE_RPC_API_VERSION,
         server=engine_id)
     self._client = _client.prepare(
         timeout=cfg.CONF.engine_life_check_timeout)
Exemplo n.º 2
0
 def __init__(self, engine_id):
     _client = rpc_messaging.get_rpc_client(
         topic=rpc_api.LISTENER_TOPIC,
         version=self.BASE_RPC_API_VERSION,
         server=engine_id)
     self._client = _client.prepare(
         timeout=cfg.CONF.engine_life_check_timeout)
Exemplo n.º 3
0
 def engine_alive(context, engine_id):
     client = rpc_messaging.get_rpc_client(version='1.0', topic=engine_id)
     client_context = client.prepare(
         timeout=cfg.CONF.engine_life_check_timeout)
     try:
         return client_context.call(context, 'listening')
     except messaging.MessagingTimeout:
         return False
Exemplo n.º 4
0
 def engine_alive(context, engine_id):
     client = rpc_messaging.get_rpc_client(version='1.0', topic=engine_id)
     client_context = client.prepare(
         timeout=cfg.CONF.engine_life_check_timeout)
     try:
         return client_context.call(context, 'listening')
     except messaging.MessagingTimeout:
         return False
Exemplo n.º 5
0
    def cancel_check_resource(self, ctxt, stack_id, engine_id):
        """Send check-resource cancel message.

        Sends a cancel message to given heat engine worker.
        """

        _client = messaging.get_rpc_client(topic=worker_api.TOPIC,
                                           version=self.BASE_RPC_API_VERSION,
                                           server=engine_id)

        method, kwargs = self.make_msg('cancel_check_resource',
                                       stack_id=stack_id)
        cl = _client.prepare(version='1.3')
        cl.cast(ctxt, method, **kwargs)
Exemplo n.º 6
0
    def test_stack_cancel_update_different_engine(self):
        stack_name = "service_update_stack_test_cancel_different_engine"
        stk = tools.get_stack(stack_name, self.ctx)
        stk.state_set(stk.UPDATE, stk.IN_PROGRESS, "test_override")
        stk.disable_rollback = False
        stk.store()
        self.patchobject(stack.Stack, "load", return_value=stk)
        self.patchobject(stack_lock.StackLock, "try_acquire", return_value=str(uuid.uuid4()))
        self.patchobject(stack_lock.StackLock, "engine_alive", return_value=True)
        self.man.listener = mock.Mock()
        self.man.listener.SEND = "send"
        self.man._client = messaging.get_rpc_client(version=self.man.RPC_API_VERSION)

        # In fact the another engine is not alive, so the call will timeout
        self.assertRaises(dispatcher.ExpectedException, self.man.stack_cancel_update, self.ctx, stk.identifier())
Exemplo n.º 7
0
    def cancel_check_resource(self, ctxt, stack_id, engine_id):
        """Send check-resource cancel message.

        Sends a cancel message to given heat engine worker.
        """

        _client = messaging.get_rpc_client(
            topic=worker_api.TOPIC,
            version=self.BASE_RPC_API_VERSION,
            server=engine_id)

        method, kwargs = self.make_msg('cancel_check_resource',
                                       stack_id=stack_id)
        cl = _client.prepare(version='1.3')
        cl.cast(ctxt, method, **kwargs)
Exemplo n.º 8
0
    def start(self):
        self.engine_id = stack_lock.StackLock.generate_engine_id()
        self.thread_group_mgr = ThreadGroupManager()
        self.listener = EngineListener(self.host, self.engine_id,
                                       self.thread_group_mgr)
        LOG.debug("Starting listener for engine %s" % self.engine_id)
        self.listener.start()
        target = messaging.Target(
            version=self.RPC_API_VERSION, server=cfg.CONF.host,
            topic=self.topic)
        self.target = target
        server = rpc_messaging.get_rpc_server(target, self)
        server.start()
        self._client = rpc_messaging.get_rpc_client(
            version=self.RPC_API_VERSION)

        super(EngineService, self).start()
Exemplo n.º 9
0
    def start(self):
        self.engine_id = stack_lock.StackLock.generate_engine_id()
        self.thread_group_mgr = ThreadGroupManager()
        self.listener = EngineListener(self.host, self.engine_id,
                                       self.thread_group_mgr)
        LOG.debug("Starting listener for engine %s" % self.engine_id)
        self.listener.start()
        target = messaging.Target(version=self.RPC_API_VERSION,
                                  server=cfg.CONF.host,
                                  topic=self.topic)
        self.target = target
        server = rpc_messaging.get_rpc_server(target, self)
        server.start()
        self._client = rpc_messaging.get_rpc_client(
            version=self.RPC_API_VERSION)

        super(EngineService, self).start()
Exemplo n.º 10
0
    def test_stack_cancel_update_different_engine(self):
        stack_name = 'service_update_stack_test_cancel_different_engine'
        stk = tools.get_stack(stack_name, self.ctx)
        stk.state_set(stk.UPDATE, stk.IN_PROGRESS, 'test_override')
        stk.disable_rollback = False
        stk.store()
        self.patchobject(stack.Stack, 'load', return_value=stk)
        self.patchobject(stack_lock.StackLock,
                         'try_acquire',
                         return_value=str(uuid.uuid4()))
        self.patchobject(service_utils, 'engine_alive', return_value=True)
        self.man.listener = mock.Mock()
        self.man.listener.SEND = 'send'
        self.man._client = messaging.get_rpc_client(
            version=self.man.RPC_API_VERSION)

        # In fact the another engine is not alive, so the call will timeout
        self.assertRaises(dispatcher.ExpectedException,
                          self.man.stack_cancel_update, self.ctx,
                          stk.identifier())
Exemplo n.º 11
0
 def __init__(self):
     self._client = messaging.get_rpc_client(
         topic=rpc_api.ENGINE_TOPIC,
         version=self.BASE_RPC_API_VERSION)
Exemplo n.º 12
0
 def __init__(self):
     self._client = messaging.get_rpc_client(
         topic=worker_api.TOPIC, version=self.BASE_RPC_API_VERSION)
Exemplo n.º 13
0
 def __init__(self):
     self._client = messaging.get_rpc_client(
         topic="Gcloud_task",
         version=self.BASE_RPC_API_VERSION)