Commit 71cbef51 authored by Hrvoje Ribicic's avatar Hrvoje Ribicic
Browse files

Fix curious psutil lint error



To expose certain attributes, the psutil module performs python magic
that results in an attribute being present in the module, but not in
the __all__ list. As pylint uses the __all__ list to determine whether
property accesses are errors, it is understandably confused about this
state of affairs.

To fix this, we just use the newer cpu_count attribute which is
supposed to replace NUM_CPUS anyway.
Signed-off-by: default avatarHrvoje Ribicic <riba@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent af9b62d7
......@@ -725,7 +725,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
target_process = psutil.Process(process_id)
if cpus == constants.CPU_PINNING_OFF:
target_process.set_cpu_affinity(range(psutil.NUM_CPUS))
target_process.set_cpu_affinity(range(psutil.cpu_count()))
else:
target_process.set_cpu_affinity(cpus)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment