More updates, there is a logic while doing deleting instance, it will consider if the migration are not confirmed, so it seems that we can do something similar.
def _confirm_resize_on_deleting(self, context, instance):
# If in the middle of a resize, use confirm_resize to
# ensure the original instance is cleaned up too
migration = None
for status in ('finished', 'confirming'):
try: migration = objects.Migration.get_by_instance_and_status( context.elevated(), instance.uuid, status) LOG.info(_LI('Found an unconfirmed migration during delete, ' 'id: %(id)s, status: %(status)s'), {'id': migration.id, 'status': migration.status}, context=context, instance=instance) break
except exception.MigrationNotFoundByStatus: pass
More updates, there is a logic while doing deleting instance, it will consider if the migration are not confirmed, so it seems that we can do something similar.
def _confirm_ resize_ on_deleting( self, context, instance):
migration = objects. Migration. get_by_ instance_ and_status(
context. elevated( ), instance.uuid, status)
LOG.info( _LI('Found an unconfirmed migration during delete, '
'id: %(id)s, status: %(status)s'),
{'id' : migration.id,
'status' : migration.status},
context= context, instance=instance)
break MigrationNotFou ndByStatus:
pass
# If in the middle of a resize, use confirm_resize to
# ensure the original instance is cleaned up too
migration = None
for status in ('finished', 'confirming'):
try:
except exception.
....