From e46019a6e52452554b85f5c40a6e4b069172cd9a Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 27 Sep 2018 15:32:36 +0100 Subject: [PATCH] Don't emit warning when ironic properties are zero If an ironic node is registered without either of the 'memory_mb' or 'cpus' properties, the following warning messages are seen in the nova-compute logs: Warning, memory usage is 0 for on baremetal node . Warning, number of cpus is 0 for on baremetal node . As of the Stein release [1], the standard compute resources (VCPU, MEMORY_MB, DISK_GB) are not registered with placement for ironic nodes. They were not required to be set since the Pike release, but still this warning is emitted. This change removes these warning messages. Backport: rocky, queens, pike [1] https://review.openstack.org/#/c/565841/ NOTE(mriedem): The original commit message on this change incorrectly said that [1] was made in Rocky but it was actually made in Stein. The important part is that the "memory_mb" and "cpus" properties on the node could be 0 since Pike and if they are 0, it just means that the related standard resource class inventory is not reported to the placement service and thus the warnings are noise. Change-Id: I342b9b12ec869431c3abad75eb8194c34151a281 Closes-Bug: #1794773 (cherry picked from commit 63b9c88386998bc584786ecb8ea7a2aae971a384) (cherry picked from commit 0794345ecd1d61efb7a0d321eb32844d2dd684d0) --- nova/virt/ironic/driver.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/nova/virt/ironic/driver.py b/nova/virt/ironic/driver.py index f02cbbdd2db7..d18056b80fa3 100644 --- a/nova/virt/ironic/driver.py +++ b/nova/virt/ironic/driver.py @@ -881,21 +881,6 @@ class IronicDriver(virt_driver.ComputeDriver): return hardware.InstanceInfo( state=map_power_state(ironic_states.NOSTATE)) - properties = self._parse_node_properties(node) - memory_kib = properties['memory_mb'] * 1024 - if memory_kib == 0: - LOG.warning("Warning, memory usage is 0 for " - "%(instance)s on baremetal node %(node)s.", - {'instance': instance.uuid, - 'node': instance.node}) - - num_cpu = properties['cpus'] - if num_cpu == 0: - LOG.warning("Warning, number of cpus is 0 for " - "%(instance)s on baremetal node %(node)s.", - {'instance': instance.uuid, - 'node': instance.node}) - return hardware.InstanceInfo(state=map_power_state(node.power_state)) def deallocate_networks_on_reschedule(self, instance):