numa: Fixes NUMA topology related unit tests

Converts iterable objects to lists.
Replaces / division with //, in order to maintain
compatibility between python 2.7 and 3.4.
Enables some unit tests.

Partially Implements: blueprint goal-python35

Change-Id: I3ac5c5c6e8ac39d03e785e9b5e2ec790d5763484
This commit is contained in:
Claudiu Belu 2016-02-11 03:36:51 +02:00
parent 6383894a33
commit fd6085fd35
2 changed files with 5 additions and 7 deletions

View File

@ -743,8 +743,8 @@ def _pack_instance_onto_cores(available_siblings,
usable_cores = map(lambda s: list(s)[:threads_no], sibling_set)
return zip(sorted(instance_cores),
itertools.chain(*usable_cores))
return list(zip(sorted(instance_cores),
itertools.chain(*usable_cores)))
if (instance_cell.cpu_thread_policy ==
fields.CPUThreadAllocationPolicy.REQUIRE):
@ -801,8 +801,8 @@ def _pack_instance_onto_cores(available_siblings,
if (instance_cell.cpu_thread_policy !=
fields.CPUThreadAllocationPolicy.REQUIRE and
not pinning):
pinning = zip(sorted(instance_cell.cpuset),
itertools.chain(*sibling_set))
pinning = list(zip(sorted(instance_cell.cpuset),
itertools.chain(*sibling_set)))
threads_no = _threads(instance_cell, threads_no)
@ -810,7 +810,7 @@ def _pack_instance_onto_cores(available_siblings,
return
topology = objects.VirtCPUTopology(sockets=1,
cores=len(pinning) / threads_no,
cores=len(pinning) // threads_no,
threads=threads_no)
instance_cell.pin_vcpus(*pinning)
instance_cell.cpu_topology = topology

View File

@ -68,8 +68,6 @@ nova.tests.unit.virt.libvirt.test_imagecache.ImageCacheManagerTestCase
nova.tests.unit.virt.libvirt.test_imagecache.VerifyChecksumTestCase
nova.tests.unit.virt.libvirt.test_utils.LibvirtUtilsTestCase
nova.tests.unit.virt.libvirt.test_vif.LibvirtVifTestCase
nova.tests.unit.virt.test_hardware.CPUPinningCellTestCase
nova.tests.unit.virt.test_hardware.CPUPinningTestCase
nova.tests.unit.virt.test_virt_drivers.FakeConnectionTestCase
nova.tests.unit.virt.test_virt_drivers.LibvirtConnTestCase
nova.tests.unit.virt.vmwareapi.test_images.VMwareImagesTestCase