'Create volume group from volume group or volume group snapshot.'

@proxy._trace_time
def create_group_from_src(self, ctxt, group, volumes, group_snapshot, sorted_snapshots, source_group, sorted_source_vols):

    grp = Group(group)
    if ((not grp.consisgroup_snapshot_enabled) and (not grp.consisgroup_replication_enabled)):
        raise NotImplementedError()
    model_update = {'status': fields.GroupStatus.AVAILABLE}
    volumes_model_update = []
    if (group_snapshot and sorted_snapshots):
        src_luns = [Lun(snapshot, is_snapshot=True) for snapshot in sorted_snapshots]
    elif (source_group and sorted_source_vols):
        src_luns = [Lun(source_vol) for source_vol in sorted_source_vols]
        src_group = Group(source_group)
        self._assert((not src_group.failed_over), ('Group    %s    has    been    failed    over,    it    does    not    support    to    create    a    group    from    it.' % src_group.id))
    else:
        msg = _('_create_group_from_src    supports    a    group    snapshot    source    or    a    group    source,    other    sources    can    not    be    used.')
        LOG.error(msg)
        raise exception.InvalidInput(message=msg)
    try:
        tgt_luns = [Lun(volume) for volume in volumes]
        if (src_luns and tgt_luns):
            self._clone_group(src_luns, tgt_luns)
        for tgt_lun in tgt_luns:
            if tgt_lun.type_replication:
                self._create_replica_helper(tgt_lun)
    except restclient.APIException:
        model_update['status'] = fields.GroupStatus.ERROR
        LOG.exception('Failed    to    create    group    from    group    snapshot.')
    for tgt_lun in tgt_luns:
        volume_model_update = tgt_lun.get_volume_update()
        volume_model_update.update({'id': tgt_lun.os_id, 'status': model_update['status']})
        volumes_model_update.append(volume_model_update)
    return (model_update, volumes_model_update)
