Merge "De-duplicate two delete_allocation_for_* methods"
This commit is contained in:
commit
1fb132f2f3
@ -1211,6 +1211,13 @@ class ResourceTracker(object):
|
||||
instance_uuid, instance.host, instance.node, alloc)
|
||||
|
||||
def delete_allocation_for_evacuated_instance(self, instance, node):
|
||||
self._delete_allocation_for_moved_instance(instance, node, 'evacuated')
|
||||
|
||||
def delete_allocation_for_migrated_instance(self, instance, node):
|
||||
self._delete_allocation_for_moved_instance(instance, node, 'migrated')
|
||||
|
||||
def _delete_allocation_for_moved_instance(
|
||||
self, instance, node, move_type):
|
||||
# Clean up the instance allocation from this node in placement
|
||||
my_resources = scheduler_utils.resources_from_flavor(
|
||||
instance, instance.flavor)
|
||||
@ -1221,21 +1228,9 @@ class ResourceTracker(object):
|
||||
instance.uuid, cn_uuid, instance.user_id,
|
||||
instance.project_id, my_resources)
|
||||
if not res:
|
||||
LOG.error("Failed to clean allocation of an evacuated "
|
||||
LOG.error("Failed to clean allocation of %s "
|
||||
"instance on the source node %s",
|
||||
cn_uuid, instance=instance)
|
||||
|
||||
def delete_allocation_for_migrated_instance(self, instance, node):
|
||||
my_resources = scheduler_utils.resources_from_flavor(instance,
|
||||
instance.flavor)
|
||||
cn = self.compute_nodes[node]
|
||||
res = self.reportclient.remove_provider_from_instance_allocation(
|
||||
instance.uuid, cn.uuid, instance.user_id, instance.project_id,
|
||||
my_resources)
|
||||
if not res:
|
||||
LOG.error('Failed to clean allocation of a migrated instance '
|
||||
'on the source node %s', cn.uuid,
|
||||
instance=instance)
|
||||
move_type, cn_uuid, instance=instance)
|
||||
|
||||
def delete_allocation_for_failed_resize(self, instance, node, flavor):
|
||||
"""Delete instance allocations for the node during a failed resize
|
||||
|
Loading…
Reference in New Issue
Block a user