'Creates a consistency group.'

def _create_consistencygroup(self, context, cgname):

    LOG.info('Creating    consistency    group    %(name)s.', {'name': cgname})
    try:
        self._call_xiv_xcli('cg_create', cg=cgname, pool=self.storage_info[storage.FLAG_KEYS['storage_pool']]).as_list
    except errors.CgNameExistsError as e:
        error = (_('consistency    group    %s    already    exists    on    backend') % cgname)
        LOG.error(error)
        raise self._get_exception()(error)
    except errors.CgLimitReachedError as e:
        error = _('Reached    Maximum    number    of    consistency    groups')
        LOG.error(error)
        raise self._get_exception()(error)
    except errors.XCLIError as e:
        error = (_('Fatal    error    in    cg_create:    %(details)s') % {'details': self._get_code_and_status_or_message(e)})
        LOG.error(error)
        raise self._get_exception()(error)
    model_update = {'status': fields.GroupStatus.AVAILABLE}
    return model_update
