Comment 5 for bug 1536703

Revision history for this message
Eli Qiao (taget-9) wrote :

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

....