add check before adding cpus to cpuset_reserved
There are some cases where None value is set to cpuset_reserved in InstanceNUMATopology at _numa_fit_instance_cell() function in hardware.py. However, libvirt driver treat cpuset_reserved value as an iterate object when it constructs xml configuration. To avoid a risk to get an error in libvirt driver, this patch adds a check to see if the value is not None before adding the cpus for emulator threads. Conflicts: nova/virt/libvirt/driver.py The conflict is due tof0620a01de
Change-Id: Iab3d950c4f4138118ac6a9fd98407eaadcb24d9e Closes-Bug: #1746674 (cherry picked from commit24d9e06ec6
)
This commit is contained in:
parent
9037eb9f61
commit
2dc4d7a366
|
@ -3084,8 +3084,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
id=1, cpuset=set([2, 3]),
|
id=1, cpuset=set([2, 3]),
|
||||||
memory=1024, pagesize=2048,
|
memory=1024, pagesize=2048,
|
||||||
cpu_policy=fields.CPUAllocationPolicy.DEDICATED,
|
cpu_policy=fields.CPUAllocationPolicy.DEDICATED,
|
||||||
cpu_pinning={2: 7, 3: 8},
|
cpu_pinning={2: 7, 3: 8})])
|
||||||
cpuset_reserved=set([]))])
|
|
||||||
|
|
||||||
instance_ref = objects.Instance(**self.test_instance)
|
instance_ref = objects.Instance(**self.test_instance)
|
||||||
instance_ref.numa_topology = instance_topology
|
instance_ref.numa_topology = instance_topology
|
||||||
|
|
|
@ -4402,8 +4402,9 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||||
else:
|
else:
|
||||||
pin_cpuset.cpuset = host_cell.cpuset
|
pin_cpuset.cpuset = host_cell.cpuset
|
||||||
if emulator_threads_isolated:
|
if emulator_threads_isolated:
|
||||||
emupcpus.extend(
|
if object_numa_cell.cpuset_reserved:
|
||||||
object_numa_cell.cpuset_reserved)
|
emupcpus.extend(
|
||||||
|
object_numa_cell.cpuset_reserved)
|
||||||
elif not wants_realtime or cpu not in vcpus_rt:
|
elif not wants_realtime or cpu not in vcpus_rt:
|
||||||
# - If realtime IS NOT enabled, the
|
# - If realtime IS NOT enabled, the
|
||||||
# emulator threads are allowed to float
|
# emulator threads are allowed to float
|
||||||
|
|
Loading…
Reference in New Issue