Add service binary/host to service is down log for context
When we're logging that a service appears to be down in the DB service group drive, add the service binary and host to the message for context. Change-Id: I8f676f7b498f4d7cb9b574a401ec892c2a3aacd3 Related-Bug: #1549854
This commit is contained in:
parent
8974a30914
commit
d1cc60a215
@ -75,9 +75,11 @@ class DbDriver(base.Driver):
|
|||||||
elapsed = timeutils.delta_seconds(last_heartbeat, timeutils.utcnow())
|
elapsed = timeutils.delta_seconds(last_heartbeat, timeutils.utcnow())
|
||||||
is_up = abs(elapsed) <= self.service_down_time
|
is_up = abs(elapsed) <= self.service_down_time
|
||||||
if not is_up:
|
if not is_up:
|
||||||
LOG.debug('Seems service is down. Last heartbeat was %(lhb)s. '
|
LOG.debug('Seems service %(binary)s on host %(host)s is down. '
|
||||||
'Elapsed time is %(el)s',
|
'Last heartbeat was %(lhb)s. Elapsed time is %(el)s',
|
||||||
{'lhb': str(last_heartbeat), 'el': str(elapsed)})
|
{'binary': service_ref.get('binary'),
|
||||||
|
'host': service_ref.get('host'),
|
||||||
|
'lhb': str(last_heartbeat), 'el': str(elapsed)})
|
||||||
return is_up
|
return is_up
|
||||||
|
|
||||||
def _report_state(self, service):
|
def _report_state(self, service):
|
||||||
|
@ -92,7 +92,8 @@ def _fake_service_get_all_by_binary_nodedown(cls, context, binary):
|
|||||||
return objects.Service(host=host,
|
return objects.Service(host=host,
|
||||||
disabled=False,
|
disabled=False,
|
||||||
forced_down=False,
|
forced_down=False,
|
||||||
last_seen_up=last_seen)
|
last_seen_up=last_seen,
|
||||||
|
binary=binary)
|
||||||
|
|
||||||
return [_service(*fake) for fake in FAKE_SERVICES]
|
return [_service(*fake) for fake in FAKE_SERVICES]
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ class DBServiceGroupTestCase(test.NoDBTestCase):
|
|||||||
service = objects.Service(
|
service = objects.Service(
|
||||||
host='fake-host',
|
host='fake-host',
|
||||||
topic='compute',
|
topic='compute',
|
||||||
|
binary='nova-compute',
|
||||||
created_at=now,
|
created_at=now,
|
||||||
updated_at=now,
|
updated_at=now,
|
||||||
last_seen_up=now,
|
last_seen_up=now,
|
||||||
|
Loading…
Reference in New Issue
Block a user