'Creates the group.'

def create_group(self, context, group):

    context = context.elevated()
    self._set_resource_host(group)
    status = fields.GroupStatus.AVAILABLE
    model_update = None
    self._notify_about_group_usage(context, group, 'create.start')
    try:
        utils.require_driver_initialized(self.driver)
        LOG.info('Group    %s:    creating', group.name)
        try:
            model_update = self.driver.create_group(context, group)
        except NotImplementedError:
            cgsnap_type = group_types.get_default_cgsnapshot_type()
            if (group.group_type_id != cgsnap_type['id']):
                model_update = self._create_group_generic(context, group)
            else:
                (cg, __) = self._convert_group_to_cg(group, [])
                model_update = self.driver.create_consistencygroup(context, cg)
        if model_update:
            if (model_update['status'] == fields.GroupStatus.ERROR):
                msg = _('Create    group    failed.')
                LOG.error(msg, resource={'type': 'group', 'id': group.id})
                raise exception.VolumeDriverException(message=msg)
            else:
                group.update(model_update)
                group.save()
    except Exception:
        with excutils.save_and_reraise_exception():
            group.status = fields.GroupStatus.ERROR
            group.save()
            LOG.error('Group    %s:    create    failed', group.name)
    group.status = status
    group.created_at = timeutils.utcnow()
    group.save()
    LOG.info('Group    %s:    created    successfully', group.name)
    self._notify_about_group_usage(context, group, 'create.end')
    LOG.info('Create    group    completed    successfully.', resource={'type': 'group', 'id': group.id})
    return group
