Support psutil 5.0.1
An upper-constraints update to psutil caused IPA to start using psutil 5.0.1. We had a hard-coded assumption that psutil would be major version 1 or 2. This allows us to use the updated psutil and attempts to simply fail gracefully if an unrecognized psutil version is used. Change-Id: Ibe072440159561b34a29b478d955876e5fb7f103 Closes-Bug: 1659137
This commit is contained in:
ironic_python_agent
@ -598,6 +598,12 @@ class GenericHardwareManager(HardwareManager):
|
||||
total = int(psutil.TOTAL_PHYMEM)
|
||||
elif psutil.version_info[0] == 2:
|
||||
total = int(psutil.phymem_usage().total)
|
||||
elif psutil.version_info[0] == 5:
|
||||
total = int(psutil.virtual_memory().total)
|
||||
else:
|
||||
total = None
|
||||
LOG.warning("Cannot fetch total memory size: unsupported psutil "
|
||||
"version %s", psutil.version_info[0])
|
||||
|
||||
try:
|
||||
out, _e = utils.execute("dmidecode --type 17 | grep Size",
|
||||
|
Reference in New Issue
Block a user