Merge "FUP for Ib62ac0b692eb92a2ed364ec9f486ded05def39ad"

This commit is contained in:
Zuul 2019-11-15 11:53:50 +00:00 committed by Gerrit Code Review
commit 28963bd64c
2 changed files with 9 additions and 9 deletions

View File

@ -25,8 +25,8 @@ In the movement towards using placement for scheduling and resource management,
the virt driver method ``get_available_resource`` was initially superseded by the virt driver method ``get_available_resource`` was initially superseded by
``get_inventory`` (now gone), whereby the driver could specify its inventory in ``get_inventory`` (now gone), whereby the driver could specify its inventory in
terms understood by placement. In Queens, a ``get_traits`` driver method was terms understood by placement. In Queens, a ``get_traits`` driver method was
added. But ``get_inventory`` is limited to expressing only inventory (not added. But ``get_inventory`` was limited to expressing only inventory (not
traits or aggregates). And both of these methods are limited to the resource traits or aggregates). And both of these methods were limited to the resource
provider corresponding to the compute node. provider corresponding to the compute node.
Developments such as Nested Resource Providers necessitate the ability Developments such as Nested Resource Providers necessitate the ability

View File

@ -1092,15 +1092,14 @@ class ResourceTracker(object):
"""Send resource and inventory changes to placement.""" """Send resource and inventory changes to placement."""
# NOTE(jianghuaw): Some resources(e.g. VGPU) are not saved in the # NOTE(jianghuaw): Some resources(e.g. VGPU) are not saved in the
# object of compute_node; instead the inventory data for these # object of compute_node; instead the inventory data for these
# resource is reported by driver's get_inventory(). So even there # resource is reported by driver's update_provider_tree(). So even if
# is no resource change for compute_node as above, we need proceed # there is no resource change for compute_node, we need proceed
# to get inventory and use report client interfaces to update # to get inventory and use report client interfaces to update
# inventory to placement. It's report client's responsibility to # inventory to placement. It's report client's responsibility to
# ensure the update request to placement only happens when inventory # ensure the update request to placement only happens when inventory
# is changed. # is changed.
nodename = compute_node.hypervisor_hostname nodename = compute_node.hypervisor_hostname
# Persist the stats to the Scheduler # Persist the stats to the Scheduler
# First try update_provider_tree
# Retrieve the provider tree associated with this compute node. If # Retrieve the provider tree associated with this compute node. If
# it doesn't exist yet, this will create it with a (single, root) # it doesn't exist yet, this will create it with a (single, root)
# provider corresponding to the compute node. # provider corresponding to the compute node.
@ -1157,10 +1156,11 @@ class ResourceTracker(object):
nodename = compute_node.hypervisor_hostname nodename = compute_node.hypervisor_hostname
old_compute = self.old_resources[nodename] old_compute = self.old_resources[nodename]
if self._resource_change(compute_node): if self._resource_change(compute_node):
# If the compute_node's resource changed, update to DB. # If the compute_node's resource changed, update to DB. Note that
# NOTE(jianghuaw): Once we completely move to use get_inventory() # _update_to_placement below does not supersede the need to do this
# for all resource provider's inv data. We can remove this check. # because there are stats-related fields in the ComputeNode object
# At the moment we still need this check and save compute_node. # which could have changed and still need to be reported to the
# scheduler filters/weighers (which could be out of tree as well).
try: try:
compute_node.save() compute_node.save()
except Exception: except Exception: