Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed preemptive RPC timeout. #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions reddwarf/guestagent/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from reddwarf.common import config
from reddwarf.common import exception
from reddwarf.common import utils
from reddwarf.guestagent import models as agent_models


LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -55,6 +54,8 @@ def _call(self, method_name, timeout_sec, **kwargs):
LOG.error(e)
raise exception.GuestError(original_message=str(e))
except Timeout as t:
LOG.error("Error occurred during RPC call for %s:" % method_name)
LOG.error(t)
if t is not timeout:
raise
else:
Expand All @@ -67,6 +68,7 @@ def _cast(self, method_name, **kwargs):
rpc.cast(self.context, self._get_routing_key(),
{'method': method_name, 'args': kwargs})
except Exception as e:
LOG.error("Error occurred during RPC cast for %s:" % method_name)
LOG.error(e)
raise exception.GuestError(original_message=str(e))

Expand All @@ -75,6 +77,8 @@ def _cast_with_consumer(self, method_name, **kwargs):
rpc.cast_with_consumer(self.context, self._get_routing_key(),
{'method': method_name, 'args': kwargs})
except Exception as e:
LOG.error("Error occurred during RPC cast_with_consumer for %s:"
% method_name)
LOG.error(e)
raise exception.GuestError(original_message=str(e))

Expand All @@ -86,16 +90,6 @@ def _get_routing_key(self):
"""Create the routing key based on the container id"""
return "guestagent.%s" % self.id

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()

def create_user(self, users):
"""Make an asynchronous call to create a new database user"""
LOG.debug(_("Creating Users for Instance %s"), self.id)
Expand Down Expand Up @@ -192,7 +186,6 @@ def upgrade(self):
def get_volume_info(self):
"""Make a synchronous call to get volume info for the container"""
LOG.debug(_("Check Volume Info on Instance %s"), self.id)
self._check_for_hearbeat()
return self._call("get_filesystem_stats", AGENT_LOW_TIMEOUT,
fs_path="/var/lib/mysql")

Expand Down