Reviewed: https://review.opendev.org/733827 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=e567adf7f6f27f51cda3cd3422df462148f27b90 Submitter: Zuul Branch: master
commit e567adf7f6f27f51cda3cd3422df462148f27b90 Author: Stephen Finucane <[email protected]> Date: Fri Jun 5 11:22:07 2020 +0100 Correct reported system memory In Python 3.3+, 'sys.platform' no longer includes a major version [1]: issue 12326: On Linux, sys.platform doesn't contain the major version anymore. It is now always 'linux', instead of 'linux2' or 'linux3' depending on the Linux version used to build Python. Replace sys.platform == 'linux2' with sys.platform.startswith('linux'), or directly sys.platform == 'linux' if you don't need to support older Python versions. Since we only care about Python 3.6 or greater, we could simply check for 'linux'. However, the libvirt driver isn't supported on non-Linux hosts so this was always a dumb check. Simply remove it instead. [1] https://docs.python.org/3.3/whatsnew/3.3.html#porting-python-code Change-Id: I207a6c8c8cf562477792c69e353ba99b3ec4cb5e Signed-off-by: Stephen Finucane <[email protected]> Closes-Bug: #1882233 ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1882233 Title: Libvirt driver always reports 'memory_mb_used' of 0 Status in OpenStack Compute (nova): Fix Released Bug description: The nova-compute service periodically logs a summary of the free RAM, disk and vCPUs as reported by the hypervisor. For example: Hypervisor/Node resource view: name=vtpm-f31.novalocal free_ram=7960MB free_disk=11.379043579101562GB free_vcpus=7 pci_devices=[{...}] On a recent deployment using the libvirt driver, it's observed that the 'free_ram' value never changes despite instances being created and destroyed. This is because the 'get_memory_mb_used' function in 'nova.virt.libvirt.host' always returns 0 unless the host platform - reported by 'sys.platform' is either 'linux2' or 'linux3'. Since Python 3.3, the major version is not included in this return value since it was misleading. This is low priority because the value only appears to be used for logging purposes and the values stored in e.g. the 'ComputeNode' object and reported to placement are calculated based on config options and number of instances on the node. We may wish to stop reporting this information instead. [1] https://stackoverflow.com/a/10429736/613428 To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1882233/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

