Merge "Only log not correcting allocation once per period" into stable/pike
This commit is contained in:
@@ -1039,38 +1039,9 @@ class ResourceTracker(object):
|
|||||||
instance,
|
instance,
|
||||||
sign=sign)
|
sign=sign)
|
||||||
if require_allocation_refresh:
|
if require_allocation_refresh:
|
||||||
LOG.debug("Auto-correcting allocations to handle Ocata "
|
LOG.debug("Auto-correcting allocations.")
|
||||||
"assumptions.")
|
|
||||||
self.reportclient.update_instance_allocation(cn, instance,
|
self.reportclient.update_instance_allocation(cn, instance,
|
||||||
sign)
|
sign)
|
||||||
else:
|
|
||||||
# NOTE(jaypipes): We're on a Pike compute host or later in
|
|
||||||
# a deployment with all compute hosts upgraded to Pike or
|
|
||||||
# later
|
|
||||||
#
|
|
||||||
# If that is the case, then we know that the scheduler will
|
|
||||||
# have properly created an allocation and that the compute
|
|
||||||
# hosts have not attempted to overwrite allocations
|
|
||||||
# **during the periodic update_available_resource() call**.
|
|
||||||
# However, Pike compute hosts may still rework an
|
|
||||||
# allocation for an instance in a move operation during
|
|
||||||
# confirm_resize() on the source host which will remove the
|
|
||||||
# source resource provider from any allocation for an
|
|
||||||
# instance.
|
|
||||||
#
|
|
||||||
# In Queens and beyond, the scheduler will understand when
|
|
||||||
# a move operation has been requested and instead of
|
|
||||||
# creating a doubled-up allocation that contains both the
|
|
||||||
# source and destination host, the scheduler will take the
|
|
||||||
# original allocation (against the source host) and change
|
|
||||||
# the consumer ID of that allocation to be the migration
|
|
||||||
# UUID and not the instance UUID. The scheduler will
|
|
||||||
# allocate the resources for the destination host to the
|
|
||||||
# instance UUID.
|
|
||||||
LOG.debug("We're on a Pike compute host in a deployment "
|
|
||||||
"with all Pike compute hosts. Skipping "
|
|
||||||
"auto-correction of allocations.")
|
|
||||||
|
|
||||||
# new instance, update compute node resource usage:
|
# new instance, update compute node resource usage:
|
||||||
self._update_usage(self._get_usage_dict(instance), nodename,
|
self._update_usage(self._get_usage_dict(instance), nodename,
|
||||||
sign=sign)
|
sign=sign)
|
||||||
@@ -1130,6 +1101,22 @@ class ResourceTracker(object):
|
|||||||
# or a Queens compute host, we do NOT want the Pike compute host to
|
# or a Queens compute host, we do NOT want the Pike compute host to
|
||||||
# be "healing" allocation information. Instead, we rely on the Pike
|
# be "healing" allocation information. Instead, we rely on the Pike
|
||||||
# scheduler to properly create allocations during scheduling.
|
# scheduler to properly create allocations during scheduling.
|
||||||
|
#
|
||||||
|
# Pike compute hosts may still rework an
|
||||||
|
# allocation for an instance in a move operation during
|
||||||
|
# confirm_resize() on the source host which will remove the
|
||||||
|
# source resource provider from any allocation for an
|
||||||
|
# instance.
|
||||||
|
#
|
||||||
|
# In Queens and beyond, the scheduler will understand when
|
||||||
|
# a move operation has been requested and instead of
|
||||||
|
# creating a doubled-up allocation that contains both the
|
||||||
|
# source and destination host, the scheduler will take the
|
||||||
|
# original allocation (against the source host) and change
|
||||||
|
# the consumer ID of that allocation to be the migration
|
||||||
|
# UUID and not the instance UUID. The scheduler will
|
||||||
|
# allocate the resources for the destination host to the
|
||||||
|
# instance UUID.
|
||||||
compute_version = objects.Service.get_minimum_version(
|
compute_version = objects.Service.get_minimum_version(
|
||||||
context, 'nova-compute')
|
context, 'nova-compute')
|
||||||
has_ocata_computes = compute_version < 22
|
has_ocata_computes = compute_version < 22
|
||||||
@@ -1140,8 +1127,29 @@ class ResourceTracker(object):
|
|||||||
has_ocata_computes or
|
has_ocata_computes or
|
||||||
self.driver.requires_allocation_refresh)
|
self.driver.requires_allocation_refresh)
|
||||||
|
|
||||||
|
msg_allocation_refresh = (
|
||||||
|
"Compute driver doesn't require allocation refresh and we're on a "
|
||||||
|
"compute host in a deployment that only has compute hosts with "
|
||||||
|
"Nova versions >=16 (Pike). Skipping auto-correction of "
|
||||||
|
"allocations. ")
|
||||||
|
if require_allocation_refresh:
|
||||||
|
if self.driver.requires_allocation_refresh:
|
||||||
|
msg_allocation_refresh = (
|
||||||
|
"Compute driver requires allocation refresh. ")
|
||||||
|
elif has_ocata_computes:
|
||||||
|
msg_allocation_refresh = (
|
||||||
|
"We're on a compute host from Nova version >=16 (Pike or "
|
||||||
|
"later) in a deployment with at least one compute host "
|
||||||
|
"version <16 (Ocata or earlier). ")
|
||||||
|
msg_allocation_refresh += (
|
||||||
|
"Will auto-correct allocations to handle "
|
||||||
|
"Ocata-style assumptions.")
|
||||||
|
|
||||||
for instance in instances:
|
for instance in instances:
|
||||||
if instance.vm_state not in vm_states.ALLOW_RESOURCE_REMOVAL:
|
if instance.vm_state not in vm_states.ALLOW_RESOURCE_REMOVAL:
|
||||||
|
if msg_allocation_refresh:
|
||||||
|
LOG.debug(msg_allocation_refresh)
|
||||||
|
msg_allocation_refresh = False
|
||||||
self._update_usage_from_instance(context, instance, nodename,
|
self._update_usage_from_instance(context, instance, nodename,
|
||||||
require_allocation_refresh=require_allocation_refresh)
|
require_allocation_refresh=require_allocation_refresh)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user