def _pre_fail_check(self, volumes, statuc_check_func):
        normal_volumes = []
        pair_ids = []
        group_ids = set()
        volume_pair_infos = {}

        for v in volumes:
            drv_data = huawei_utils.to_dict(v.replication_driver_data)
            pair_id = drv_data.get('pair_id')
            if not pair_id:
                normal_volumes.append(v.id)
                continue

            pair_info = self.pair_op.get_info(pair_id)
            volume_pair_infos[v.id] = pair_info

            cg_id = pair_info.get('CGID')
            if cg_id:
                if cg_id not in group_ids:
                    group_ids.add(cg_id)
            else:
                pair_ids.append(pair_id)

        for pair_info in six.itervalues(volume_pair_infos):
            if not statuc_check_func(pair_info):
                msg = _('Replication pair %(id)s is not at the status '
                        'failover/failback available, RUNNINGSTATUS: %(run)s, '
                        'SECRESDATASTATUS: %(sec)s.'
                        ) % {'id': pair_info['ID'],
                             'run': pair_info['RUNNINGSTATUS'],
                             'sec': pair_info['SECRESDATASTATUS']}
                LOG.error(msg)
                raise exception.VolumeBackendAPIException(data=msg)

        return normal_volumes, list(group_ids), pair_ids, volume_pair_infos
    def _remove_volumes_from_group(self, group_id, volumes):
        for volume in volumes:
            drv_data = huawei_utils.to_dict(volume.replication_driver_data)
            pair_id = drv_data.get('pair_id')
            if not pair_id:
                LOG.warning("Volume %s doesn't have replication.", volume.id)
                continue

            self.group_op.remove_pair_from_group(group_id, pair_id)
            self.pair_op.sync(pair_id)