From c680b0d9d31dd5ff22ee15e6900ca0cff2dff90e Mon Sep 17 00:00:00 2001 From: Alvaro Lopez Garcia Date: Thu, 23 Oct 2014 18:16:42 +0200 Subject: [PATCH] host manager: Log the host generating the warning Currently we are logging a warning when there's a discrepancy between the host's available disk stored in the database and the disk reported by the compute node, but there's no information about which host generates that error. Change-Id: I8d6704fa76f2750e0e986b8399f9fe358b3fad93 --- nova/scheduler/host_manager.py | 8 +++++--- nova/tests/scheduler/test_host_manager.py | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/nova/scheduler/host_manager.py b/nova/scheduler/host_manager.py index 13a6bcaab4c1..1d7814561e83 100644 --- a/nova/scheduler/host_manager.py +++ b/nova/scheduler/host_manager.py @@ -182,9 +182,11 @@ class HostState(object): if least_gb is not None: if least_gb > free_gb: # can occur when an instance in database is not on host - LOG.warn(_LW("Host has more disk space than database " - "expected (%(physical)sgb > %(database)sgb)"), - {'physical': least_gb, 'database': free_gb}) + LOG.warn(_LW("Host %(hostname)s has more disk space than " + "database expected " + "(%(physical)sgb > %(database)sgb)"), + {'physical': least_gb, 'database': free_gb, + 'hostname': compute['hypervisor_hostname']}) free_gb = min(least_gb, free_gb) free_disk_mb = free_gb * 1024 diff --git a/nova/tests/scheduler/test_host_manager.py b/nova/tests/scheduler/test_host_manager.py index 74ca092f312f..ec28e2d95970 100644 --- a/nova/tests/scheduler/test_host_manager.py +++ b/nova/tests/scheduler/test_host_manager.py @@ -282,10 +282,11 @@ class HostManagerTestCase(test.NoDBTestCase): db.compute_node_get_all(context).AndReturn(fakes.COMPUTE_NODES) # node 3 host physical disk space is greater than database - host_manager.LOG.warn(_LW("Host has more disk space than database " - "expected (%(physical)sgb > " + host_manager.LOG.warn(_LW("Host %(hostname)s has more disk space than " + "database expected (%(physical)sgb > " "%(database)sgb)"), - {'physical': 3333, 'database': 3072}) + {'physical': 3333, 'database': 3072, + 'hostname': 'node3'}) # Invalid service host_manager.LOG.warn(_LW("No service for compute ID %s"), 5)