From fd6085fd35b4a9c02154fa0a4f1589005b27e286 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Thu, 11 Feb 2016 03:36:51 +0200 Subject: [PATCH] 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 --- nova/virt/hardware.py | 10 +++++----- tests-py3.txt | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/nova/virt/hardware.py b/nova/virt/hardware.py index 212bde7fdc8a..33c05110acc8 100644 --- a/nova/virt/hardware.py +++ b/nova/virt/hardware.py @@ -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 diff --git a/tests-py3.txt b/tests-py3.txt index 2dc4c0fc3d1a..5e96e4b8b93c 100644 --- a/tests-py3.txt +++ b/tests-py3.txt @@ -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