Cleanup comments around claim_resources method

This removes some old comments about how things worked
prior to Pike where the ResourceTracker would "heal"
allocations on the compute node during the periodic
update_available_resource task. That code was removed
via change I39d93dbf8552605e34b9f146e3613e6af62a1774 (Rocky)
and change If272365e58a583e2831a15a5c2abad2d77921729 (Stein).

There are also old comments in here about not using claim_resources
during forced live migrate and evacuate and instead call the
scheduler with a hint to skip filters, but that hasn't happened yet
so the "In Queens" portion is just removed since it's misleading
(and somewhat embarrassing at this point that it's not fixed yet).

Finally, the NOTE above claim_resources() which says it's only called
in two places is updated since it's actually called in three places
since it's also used in the forced evacuate destination case.

A follow up change will deal with the TODO about erroring out in the
final else case in claim_resources_on_destination().

Change-Id: I1822ac911ed8dbbb482fd4c13591d86b0c518321
This commit is contained in:
Matt Riedemann 2019-03-19 09:46:25 -04:00
parent f58f73978e
commit 9b121e3c37
4 changed files with 11 additions and 13 deletions

View File

@ -922,7 +922,7 @@ class ComputeTaskManager(base.Base):
'not found.', instance.host, instance.node,
instance=instance)
# TODO(mriedem): In Queens, call select_destinations() with a
# TODO(mriedem): Call select_destinations() with a
# skip_filters=True flag so the scheduler does the work of
# claiming resources on the destination in Placement but still
# bypass the scheduler filters, which honors the 'force' flag

View File

@ -97,7 +97,7 @@ class LiveMigrationTask(base.TaskBase):
# to the destination compute node. Normally select_destinations()
# in the scheduler would do this for us, but when forcing the
# target host we don't call the scheduler.
# TODO(mriedem): In Queens, call select_destinations() with a
# TODO(mriedem): Call select_destinations() with a
# skip_filters=True flag so the scheduler does the work of claiming
# resources on the destination in Placement but still bypass the
# scheduler filters, which honors the 'force' flag in the API.

View File

@ -1524,13 +1524,16 @@ class SchedulerReportClient(object):
return allocations.get(
rp_uuid, {}).get('resources', {})
# NOTE(jaypipes): Currently, this method is ONLY used in two places:
# NOTE(jaypipes): Currently, this method is ONLY used in three places:
# 1. By the scheduler to allocate resources on the selected destination
# hosts.
# 2. By the conductor LiveMigrationTask to allocate resources on a forced
# destination host. This is a short-term fix for Pike which should be
# replaced in Queens by conductor calling the scheduler in the force
# host case.
# destination host. In this case, the source node allocations have
# already been moved to the migration record so the instance should not
# have allocations and _move_operation_alloc_request will not be called.
# 3. By the conductor ComputeTaskManager to allocate resources on a forced
# destination host during evacuate. This case will call the
# _move_operation_alloc_request method.
# This method should not be called by the resource tracker.
@safe_connect
@retries
@ -1546,10 +1549,7 @@ class SchedulerReportClient(object):
host). In order to prevent compute nodes currently performing move
operations from being scheduled to improperly, we create a "doubled-up"
allocation that consumes resources on *both* the source and the
destination host during the move operation. When the move operation
completes, the destination host will end up setting allocations for the
instance only on the destination host thereby freeing up resources on
the source host appropriately.
destination host during the move operation.
:param context: The security context
:param consumer_uuid: The instance's UUID.

View File

@ -596,9 +596,7 @@ def claim_resources_on_destination(
# the host. This is because we need Placement to have an
# accurate reflection of what's allocated on all nodes so the
# scheduler can make accurate decisions about which nodes have
# capacity for building an instance. We also cannot rely on the
# resource tracker in the compute service automatically healing
# the allocations since that code is going away in Queens.
# capacity for building an instance.
reason = (_('Unable to move instance %(instance_uuid)s to '
'host %(host)s. There is not enough capacity on '
'the host for the instance.') %