'Destroys the new instance on the destination machine.
Reverts the model changes, and powers on the old instance on the
source machine.'

@wrap_exception()
@reverts_task_state
@wrap_instance_event(prefix='compute')
@errors_out_migration
@wrap_instance_fault
def revert_resize(self, context, instance, migration, reservations):

    compute_utils.notify_usage_exists(self.notifier, context, instance, current_period=True)
    with self._error_out_instance_on_exception(context, instance):
        self.network_api.setup_networks_on_host(context, instance, teardown=True)
        migration_p = obj_base.obj_to_primitive(migration)
        self.network_api.migrate_instance_start(context, instance, migration_p)
        network_info = self.network_api.get_instance_nw_info(context, instance)
        bdms = objects.BlockDeviceMappingList.get_by_instance_uuid(context, instance.uuid)
        block_device_info = self._get_instance_block_device_info(context, instance, bdms=bdms)
        destroy_disks = (not self._is_instance_storage_shared(context, instance, host=migration.source_compute))
        self.driver.destroy(context, instance, network_info, block_device_info, destroy_disks)
        self._terminate_volume_connections(context, instance, bdms)
        migration.status = 'reverted'
        with migration.obj_as_admin():
            migration.save()
        instance.revert_migration_context()
        instance.save()
        rt = self._get_resource_tracker()
        rt.drop_move_claim(context, instance, instance.node)
        self.compute_rpcapi.finish_revert_resize(context, instance, migration, migration.source_compute)
