'Create consistence group from source'

def create_cg_from_source(self, group, fc_consistgrp, sources, targets, state, config, timeout):

    LOG.debug('Enter:    create_cg_from_source:    cg    %(cg)s    source    %(source)s,    target    %(target)s', {'cg': fc_consistgrp, 'source': sources, 'target': targets})
    model_update = {'status': fields.GroupStatus.AVAILABLE}
    ctxt = context.get_admin_context()
    try:
        for (source, target) in zip(sources, targets):
            opts = self.get_vdisk_params(config, state, source['volume_type_id'])
            pool = utils.extract_host(target['host'], 'pool')
            self.create_flashcopy_to_consistgrp(source['name'], target['name'], fc_consistgrp, config, opts, True, pool=pool)
        self.prepare_fc_consistgrp(fc_consistgrp, timeout)
        self.start_fc_consistgrp(fc_consistgrp)
        self.delete_fc_consistgrp(fc_consistgrp)
        volumes_model_update = self._get_volume_model_updates(ctxt, targets, group['id'], model_update['status'])
    except exception.VolumeBackendAPIException as err:
        model_update['status'] = fields.GroupStatus.ERROR
        volumes_model_update = self._get_volume_model_updates(ctxt, targets, group['id'], model_update['status'])
        with excutils.save_and_reraise_exception():
            self.delete_fc_consistgrp(fc_consistgrp)
            LOG.error('Failed    to    create    CG    from    CGsnapshot.    Exception:    %s', err)
        return (model_update, volumes_model_update)
    LOG.debug('Leave:    create_cg_from_source.')
    return (model_update, volumes_model_update)
