summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-08-13 06:05:43 +0000
committerGerrit Code Review <review@openstack.org>2015-08-13 06:05:43 +0000
commit6838594dfb84d91173aaed315d976afd366ed5b2 (patch)
tree511fd6a0974554310daf8a933c55bcc0ecb8955d
parentcc6c50ee23f336d08e4fe833070943c0025a205d (diff)
parent624345b4962ca96dc0a009397bcee14b0e4fbf6b (diff)
downloadnova-6838594dfb84d91173aaed315d976afd366ed5b2.tar.gz
Merge "libvirt: Don't try to confine a non-NUMA instance" into stable/juno
-rw-r--r--nova/tests/virt/libvirt/test_driver.py13
-rw-r--r--nova/virt/libvirt/driver.py30
2 files changed, 10 insertions, 33 deletions
diff --git a/nova/tests/virt/libvirt/test_driver.py b/nova/tests/virt/libvirt/test_driver.py
index dfd00b754c..e3699fe18f 100644
--- a/nova/tests/virt/libvirt/test_driver.py
+++ b/nova/tests/virt/libvirt/test_driver.py
@@ -1209,11 +1209,9 @@ class LibvirtConnTestCase(test.TestCase):
objects.Flavor, "get_by_id", return_value=flavor),
mock.patch.object(conn, '_has_min_version', return_value=True),
mock.patch.object(
- conn, "_get_host_capabilities", return_value=caps),
- mock.patch.object(
- random, 'choice', side_effect=lambda cells: cells[0])):
+ conn, "_get_host_capabilities", return_value=caps)):
cfg = conn._get_guest_config(instance_ref, [], {}, disk_info)
- self.assertEqual(set([0, 1]), cfg.cpuset)
+ self.assertIsNone(cfg.cpuset)
self.assertIsNone(cfg.cputune)
self.assertIsNone(cfg.cpu.numa)
@@ -1272,15 +1270,12 @@ class LibvirtConnTestCase(test.TestCase):
mock.patch.object(
conn, "_get_host_capabilities", return_value=caps),
mock.patch.object(
- hardware, 'get_vcpu_pin_set', return_value=set([2, 3])),
- mock.patch.object(
- random, 'choice', side_effect=lambda cells: cells[0])
+ hardware, 'get_vcpu_pin_set', return_value=set([2, 3]))
) as (get_by_id_mock, has_min_version_mock, get_host_cap_mock,
- get_vcpu_pin_set_mock, choice_mock):
+ get_vcpu_pin_set_mock):
cfg = conn._get_guest_config(instance_ref, [], {}, disk_info)
# NOTE(ndipanov): we make sure that pin_set was taken into account
# when choosing viable cells
- choice_mock.assert_called_once_with([set([2, 3])])
self.assertEqual(set([2, 3]), cfg.cpuset)
self.assertIsNone(cfg.cputune)
self.assertIsNone(cfg.cpu.numa)
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index cf6cb3eca1..b7f465230a 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -31,7 +31,6 @@ import functools
import glob
import mmap
import os
-import random
import shutil
import socket
import sys
@@ -3750,29 +3749,12 @@ class LibvirtDriver(driver.ComputeDriver):
context, instance)
if not guest_cpu_numa:
- # No NUMA topology defined for instance
- vcpus = flavor.vcpus
- memory = flavor.memory_mb
- if topology:
- # Host is NUMA capable so try to keep the instance in a cell
- viable_cells_cpus = []
- for cell in topology.cells:
- if vcpus <= len(cell.cpuset) and memory <= cell.memory:
- viable_cells_cpus.append(cell.cpuset)
-
- if not viable_cells_cpus:
- # We can't contain the instance in a cell - do nothing for
- # now.
- # TODO(ndipanov): Attempt to spread the instance accross
- # NUMA nodes and expose the topology to the instance as an
- # optimisation
- return allowed_cpus, None, None
- else:
- pin_cpuset = random.choice(viable_cells_cpus)
- return pin_cpuset, None, None
- else:
- # We have no NUMA topology in the host either
- return allowed_cpus, None, None
+ # No NUMA topology defined for instance - let the host kernel deal
+ # with the NUMA effects.
+ # TODO(ndipanov): Attempt to spread the instance
+ # across NUMA nodes and expose the topology to the
+ # instance as an optimisation
+ return allowed_cpus, None, None
else:
if topology:
# Now get the CpuTune configuration from the numa_topology