/** * Insert work items to work map. * @param volumePair - VolumePair * @param step - Move Step */ private void createWorkPlan(final VolumePair volumePair, Step step) throws DiskBalancerException { if (volumePair.getSourceVolUuid().equals(volumePair.getDestVolUuid())) { final String errMsg = "Disk Balancer - Source and destination volumes " + "are same: " + volumePair.getSourceVolUuid(); LOG.warn(errMsg); throw new DiskBalancerException(errMsg, DiskBalancerException.Result.INVALID_MOVE); } long bytesToMove = step.getBytesToMove(); // In case we have a plan with more than // one line of same VolumePair // we compress that into one work order. if (workMap.containsKey(volumePair)) { bytesToMove += workMap.get(volumePair).getBytesToCopy(); } DiskBalancerWorkItem work = new DiskBalancerWorkItem(bytesToMove, 0); // all these values can be zero, if so we will use // values from configuration. work.setBandwidth(step.getBandwidth()); work.setTolerancePercent(step.getTolerancePercent()); work.setMaxDiskErrors(step.getMaxDiskErrors()); workMap.put(volumePair, work); }