'Create a new consistency group.'

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

    LOG.debug('Creating    new    consistency    group    %s', body)
    self.assert_valid_body(body, 'consistencygroup')
    context = req.environ['cinder.context']
    consistencygroup = body['consistencygroup']
    self.validate_name_and_description(consistencygroup)
    name = consistencygroup.get('name', None)
    description = consistencygroup.get('description', None)
    volume_types = consistencygroup.get('volume_types', None)
    if (not volume_types):
        msg = (_('volume_types    must    be    provided    to    create    consistency    group    %(name)s.') % {'name': name})
        raise exc.HTTPBadRequest(explanation=msg)
    volume_types = volume_types.rstrip(',').split(',')
    availability_zone = consistencygroup.get('availability_zone', None)
    group_type = group_types.get_default_cgsnapshot_type()
    if (not group_type):
        msg = (_('Group    type    %s    not    found.    Rerun    migration    script    to    create    the    default    cgsnapshot    type.') % group_types.DEFAULT_CGSNAPSHOT_TYPE)
        raise exc.HTTPBadRequest(explanation=msg)
    LOG.info('Creating    consistency    group    %(name)s.', {'name': name})
    try:
        consistencygroup_api.check_policy(context, 'create')
        new_consistencygroup = self.group_api.create(context, name, description, group_type['id'], volume_types, availability_zone=availability_zone)
    except (exception.InvalidConsistencyGroup, exception.InvalidGroup, exception.InvalidVolumeType, exception.ObjectActionError) as error:
        raise exc.HTTPBadRequest(explanation=error.msg)
    except exception.NotFound:
        raise
    retval = self._view_builder.summary(req, new_consistencygroup)
    return retval
