Set instance NUMA topology on HostState
NUMATopologyFilter will try to fit an instance onto every host (represented by a HostState instance) so assigning the resulting instance topology to the instance dict really makes no sense, as we end up with only the last calculated topology from all the filter runs. This in turn makes consume_from_instance not work as expected, as it will consume NUMA topology calculated from the last host the filter was run on, not the host that was chosen by the scheduler. This patch stashes the calculated NUMA topology onto the HostState instance passed to the filter, that will be used in consume_from_instance, and makes sure that is what gets used for updating the usage. Change-Id: Ifacccadf73dc114e50f46b8e6087ffb2b2fc9d6b Closes-Bug: #1405359
This commit is contained in:
@@ -51,7 +51,7 @@ class NUMATopologyFilter(filters.BaseHostFilter):
|
||||
if not instance_topology:
|
||||
return False
|
||||
host_state.limits['numa_topology'] = limits.to_json()
|
||||
instance['numa_topology'] = instance_topology
|
||||
host_state.instance_numa_topology = instance_topology
|
||||
return True
|
||||
elif requested_topology:
|
||||
return False
|
||||
|
||||
@@ -125,6 +125,7 @@ class HostState(object):
|
||||
self.vcpus_total = 0
|
||||
self.vcpus_used = 0
|
||||
self.numa_topology = None
|
||||
self.instance_numa_topology = None
|
||||
|
||||
# Additional host information from the compute node stats:
|
||||
self.num_instances = 0
|
||||
@@ -204,6 +205,7 @@ class HostState(object):
|
||||
self.vcpus_used = compute.vcpus_used
|
||||
self.updated = compute.updated_at
|
||||
self.numa_topology = compute.numa_topology
|
||||
self.instance_numa_topology = None
|
||||
if compute.pci_device_pools is not None:
|
||||
self.pci_stats = pci_stats.PciDeviceStats(
|
||||
compute.pci_device_pools)
|
||||
@@ -267,6 +269,7 @@ class HostState(object):
|
||||
instance_cells)
|
||||
|
||||
# Calculate the numa usage
|
||||
instance['numa_topology'] = self.instance_numa_topology
|
||||
updated_numa_topology = hardware.get_host_numa_usage_from_instance(
|
||||
self, instance)
|
||||
self.numa_topology = updated_numa_topology
|
||||
|
||||
Reference in New Issue
Block a user