Пример #1
0
 def _check_for_hearbeat(self):
     """Preemptively raise GuestTimeout if heartbeat is old."""
     try:
         agent = agent_models.AgentHeartBeat.find_by(instance_id=self.id)
         if agent_models.AgentHeartBeat.is_active(agent):
             return True
     except exception.ModelNotFoundError as mnfe:
         LOG.warn(mnfe)
     raise exception.GuestTimeout()
Пример #2
0
    def _call(self, method_name, timeout_sec, **kwargs):
        LOG.debug("Calling %s with timeout %s" % (method_name, timeout_sec))
        try:
            result = self.call(self.context,
                               self.make_msg(method_name, **kwargs),
                               timeout=timeout_sec)

            LOG.debug("Result is %s" % result)
            return result
        except Exception as e:
            LOG.error(e)
            raise exception.GuestError(original_message=str(e))
        except Timeout as t:
            if t is not timeout:
                raise
            else:
                raise exception.GuestTimeout()
Пример #3
0
    def _call(self, method_name, timeout_sec, **kwargs):
        LOG.debug("Calling %s" % method_name)

        timeout = Timeout(timeout_sec)
        try:
            result = rpc.call(self.context, self._get_routing_key(), {
                'method': method_name,
                'args': kwargs
            })
            LOG.debug("Result is %s" % result)
            return result
        except Exception as e:
            LOG.error(e)
            raise exception.GuestError(original_message=str(e))
        except Timeout as t:
            if t is not timeout:
                raise
            else:
                raise exception.GuestTimeout()
        finally:
            timeout.cancel()