objects: remove default values for numa cell
The default values was introduced to avoid the necessity to update all tests when new fields was added. This commit clean tests and remove the default values of the object. Change-Id: Ia22d91925912ff9572f543109e4d7bf89190ec0e
This commit is contained in:
parent
b41bda7b50
commit
a9757f5e17
|
@ -43,13 +43,6 @@ class NUMACell(base.NovaObject,
|
|||
'NUMAPagesTopology': [('1.2', '1.0')]
|
||||
}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(NUMACell, self).__init__(**kwargs)
|
||||
if 'pinned_cpus' not in kwargs:
|
||||
self.pinned_cpus = set()
|
||||
if 'siblings' not in kwargs:
|
||||
self.siblings = []
|
||||
|
||||
@property
|
||||
def free_cpus(self):
|
||||
return self.cpuset - self.pinned_cpus or set()
|
||||
|
@ -99,7 +92,7 @@ class NUMACell(base.NovaObject,
|
|||
cell_id = data_dict.get('id')
|
||||
return cls(id=cell_id, cpuset=cpuset, memory=memory,
|
||||
cpu_usage=cpu_usage, memory_usage=memory_usage,
|
||||
mempages=[])
|
||||
mempages=[], pinned_cpus=set([]), siblings=[])
|
||||
|
||||
def can_fit_hugepages(self, pagesize, memory):
|
||||
"""Returns whether memory can fit into hugepages size
|
||||
|
|
|
@ -124,10 +124,12 @@ class ClaimTestCase(test.NoDBTestCase):
|
|||
'numa_topology': objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=1, cpuset=set([1, 2]), memory=512,
|
||||
memory_usage=0, cpu_usage=0,
|
||||
mempages=[]),
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([])),
|
||||
objects.NUMACell(id=2, cpuset=set([3, 4]), memory=512,
|
||||
memory_usage=0, cpu_usage=0,
|
||||
mempages=[])]
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([]))]
|
||||
)._to_json()
|
||||
}
|
||||
if values:
|
||||
|
|
|
@ -47,9 +47,11 @@ FAKE_VIRT_MEMORY_WITH_OVERHEAD = (
|
|||
FAKE_VIRT_MEMORY_MB + FAKE_VIRT_MEMORY_OVERHEAD)
|
||||
FAKE_VIRT_NUMA_TOPOLOGY = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([1, 2]), memory=3072,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=1, cpuset=set([3, 4]), memory=3072,
|
||||
cpu_usage=0, memory_usage=0, mempages=[])])
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([]))])
|
||||
FAKE_VIRT_NUMA_TOPOLOGY_OVERHEAD = hardware.VirtNUMALimitTopology(
|
||||
cells=[hardware.VirtNUMATopologyCellLimit(
|
||||
0, set([1, 2]), 3072, 4, 10240),
|
||||
|
@ -823,10 +825,12 @@ class InstanceClaimTestCase(BaseTrackerTestCase):
|
|||
return objects.NUMATopology(
|
||||
cells=[objects.NUMACell(
|
||||
id=0, cpuset=set([1, 2]), memory=3072, cpu_usage=cpus,
|
||||
memory_usage=mem, mempages=[]),
|
||||
memory_usage=mem, mempages=[], siblings=[],
|
||||
pinned_cpus=set([])),
|
||||
objects.NUMACell(
|
||||
id=1, cpuset=set([3, 4]), memory=3072, cpu_usage=cpus,
|
||||
memory_usage=mem, mempages=[])])
|
||||
memory_usage=mem, mempages=[], siblings=[],
|
||||
pinned_cpus=set([]))])
|
||||
|
||||
@mock.patch('nova.objects.InstancePCIRequests.get_by_instance_uuid',
|
||||
return_value=objects.InstancePCIRequests(requests=[]))
|
||||
|
|
|
@ -33,9 +33,13 @@ fake_stats_db_format = jsonutils.dumps(fake_stats)
|
|||
fake_host_ip = '127.0.0.1'
|
||||
fake_numa_topology = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([1, 2]), memory=512,
|
||||
cpu_usage=0, memory_usage=0),
|
||||
cpu_usage=0, memory_usage=0,
|
||||
mempages=[], pinned_cpus=set([]),
|
||||
siblings=[]),
|
||||
objects.NUMACell(id=1, cpuset=set([3, 4]), memory=512,
|
||||
cpu_usage=0, memory_usage=0)])
|
||||
cpu_usage=0, memory_usage=0,
|
||||
mempages=[], pinned_cpus=set([]),
|
||||
siblings=[])])
|
||||
fake_numa_topology_db_format = fake_numa_topology._to_json()
|
||||
fake_hv_spec = hv_spec.HVSpec(arch='foo', hv_type='bar', vm_mode='foobar')
|
||||
fake_supported_hv_specs = [fake_hv_spec]
|
||||
|
|
|
@ -19,10 +19,14 @@ fake_obj_numa = objects.NUMATopology(
|
|||
cells=[
|
||||
objects.NUMACell(
|
||||
id=0, cpuset=set([1, 2]), memory=512,
|
||||
cpu_usage=2, memory_usage=256),
|
||||
cpu_usage=2, memory_usage=256,
|
||||
mempages=[], pinned_cpus=set([]),
|
||||
siblings=[]),
|
||||
objects.NUMACell(
|
||||
id=1, cpuset=set([3, 4]), memory=512,
|
||||
cpu_usage=1, memory_usage=128)])
|
||||
cpu_usage=1, memory_usage=128,
|
||||
mempages=[], pinned_cpus=set([]),
|
||||
siblings=[])])
|
||||
|
||||
|
||||
class _TestNUMA(object):
|
||||
|
@ -38,11 +42,13 @@ class _TestNUMA(object):
|
|||
objects.NUMACell(
|
||||
id=0, cpuset=set([1, 2]), memory=512,
|
||||
cpu_usage=2, memory_usage=256,
|
||||
pinned_cpus=set([1])),
|
||||
pinned_cpus=set([1]), siblings=[],
|
||||
mempages=[]),
|
||||
objects.NUMACell(
|
||||
id=1, cpuset=set([3, 4]), memory=512,
|
||||
cpu_usage=1, memory_usage=128,
|
||||
pinned_cpus=set([]))
|
||||
pinned_cpus=set([]), siblings=[],
|
||||
mempages=[])
|
||||
]
|
||||
)
|
||||
self.assertEqual(set([2]), obj.cells[0].free_cpus)
|
||||
|
@ -51,7 +57,8 @@ class _TestNUMA(object):
|
|||
def test_pinning_logic(self):
|
||||
numacell = objects.NUMACell(id=0, cpuset=set([1, 2, 3, 4]), memory=512,
|
||||
cpu_usage=2, memory_usage=256,
|
||||
pinned_cpus=set([1]))
|
||||
pinned_cpus=set([1]), siblings=[],
|
||||
mempages=[])
|
||||
numacell.pin_cpus(set([2, 3]))
|
||||
self.assertEqual(set([4]), numacell.free_cpus)
|
||||
self.assertRaises(exception.CPUPinningInvalid,
|
||||
|
@ -76,6 +83,7 @@ class _TestNUMA(object):
|
|||
def test_can_fit_hugepages(self):
|
||||
cell = objects.NUMACell(
|
||||
id=0, cpuset=set([1, 2]), memory=1024,
|
||||
siblings=[], pinned_cpus=set([]),
|
||||
mempages=[
|
||||
objects.NUMAPagesTopology(
|
||||
size_kb=4, total=1548736, used=0),
|
||||
|
@ -91,6 +99,10 @@ class _TestNUMA(object):
|
|||
exception.MemoryPageSizeNotSupported,
|
||||
cell.can_fit_hugepages, 12345, 2 ** 20)
|
||||
|
||||
def test_default_behavior(self):
|
||||
inst_cell = objects.NUMACell()
|
||||
self.assertEqual(0, len(inst_cell.obj_get_changes()))
|
||||
|
||||
|
||||
class TestNUMA(test_objects._LocalTest,
|
||||
_TestNUMA):
|
||||
|
|
|
@ -22,10 +22,12 @@ from nova.scheduler import host_manager
|
|||
NUMA_TOPOLOGY = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(
|
||||
id=0, cpuset=set([1, 2]), memory=512,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(
|
||||
id=1, cpuset=set([3, 4]), memory=512,
|
||||
cpu_usage=0, memory_usage=0, mempages=[])])
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([]))])
|
||||
|
||||
COMPUTE_NODES = [
|
||||
dict(id=1, local_gb=1024, memory_mb=1024, vcpus=1,
|
||||
|
|
|
@ -11663,10 +11663,14 @@ class HostStateTestCase(test.NoDBTestCase):
|
|||
numa_topology = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(
|
||||
id=1, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_usage=0, memory_usage=0),
|
||||
cpu_usage=0, memory_usage=0,
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([])),
|
||||
objects.NUMACell(
|
||||
id=2, cpuset=set([3, 4]), memory=1024,
|
||||
cpu_usage=0, memory_usage=0)])
|
||||
cpu_usage=0, memory_usage=0,
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([]))])
|
||||
|
||||
class FakeConnection(libvirt_driver.LibvirtDriver):
|
||||
"""Fake connection object."""
|
||||
|
|
|
@ -1086,12 +1086,15 @@ class NUMATopologyTest(test.NoDBTestCase):
|
|||
hosttopo = objects.NUMATopology(cells=[
|
||||
objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]), memory=1024,
|
||||
cpu_usage=0, memory_usage=0, mempages=[
|
||||
hpages0_4K, hpages0_2M]),
|
||||
hpages0_4K, hpages0_2M],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=1, cpuset=set([4, 6]), memory=512,
|
||||
cpu_usage=0, memory_usage=0, mempages=[
|
||||
hpages1_4K, hpages1_2M]),
|
||||
hpages1_4K, hpages1_2M],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=2, cpuset=set([5, 7]), memory=512,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
])
|
||||
instance1 = objects.InstanceNUMATopology(cells=[
|
||||
objects.InstanceNUMACell(id=0, cpuset=set([0, 1, 2]), memory=256),
|
||||
|
@ -1142,11 +1145,14 @@ class NUMATopologyTest(test.NoDBTestCase):
|
|||
def test_host_usage_sparse(self):
|
||||
hosttopo = objects.NUMATopology(cells=[
|
||||
objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]), memory=1024,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=5, cpuset=set([4, 6]), memory=512,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=6, cpuset=set([5, 7]), memory=512,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
])
|
||||
instance1 = objects.InstanceNUMATopology(cells=[
|
||||
objects.InstanceNUMACell(id=0, cpuset=set([0, 1, 2]), memory=256),
|
||||
|
@ -1195,11 +1201,14 @@ class NUMATopologyTest(test.NoDBTestCase):
|
|||
def test_host_usage_culmulative_with_free(self):
|
||||
hosttopo = objects.NUMATopology(cells=[
|
||||
objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]), memory=1024,
|
||||
cpu_usage=2, memory_usage=512, mempages=[]),
|
||||
cpu_usage=2, memory_usage=512, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=1, cpuset=set([4, 6]), memory=512,
|
||||
cpu_usage=1, memory_usage=512, mempages=[]),
|
||||
cpu_usage=1, memory_usage=512, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=2, cpuset=set([5, 7]), memory=256,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
])
|
||||
instance1 = objects.InstanceNUMATopology(cells=[
|
||||
objects.InstanceNUMACell(id=0, cpuset=set([0, 1, 2]), memory=512),
|
||||
|
@ -1235,9 +1244,11 @@ class NUMATopologyTest(test.NoDBTestCase):
|
|||
def test_topo_usage_none(self):
|
||||
hosttopo = objects.NUMATopology(cells=[
|
||||
objects.NUMACell(id=0, cpuset=set([0, 1]), memory=512,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=1, cpuset=set([2, 3]), memory=512,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
])
|
||||
instance1 = objects.InstanceNUMATopology(cells=[
|
||||
objects.InstanceNUMACell(id=0, cpuset=set([0, 1]), memory=256),
|
||||
|
@ -1275,10 +1286,12 @@ class NUMATopologyTest(test.NoDBTestCase):
|
|||
expected = objects.NUMATopology(
|
||||
cells=[
|
||||
objects.NUMACell(id=1, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_usage=0, memory_usage=0, mempages=[]),
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=2, cpuset=set([3, 4]), memory=1024,
|
||||
cpu_usage=0, memory_usage=0,
|
||||
mempages=[])])
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([]))])
|
||||
got = objects.NUMATopology.obj_from_db_obj(expected._to_json())
|
||||
|
||||
for exp_cell, got_cell in zip(expected.cells, got.cells):
|
||||
|
@ -1288,7 +1301,8 @@ class NUMATopologyTest(test.NoDBTestCase):
|
|||
class VirtNUMATopologyCellUsageTestCase(test.NoDBTestCase):
|
||||
def test_fit_instance_cell_success_no_limit(self):
|
||||
host_cell = objects.NUMACell(id=4, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_usage=0, memory_usage=0, mempages=[])
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([]))
|
||||
instance_cell = objects.InstanceNUMACell(
|
||||
id=0, cpuset=set([1, 2]), memory=1024)
|
||||
fitted_cell = hw._numa_fit_instance_cell(host_cell, instance_cell)
|
||||
|
@ -1299,7 +1313,8 @@ class VirtNUMATopologyCellUsageTestCase(test.NoDBTestCase):
|
|||
host_cell = objects.NUMACell(id=4, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_usage=2,
|
||||
memory_usage=1024,
|
||||
mempages=[])
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([]))
|
||||
limit_cell = hw.VirtNUMATopologyCellLimit(
|
||||
4, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_limit=4, memory_limit=2048)
|
||||
|
@ -1312,7 +1327,8 @@ class VirtNUMATopologyCellUsageTestCase(test.NoDBTestCase):
|
|||
|
||||
def test_fit_instance_cell_self_overcommit(self):
|
||||
host_cell = objects.NUMACell(id=4, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_usage=0, memory_usage=0, mempages=[])
|
||||
cpu_usage=0, memory_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([]))
|
||||
limit_cell = hw.VirtNUMATopologyCellLimit(
|
||||
4, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_limit=4, memory_limit=2048)
|
||||
|
@ -1326,7 +1342,8 @@ class VirtNUMATopologyCellUsageTestCase(test.NoDBTestCase):
|
|||
host_cell = objects.NUMACell(id=4, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_usage=2,
|
||||
memory_usage=1024,
|
||||
mempages=[])
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([]))
|
||||
limit_cell = hw.VirtNUMATopologyCellLimit(
|
||||
4, cpuset=set([1, 2]), memory=1024,
|
||||
cpu_limit=4, memory_limit=2048)
|
||||
|
@ -1351,10 +1368,12 @@ class VirtNUMAHostTopologyTestCase(test.NoDBTestCase):
|
|||
cells=[
|
||||
objects.NUMACell(id=1, cpuset=set([1, 2]), memory=2048,
|
||||
cpu_usage=2, memory_usage=2048,
|
||||
mempages=[]),
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([])),
|
||||
objects.NUMACell(id=2, cpuset=set([3, 4]), memory=2048,
|
||||
cpu_usage=2, memory_usage=2048,
|
||||
mempages=[])])
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([]))])
|
||||
|
||||
self.limits = hw.VirtNUMALimitTopology(
|
||||
cells=[
|
||||
|
@ -1500,9 +1519,11 @@ class HelperMethodsTestCase(test.NoDBTestCase):
|
|||
super(HelperMethodsTestCase, self).setUp()
|
||||
self.hosttopo = objects.NUMATopology(cells=[
|
||||
objects.NUMACell(id=0, cpuset=set([0, 1]), memory=512,
|
||||
memory_usage=0, cpu_usage=0, mempages=[]),
|
||||
memory_usage=0, cpu_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=1, cpuset=set([2, 3]), memory=512,
|
||||
memory_usage=0, cpu_usage=0, mempages=[]),
|
||||
memory_usage=0, cpu_usage=0, mempages=[],
|
||||
siblings=[], pinned_cpus=set([])),
|
||||
])
|
||||
self.instancetopo = objects.InstanceNUMATopology(
|
||||
instance_uuid='fake-uuid',
|
||||
|
@ -1655,7 +1676,8 @@ class VirtMemoryPagesTestCase(test.NoDBTestCase):
|
|||
mempages=[objects.NUMAPagesTopology(
|
||||
size_kb=2048,
|
||||
total=512,
|
||||
used=0)])
|
||||
used=0)],
|
||||
siblings=[], pinned_cpus=set([]))
|
||||
|
||||
topo = hw._numa_pagesize_usage_from_cell(hostcell, instcell, 1)
|
||||
self.assertEqual(2048, topo[0].size_kb)
|
||||
|
@ -1724,7 +1746,8 @@ class VirtMemoryPagesTestCase(test.NoDBTestCase):
|
|||
host_cell = objects.NUMACell(
|
||||
id=0, cpuset=set([0]), memory=1024, mempages=[
|
||||
objects.NUMAPagesTopology(size_kb=4, total=262144, used=0),
|
||||
])
|
||||
],
|
||||
siblings=[], pinned_cpus=set([]))
|
||||
|
||||
inst_cell = objects.InstanceNUMACell(
|
||||
id=0, cpuset=set([0]), memory=1024, pagesize=hw.MEMPAGES_SMALL)
|
||||
|
@ -1750,7 +1773,8 @@ class VirtMemoryPagesTestCase(test.NoDBTestCase):
|
|||
id=0, cpuset=set([0]), memory=1024, mempages=[
|
||||
objects.NUMAPagesTopology(size_kb=4, total=256, used=0),
|
||||
objects.NUMAPagesTopology(size_kb=2048, total=512, used=0)
|
||||
])
|
||||
],
|
||||
siblings=[], pinned_cpus=set([]))
|
||||
|
||||
self.assertEqual(
|
||||
2048,
|
||||
|
@ -1763,7 +1787,8 @@ class VirtMemoryPagesTestCase(test.NoDBTestCase):
|
|||
id=0, cpuset=set([0]), memory=1024, mempages=[
|
||||
objects.NUMAPagesTopology(size_kb=4, total=256, used=0),
|
||||
objects.NUMAPagesTopology(size_kb=2048, total=512, used=0)
|
||||
])
|
||||
],
|
||||
siblings=[], pinned_cpus=set([]))
|
||||
|
||||
self.assertEqual(
|
||||
2048,
|
||||
|
@ -1792,7 +1817,8 @@ class _CPUPinningTestCaseBase(object):
|
|||
class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
||||
def test_get_pinning_inst_too_large_cpu(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2]),
|
||||
memory=2048, memory_usage=0)
|
||||
memory=2048, memory_usage=0, siblings=[],
|
||||
mempages=[], pinned_cpus=set([]))
|
||||
inst_pin = objects.InstanceNUMACell(cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048)
|
||||
|
||||
|
@ -1801,7 +1827,9 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
|
||||
def test_get_pinning_inst_too_large_mem(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2]),
|
||||
memory=2048, memory_usage=1024)
|
||||
memory=2048, memory_usage=1024,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([]))
|
||||
inst_pin = objects.InstanceNUMACell(cpuset=set([0, 1, 2]),
|
||||
memory=2048)
|
||||
|
||||
|
@ -1811,7 +1839,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
def test_get_pinning_inst_not_avail(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048, memory_usage=0,
|
||||
pinned_cpus=set([0]))
|
||||
pinned_cpus=set([0]),
|
||||
siblings=[], mempages=[])
|
||||
inst_pin = objects.InstanceNUMACell(cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048)
|
||||
|
||||
|
@ -1820,7 +1849,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
|
||||
def test_get_pinning_no_sibling_fits_empty(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2]),
|
||||
memory=2048, memory_usage=0)
|
||||
memory=2048, memory_usage=0, siblings=[],
|
||||
mempages=[], pinned_cpus=set([]))
|
||||
inst_pin = objects.InstanceNUMACell(cpuset=set([0, 1, 2]), memory=2048)
|
||||
|
||||
inst_pin = hw._numa_fit_instance_cell_with_pinning(host_pin, inst_pin)
|
||||
|
@ -1829,7 +1859,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
def test_get_pinning_no_sibling_fits_w_usage(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048, memory_usage=0,
|
||||
pinned_cpus=set([1]))
|
||||
pinned_cpus=set([1]), mempages=[],
|
||||
siblings=[])
|
||||
inst_pin = objects.InstanceNUMACell(cpuset=set([0, 1, 2]), memory=1024)
|
||||
|
||||
inst_pin = hw._numa_fit_instance_cell_with_pinning(host_pin, inst_pin)
|
||||
|
@ -1837,7 +1868,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
|
||||
def test_get_pinning_instance_siblings_fits(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048, memory_usage=0)
|
||||
memory=2048, memory_usage=0, siblings=[],
|
||||
mempages=[], pinned_cpus=set([]))
|
||||
topo = objects.VirtCPUTopology(sockets=1, cores=2, threads=2)
|
||||
inst_pin = objects.InstanceNUMACell(
|
||||
cpuset=set([0, 1, 2, 3]), memory=2048, cpu_topology=topo)
|
||||
|
@ -1849,7 +1881,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
def test_get_pinning_instance_siblings_host_siblings_fits_empty(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048, memory_usage=0,
|
||||
siblings=[set([0, 1]), set([2, 3])])
|
||||
siblings=[set([0, 1]), set([2, 3])],
|
||||
mempages=[], pinned_cpus=set([]))
|
||||
topo = objects.VirtCPUTopology(sockets=1, cores=2, threads=2)
|
||||
inst_pin = objects.InstanceNUMACell(
|
||||
cpuset=set([0, 1, 2, 3]), memory=2048, cpu_topology=topo)
|
||||
|
@ -1864,7 +1897,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
cpuset=set([0, 1, 2, 3, 4, 5, 6, 7]),
|
||||
memory=4096, memory_usage=0,
|
||||
pinned_cpus=set([1, 2, 5, 6]),
|
||||
siblings=[set([0, 1, 2, 3]), set([4, 5, 6, 7])])
|
||||
siblings=[set([0, 1, 2, 3]), set([4, 5, 6, 7])],
|
||||
mempages=[])
|
||||
topo = objects.VirtCPUTopology(sockets=1, cores=2, threads=2)
|
||||
inst_pin = objects.InstanceNUMACell(
|
||||
cpuset=set([0, 1, 2, 3]), memory=2048, cpu_topology=topo)
|
||||
|
@ -1877,7 +1911,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
host_pin = objects.NUMACell(
|
||||
id=0, cpuset=set([0, 1, 2, 3, 4, 5, 6, 7]),
|
||||
memory=4096, memory_usage=0,
|
||||
siblings=[set([0, 1]), set([2, 3]), set([4, 5]), set([6, 7])])
|
||||
siblings=[set([0, 1]), set([2, 3]), set([4, 5]), set([6, 7])],
|
||||
mempages=[], pinned_cpus=set([]))
|
||||
topo = objects.VirtCPUTopology(sockets=1, cores=2, threads=4)
|
||||
inst_pin = objects.InstanceNUMACell(
|
||||
cpuset=set([0, 1, 2, 3, 4, 5, 6, 7]), memory=2048,
|
||||
|
@ -1890,7 +1925,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
host_pin = objects.NUMACell(
|
||||
id=0, cpuset=set([0, 1, 2, 3, 4, 5, 6, 7]),
|
||||
memory=4096, memory_usage=0,
|
||||
siblings=[set([0, 1, 2, 3]), set([4, 5, 6, 7])])
|
||||
siblings=[set([0, 1, 2, 3]), set([4, 5, 6, 7])],
|
||||
mempages=[], pinned_cpus=set([]))
|
||||
inst_pin = objects.InstanceNUMACell(cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048)
|
||||
|
||||
|
@ -1902,7 +1938,8 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
def test_get_pinning_host_siblings_fit(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=4096, memory_usage=0,
|
||||
siblings=[set([0, 1]), set([2, 3])])
|
||||
siblings=[set([0, 1]), set([2, 3])],
|
||||
mempages=[], pinned_cpus=set([]))
|
||||
inst_pin = objects.InstanceNUMACell(cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048)
|
||||
inst_pin = hw._numa_fit_instance_cell_with_pinning(host_pin, inst_pin)
|
||||
|
@ -1915,9 +1952,11 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
def test_host_numa_fit_instance_to_host_single_cell(self):
|
||||
host_topo = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1]), memory=2048,
|
||||
memory_usage=0),
|
||||
memory_usage=0, siblings=[],
|
||||
mempages=[], pinned_cpus=set([])),
|
||||
objects.NUMACell(id=1, cpuset=set([2, 3]), memory=2048,
|
||||
memory_usage=0)]
|
||||
memory_usage=0, siblings=[],
|
||||
mempages=[], pinned_cpus=set([]))]
|
||||
)
|
||||
inst_topo = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(
|
||||
|
@ -1932,9 +1971,11 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
host_topo = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1]),
|
||||
pinned_cpus=set([0]), memory=2048,
|
||||
memory_usage=0),
|
||||
memory_usage=0, siblings=[],
|
||||
mempages=[]),
|
||||
objects.NUMACell(id=1, cpuset=set([2, 3]), memory=2048,
|
||||
memory_usage=0)])
|
||||
memory_usage=0, siblings=[],
|
||||
mempages=[], pinned_cpus=set([]))])
|
||||
inst_topo = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(
|
||||
cpuset=set([0, 1]), memory=2048, cpu_pinning={})])
|
||||
|
@ -1947,9 +1988,11 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
def test_host_numa_fit_instance_to_host_single_cell_fail(self):
|
||||
host_topo = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1]), memory=2048,
|
||||
pinned_cpus=set([0]), memory_usage=0),
|
||||
pinned_cpus=set([0]), memory_usage=0,
|
||||
siblings=[], mempages=[]),
|
||||
objects.NUMACell(id=1, cpuset=set([2, 3]), memory=2048,
|
||||
pinned_cpus=set([2]), memory_usage=0)])
|
||||
pinned_cpus=set([2]), memory_usage=0,
|
||||
siblings=[], mempages=[])])
|
||||
inst_topo = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(cpuset=set([0, 1]),
|
||||
memory=2048,
|
||||
|
@ -1961,9 +2004,13 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
def test_host_numa_fit_instance_to_host_fit(self):
|
||||
host_topo = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048, memory_usage=0),
|
||||
memory=2048, memory_usage=0,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([])),
|
||||
objects.NUMACell(id=1, cpuset=set([4, 5, 6, 7]),
|
||||
memory=2048, memory_usage=0)])
|
||||
memory=2048, memory_usage=0,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([]))])
|
||||
inst_topo = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(cpuset=set([0, 1]),
|
||||
memory=2048, cpu_pinning={}),
|
||||
|
@ -1978,12 +2025,15 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
host_topo = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048, pinned_cpus=set([0]),
|
||||
siblings=[], mempages=[],
|
||||
memory_usage=0),
|
||||
objects.NUMACell(id=1, cpuset=set([4, 5, 6, 7]),
|
||||
memory=2048, memory_usage=0,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([4, 5, 6])),
|
||||
objects.NUMACell(id=2, cpuset=set([8, 9, 10, 11]),
|
||||
memory=2048, memory_usage=0,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([10, 11]))])
|
||||
inst_topo = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(cpuset=set([0, 1]),
|
||||
|
@ -1999,9 +2049,11 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
host_topo = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=4096, memory_usage=0,
|
||||
mempages=[], siblings=[],
|
||||
pinned_cpus=set([0])),
|
||||
objects.NUMACell(id=1, cpuset=set([4, 5, 6, 7]),
|
||||
memory=4096, memory_usage=0,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([4, 5, 6]))])
|
||||
inst_topo = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(cpuset=set([0, 1]),
|
||||
|
@ -2014,9 +2066,13 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
def test_host_numa_fit_instance_to_host_fail_topology(self):
|
||||
host_topo = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=4096, memory_usage=0),
|
||||
memory=4096, memory_usage=0,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([])),
|
||||
objects.NUMACell(id=1, cpuset=set([4, 5, 6, 7]),
|
||||
memory=4096, memory_usage=0)])
|
||||
memory=4096, memory_usage=0,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([]))])
|
||||
inst_topo = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(cpuset=set([0, 1]),
|
||||
memory=1024, cpu_pinning={}),
|
||||
|
@ -2031,7 +2087,8 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
host_pin = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=4096, cpu_usage=0,
|
||||
memory_usage=0)])
|
||||
memory_usage=0, siblings=[],
|
||||
mempages=[], pinned_cpus=set([]))])
|
||||
inst_pin_1 = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(
|
||||
cpuset=set([0, 1]), id=0, cpu_pinning={0: 0, 1: 3},
|
||||
|
@ -2050,6 +2107,7 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
host_pin = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=4096, cpu_usage=0, memory_usage=0,
|
||||
siblings=[], mempages=[],
|
||||
pinned_cpus=set([0, 1, 3]))])
|
||||
inst_pin_1 = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(
|
||||
|
@ -2066,7 +2124,8 @@ class CPUPinningTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
host_pin = objects.NUMATopology(
|
||||
cells=[objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3]),
|
||||
memory=4096, cpu_usage=0,
|
||||
memory_usage=0)])
|
||||
memory_usage=0, siblings=[],
|
||||
mempages=[], pinned_cpus=set([]))])
|
||||
inst_pin_1 = objects.InstanceNUMATopology(
|
||||
cells=[objects.InstanceNUMACell(
|
||||
cpuset=set([0, 1]), memory=2048, id=0,
|
||||
|
|
|
@ -4673,6 +4673,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
memory=cell.memory / units.Ki,
|
||||
cpu_usage=0, memory_usage=0,
|
||||
siblings=siblings,
|
||||
pinned_cpus=set([]),
|
||||
mempages=[
|
||||
objects.NUMAPagesTopology(
|
||||
size_kb=pages.size,
|
||||
|
|
Loading…
Reference in New Issue