'Create volume group snapshot.'

@proxy.logger
def create_group_snapshot(self, ctxt, group_snapshot, snapshots):

    tgt_group = Group(group_snapshot, True)
    if ((not tgt_group.consisgroup_snapshot_enabled) and (not tgt_group.consisgroup_replication_enabled)):
        raise NotImplementedError()
    src_group = Group(group_snapshot.group)
    self._assert((not src_group.failed_over), ('Group    %s    has    been    failed    over,    it    does    not    support    to    create    group    snapshot.' % src_group.id))
    snapshots_model_update = []
    model_update = {'status': fields.GroupStatus.AVAILABLE}
    src_luns = [Lun(snapshot.volume) for snapshot in snapshots]
    tgt_luns = [Lun(snapshot, is_snapshot=True) for snapshot in snapshots]
    try:
        if (src_luns and tgt_luns):
            self._clone_group(src_luns, tgt_luns)
    except restclient.APIException:
        model_update['status'] = fields.GroupStatus.ERROR
        LOG.exception('Failed    to    create    group    snapshot.')
    for tgt_lun in tgt_luns:
        snapshot_model_update = tgt_lun.get_volume_update()
        snapshot_model_update.update({'id': tgt_lun.os_id, 'status': model_update['status']})
        snapshots_model_update.append(snapshot_model_update)
    return (model_update, snapshots_model_update)
