'Begin the resize process with given instance/flavor.'

def _resize(self, req, instance_id, flavor_id, **kwargs):

    context = req.environ['nova.context']
    instance = self._get_server(context, req, instance_id)
    context.can((server_policies.SERVERS % 'resize'), target={'user_id': instance.user_id, 'project_id': instance.project_id})
    try:
        self.compute_api.resize(context, instance, flavor_id, **kwargs)
    except exception.InstanceUnknownCell as e:
        raise exc.HTTPNotFound(explanation=e.format_message())
    except exception.QuotaError as error:
        raise exc.HTTPForbidden(explanation=error.format_message())
    except exception.InstanceIsLocked as e:
        raise exc.HTTPConflict(explanation=e.format_message())
    except exception.InstanceInvalidState as state_error:
        common.raise_http_conflict_for_instance_invalid_state(state_error, 'resize', instance_id)
    except exception.ImageNotAuthorized:
        msg = _('You    are    not    authorized    to    access    the    image    the    instance    was    started    with.')
        raise exc.HTTPUnauthorized(explanation=msg)
    except exception.ImageNotFound:
        msg = _('Image    that    the    instance    was    started    with    could    not    be    found.')
        raise exc.HTTPBadRequest(explanation=msg)
    except (exception.AutoDiskConfigDisabledByImage, exception.CannotResizeDisk, exception.CannotResizeToSameFlavor, exception.FlavorNotFound, exception.NoValidHost, exception.PciRequestAliasNotDefined) as e:
        raise exc.HTTPBadRequest(explanation=e.format_message())
    except exception.Invalid:
        msg = _('Invalid    instance    image.')
        raise exc.HTTPBadRequest(explanation=msg)
