Skip to content

Commit 184a2ca

Browse files
committed
hardware: Remove handling of pre-Train compute nodes
Now that we're into Ussuri, we no longer need to worry about receiving objects from pre-Train compute nodes. Remove the code that was handling this along with a couple of other TODOs that have either been resolved or will never be resolved. Part of blueprint use-pcpu-and-vcpu-in-one-instance Change-Id: I771117f18bfab7d73de8e431168c964a96d419e8 Signed-off-by: Stephen Finucane <[email protected]>
1 parent 0a0c174 commit 184a2ca

File tree

2 files changed

+5
-63
lines changed

2 files changed

+5
-63
lines changed

nova/tests/unit/virt/test_hardware.py

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,7 @@ def _topo_usage_reserved_page_size(self):
19181918
objects.NUMACell(
19191919
id=0,
19201920
cpuset=set([0, 1]),
1921+
pcpuset=set(),
19211922
memory=512,
19221923
cpu_usage=0,
19231924
memory_usage=0,
@@ -1929,6 +1930,7 @@ def _topo_usage_reserved_page_size(self):
19291930
objects.NUMACell(
19301931
id=1,
19311932
cpuset=set([2, 3]),
1933+
pcpuset=set(),
19321934
memory=512,
19331935
cpu_usage=0,
19341936
memory_usage=0,
@@ -1959,7 +1961,7 @@ def test_numa_get_reserved_huge_pages(self):
19591961
self.assertEqual({2048: 64}, reserved[6])
19601962
self.assertEqual({1048576: 1}, reserved[9])
19611963

1962-
def test_reserved_hugepgaes_success(self):
1964+
def test_reserved_hugepages_success(self):
19631965
self.flags(reserved_huge_pages=[
19641966
{'node': 0, 'size': 2048, 'count': 128},
19651967
{'node': 1, 'size': 1048576, 'count': 1}])
@@ -3177,41 +3179,6 @@ def test_host_numa_fit_instance_to_host_single_cell(self):
31773179
for cell in inst_topo.cells:
31783180
self.assertInstanceCellPinned(cell, cell_ids=(0, 1))
31793181

3180-
# TODO(stephenfin): Remove in U
3181-
def test_host_numa_fit_instance_to_host_legacy_object(self):
3182-
"""Check that we're able to fit an instance NUMA topology to a legacy
3183-
host NUMA topology that doesn't have the 'pcpuset' field present.
3184-
"""
3185-
host_topo = objects.NUMATopology(cells=[
3186-
objects.NUMACell(
3187-
id=0,
3188-
cpuset=set([0, 1]),
3189-
# we are explicitly not setting pcpuset here
3190-
memory=2048,
3191-
memory_usage=0,
3192-
pinned_cpus=set(),
3193-
mempages=[],
3194-
siblings=[set([0]), set([1])]),
3195-
objects.NUMACell(
3196-
id=1,
3197-
cpuset=set([2, 3]),
3198-
# we are explicitly not setting pcpuset here
3199-
memory=2048,
3200-
memory_usage=0,
3201-
pinned_cpus=set(),
3202-
mempages=[],
3203-
siblings=[set([2]), set([3])])
3204-
])
3205-
inst_topo = objects.InstanceNUMATopology(cells=[
3206-
objects.InstanceNUMACell(
3207-
cpuset=set([0, 1]), memory=2048,
3208-
cpu_policy=fields.CPUAllocationPolicy.DEDICATED)])
3209-
3210-
inst_topo = hw.numa_fit_instance_to_host(host_topo, inst_topo)
3211-
3212-
for cell in inst_topo.cells:
3213-
self.assertInstanceCellPinned(cell, cell_ids=(0, 1))
3214-
32153182
def test_host_numa_fit_instance_to_host_single_cell_w_usage(self):
32163183
host_topo = objects.NUMATopology(cells=[
32173184
objects.NUMACell(

nova/virt/hardware.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,14 +1116,6 @@ def _numa_fit_instance_cell(host_cell, instance_cell, limit_cell=None,
11161116
'actual': host_cell.memory})
11171117
return
11181118

1119-
# The 'pcpuset' field is only set by newer compute nodes, so if it's
1120-
# not present then we've received this object from a pre-Train compute
1121-
# node and need to query against the 'cpuset' field instead until the
1122-
# compute node has been upgraded and starts reporting things properly.
1123-
# TODO(stephenfin): Remove in U
1124-
if 'pcpuset' not in host_cell:
1125-
host_cell.pcpuset = host_cell.cpuset
1126-
11271119
# NOTE(stephenfin): As with memory, do not allow an instance to overcommit
11281120
# against itself on any NUMA cell
11291121
if instance_cell.cpu_policy == fields.CPUAllocationPolicy.DEDICATED:
@@ -1781,7 +1773,6 @@ def get_pci_numa_policy_constraint(flavor, image_meta):
17811773
return policy
17821774

17831775

1784-
# TODO(sahid): Move numa related to hardware/numa.py
17851776
def numa_get_constraints(flavor, image_meta):
17861777
"""Return topology related to input request.
17871778
@@ -1872,7 +1863,6 @@ def numa_get_constraints(flavor, image_meta):
18721863
requested_vcpus, requested_pcpus = _get_vcpu_pcpu_resources(flavor)
18731864

18741865
if cpu_policy and (requested_vcpus or requested_pcpus):
1875-
# TODO(stephenfin): Make these custom exceptions
18761866
raise exception.InvalidRequest(
18771867
"It is not possible to use the 'resources:VCPU' or "
18781868
"'resources:PCPU' extra specs in combination with the "
@@ -2086,8 +2076,6 @@ def numa_fit_instance_to_host(
20862076
host_cells = sorted(host_cells, key=lambda cell: cell.id in [
20872077
pool['numa_node'] for pool in pci_stats.pools])
20882078

2089-
# TODO(ndipanov): We may want to sort permutations differently
2090-
# depending on whether we want packing/spreading over NUMA nodes
20912079
for host_cell_perm in itertools.permutations(
20922080
host_cells, len(instance_topology)):
20932081
chosen_instance_cells: ty.List['objects.InstanceNUMACell'] = []
@@ -2216,23 +2204,10 @@ def numa_usage_from_instance_numa(host_topology, instance_topology,
22162204
memory_usage = host_cell.memory_usage
22172205
shared_cpus_usage = host_cell.cpu_usage
22182206

2219-
# The 'pcpuset' field is only set by newer compute nodes, so if it's
2220-
# not present then we've received this object from a pre-Train compute
2221-
# node and need to dual-report all CPUS listed therein as both
2222-
# dedicated and shared until the compute node has been upgraded and
2223-
# starts reporting things properly.
2224-
# TODO(stephenfin): Remove in U
2225-
if 'pcpuset' not in host_cell:
2226-
shared_cpus = host_cell.cpuset
2227-
dedicated_cpus = host_cell.cpuset
2228-
else:
2229-
shared_cpus = host_cell.cpuset
2230-
dedicated_cpus = host_cell.pcpuset
2231-
22322207
new_cell = objects.NUMACell(
22332208
id=host_cell.id,
2234-
cpuset=shared_cpus,
2235-
pcpuset=dedicated_cpus,
2209+
cpuset=host_cell.cpuset,
2210+
pcpuset=host_cell.pcpuset,
22362211
memory=host_cell.memory,
22372212
cpu_usage=0,
22382213
memory_usage=0,

0 commit comments

Comments
 (0)