diff options
author | Balazs Gibizer <gibi@redhat.com> | 2022-10-26 13:28:47 +0200 |
---|---|---|
committer | Balazs Gibizer <gibi@redhat.com> | 2022-12-13 09:42:46 +0100 |
commit | cffe3971ce585a1ddc374a3ed067347857338831 (patch) | |
tree | c36622eceade17e43fb912cfcf3be8b0e3c3f2e1 /nova/virt/hardware.py | |
parent | 182c5be122868d4fe910309a868b044b0e71316b (diff) | |
download | nova-cffe3971ce585a1ddc374a3ed067347857338831.tar.gz |
Handle zero pinned CPU in a cell with mixed policy
When cpu_policy is mixed the scheduler tries to find a valid CPU pinning
for each instance NUMA cell. However if there is an instance NUMA cell
that does not request any pinned CPUs then such logic will calculate
empty pinning information for that cell. Then the scheduler logic
wrongly assumes that an empty pinning result means there was no valid
pinning. However there is difference between a None result when no valid
pinning found, from an empty result [] which means there was nothing to
pin.
This patch makes sure that pinning == None is differentiated from
pinning == [].
Closes-Bug: #1994526
Change-Id: I5a35a45abfcfbbb858a94927853777f112e73e5b
Diffstat (limited to 'nova/virt/hardware.py')
-rw-r--r-- | nova/virt/hardware.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/nova/virt/hardware.py b/nova/virt/hardware.py index 271a719aa2..def72b97d1 100644 --- a/nova/virt/hardware.py +++ b/nova/virt/hardware.py @@ -869,7 +869,7 @@ def _pack_instance_onto_cores(host_cell, instance_cell, instance_cell.pcpuset) cpuset_reserved = _get_reserved( sibling_sets[1], pinning, num_cpu_reserved=num_cpu_reserved) - if not pinning or (num_cpu_reserved and not cpuset_reserved): + if pinning is None or (num_cpu_reserved and not cpuset_reserved): continue break @@ -895,7 +895,7 @@ def _pack_instance_onto_cores(host_cell, instance_cell, cpuset_reserved = _get_reserved( sibling_set, pinning, num_cpu_reserved=num_cpu_reserved) - if not pinning or (num_cpu_reserved and not cpuset_reserved): + if pinning is None or (num_cpu_reserved and not cpuset_reserved): return LOG.debug('Selected cores for pinning: %s, in cell %s', pinning, host_cell.id) @@ -2590,8 +2590,10 @@ def numa_usage_from_instance_numa(host_topology, instance_topology, None, fields.CPUAllocationPolicy.SHARED, ): continue - - pinned_cpus = set(instance_cell.cpu_pinning.values()) + if instance_cell.cpu_pinning: + pinned_cpus = set(instance_cell.cpu_pinning.values()) + else: + pinned_cpus = set() if instance_cell.cpuset_reserved: pinned_cpus |= instance_cell.cpuset_reserved |