'Initiates the process of moving a running instance to another host.
Possibly changes the RAM and disk size in the process.'

@wrap_exception()
@reverts_task_state
@wrap_instance_event(prefix='compute')
@wrap_instance_fault
def prep_resize(self, context, image, instance, instance_type, reservations, request_spec, filter_properties, node, clean_shutdown):

    if (node is None):
        node = self.driver.get_available_nodes(refresh=True)[0]
        LOG.debug('No    node    specified,    defaulting    to    %s', node, instance=instance)
    if (not isinstance(instance_type, objects.Flavor)):
        instance_type = objects.Flavor.get_by_id(context, instance_type['id'])
    with self._error_out_instance_on_exception(context, instance):
        compute_utils.notify_usage_exists(self.notifier, context, instance, current_period=True)
        self._notify_about_instance_usage(context, instance, 'resize.prep.start')
        try:
            self._prep_resize(context, image, instance, instance_type, filter_properties, node, clean_shutdown)
        except exception.MigrationPreCheckError:
            raise
        except Exception:
            exc_info = sys.exc_info()
            self._reschedule_resize_or_reraise(context, image, instance, exc_info, instance_type, request_spec, filter_properties)
        finally:
            extra_usage_info = dict(new_instance_type=instance_type.name, new_instance_type_id=instance_type.id)
            self._notify_about_instance_usage(context, instance, 'resize.prep.end', extra_usage_info=extra_usage_info)
