'Reverts a resize, deleting the \'new\' instance in the process.'

@check_instance_lock
@check_instance_cell
@check_instance_state(vm_state=[vm_states.RESIZED])
def revert_resize(self, context, instance):

    elevated = context.elevated()
    migration = objects.Migration.get_by_instance_and_status(elevated, instance.uuid, 'finished')
    self._check_quota_for_upsize(context, instance, instance.flavor, instance.old_flavor)
    instance.task_state = task_states.RESIZE_REVERTING
    instance.save(expected_task_state=[None])
    migration.status = 'reverting'
    migration.save()
    self._record_action_start(context, instance, instance_actions.REVERT_RESIZE)
    self.compute_rpcapi.revert_resize(context, instance, migration, migration.dest_compute)
