hardware: Flatten functions
This will make subsquent changes easier to review. Change-Id: Ia670e4d326613fe295d91bae45a379d700c33a5f
This commit is contained in:
committed by
John Garbutt
parent
a1d4cf25f9
commit
3f0711c3e3
@@ -1314,32 +1314,32 @@ def numa_fit_instance_to_host(
|
|||||||
{'required': len(instance_topology),
|
{'required': len(instance_topology),
|
||||||
'actual': len(host_topology)})
|
'actual': len(host_topology)})
|
||||||
return
|
return
|
||||||
else:
|
|
||||||
# TODO(ndipanov): We may want to sort permutations differently
|
# TODO(ndipanov): We may want to sort permutations differently
|
||||||
# depending on whether we want packing/spreading over NUMA nodes
|
# depending on whether we want packing/spreading over NUMA nodes
|
||||||
for host_cell_perm in itertools.permutations(
|
for host_cell_perm in itertools.permutations(
|
||||||
host_topology.cells, len(instance_topology)):
|
host_topology.cells, len(instance_topology)):
|
||||||
cells = []
|
cells = []
|
||||||
for host_cell, instance_cell in zip(
|
for host_cell, instance_cell in zip(
|
||||||
host_cell_perm, instance_topology.cells):
|
host_cell_perm, instance_topology.cells):
|
||||||
try:
|
try:
|
||||||
got_cell = _numa_fit_instance_cell(
|
got_cell = _numa_fit_instance_cell(
|
||||||
host_cell, instance_cell, limits)
|
host_cell, instance_cell, limits)
|
||||||
except exception.MemoryPageSizeNotSupported:
|
except exception.MemoryPageSizeNotSupported:
|
||||||
# This exception will been raised if instance cell's
|
# This exception will been raised if instance cell's
|
||||||
# custom pagesize is not supported with host cell in
|
# custom pagesize is not supported with host cell in
|
||||||
# _numa_cell_supports_pagesize_request function.
|
# _numa_cell_supports_pagesize_request function.
|
||||||
break
|
break
|
||||||
if got_cell is None:
|
if got_cell is None:
|
||||||
break
|
break
|
||||||
cells.append(got_cell)
|
cells.append(got_cell)
|
||||||
if len(cells) == len(host_cell_perm):
|
|
||||||
if not pci_requests:
|
if len(cells) != len(host_cell_perm):
|
||||||
return objects.InstanceNUMATopology(cells=cells)
|
continue
|
||||||
elif ((pci_stats is not None) and
|
|
||||||
pci_stats.support_requests(pci_requests,
|
if not pci_requests or ((pci_stats is not None) and
|
||||||
cells)):
|
pci_stats.support_requests(pci_requests, cells)):
|
||||||
return objects.InstanceNUMATopology(cells=cells)
|
return objects.InstanceNUMATopology(cells=cells)
|
||||||
|
|
||||||
|
|
||||||
def numa_get_reserved_huge_pages():
|
def numa_get_reserved_huge_pages():
|
||||||
|
|||||||
Reference in New Issue
Block a user