'Creates a new snapshot.'

@wsgi.response(http_client.ACCEPTED)
def create(self, req, body):

    kwargs = {}
    context = req.environ['cinder.context']
    self.assert_valid_body(body, 'snapshot')
    snapshot = body['snapshot']
    kwargs['metadata'] = snapshot.get('metadata', None)
    try:
        volume_id = snapshot['volume_id']
    except KeyError:
        msg = _("'volume_id'    must    be    specified")
        raise exc.HTTPBadRequest(explanation=msg)
    volume = self.volume_api.get(context, volume_id)
    force = snapshot.get('force', False)
    LOG.info('Create    snapshot    from    volume    %s', volume_id)
    self.validate_name_and_description(snapshot)
    if ('name' in snapshot):
        snapshot['display_name'] = snapshot.pop('name')
    try:
        force = strutils.bool_from_string(force, strict=True)
    except ValueError as error:
        err_msg = encodeutils.exception_to_unicode(error)
        msg = (_("Invalid    value    for    'force':    '%s'") % err_msg)
        raise exception.InvalidParameterValue(err=msg)
    if force:
        new_snapshot = self.volume_api.create_snapshot_force(context, volume, snapshot.get('display_name'), snapshot.get('description'), **kwargs)
    else:
        new_snapshot = self.volume_api.create_snapshot(context, volume, snapshot.get('display_name'), snapshot.get('description'), **kwargs)
    req.cache_db_snapshot(new_snapshot)
    return self._view_builder.detail(req, new_snapshot)
