Source:
private void updateExistingAndNewVolumes(Guid clusterId, Map<Guid, GlusterVolumeEntity> volumesMap) { VDSGroup cluster = getClusterDao().get(clusterId); for (Entry<Guid, GlusterVolumeEntity> entry : volumesMap.entrySet()) { GlusterVolumeEntity volume = entry.getValue(); log.debug("Analyzing volume '{}'", volume.getName()); GlusterVolumeEntity existingVolume = getVolumeDao().getById(entry.getKey()); if (existingVolume == null) { try { createVolume(volume); } catch (Exception e) { log.error("Could not save volume in database: {}", volume.getName(), e.getMessage()); log.debug("Exception", e); } } else { try { log.debug("Volume '{}' exists in engine. Checking if it needs to be updated.", existingVolume.getName()); updateVolume(existingVolume, volume); } catch (Exception e) { log.error("Error while updating volume '{}': {}", volume.getName(), e.getMessage()); log.debug("Exception", e); } } if (cluster.getGlusterCliBasedScheduling() && GlusterConstants.GLUSTER_META_VOLUME_NAME.equalsIgnoreCase(volume.getName())) { VDSReturnValue retValue = runVdsCommand(VDSCommandType.OverrideGlusterVolumeSnapshotSchedule, new GlusterVolumeSnapshotSchedulingVDSParameters(getClusterUtils().getRandomUpServer(volume.getClusterId()) .getId(), true)); if (!retValue.getSucceeded()) { log.warn("Unbale to set volume snapshot scheduling flag to gluster CLI scheduler"); } else { cluster.setGlusterCliBasedScheduling(false); getClusterDao().update(cluster); logUtil.logVolumeMessage(volume, AuditLogType.GLUSTER_CLI_SNAPSHOT_SCHEDULE_DISABLED); } } } }

Target:
private void updateExistingAndNewVolumes(Guid clusterId, Map<Guid, GlusterVolumeEntity> volumesMap) { VDSGroup cluster = getClusterDao().get(clusterId); for (Entry<Guid, GlusterVolumeEntity> entry : volumesMap.entrySet()) { GlusterVolumeEntity volume = entry.getValue(); log.debug("Analyzing volume '{}'", volume.getName()); GlusterVolumeEntity existingVolume = getVolumeDao().getById(entry.getKey()); if (existingVolume == null) { try { createVolume(volume); } catch (Exception e) { log.error("Could not save volume in database: {}", volume.getName(), e.getMessage()); log.debug("Exception", e); } } else { try { log.debug("Volume '{}' exists in engine. Checking if it needs to be updated.", existingVolume.getName()); updateVolume(existingVolume, volume); } catch (Exception e) { log.error("Error while updating volume '{}': {}", volume.getName(), e.getMessage()); log.debug("Exception", e); } } if (GlusterFeatureSupported.glusterSnapshot(cluster.getCompatibilityVersion()) && cluster.getIsGlusterCliBasedSchedulingOn() && (Config.<String> getValue(ConfigValues.GlusterMetaVolumeName)).equalsIgnoreCase(volume.getName())) { VdcReturnValueBase returnValue = Backend.getInstance() .runInternalAction(VdcActionType.DisableGlusterCliSnapshotScheduleInternal, new DisableGlusterCliSnapshotScheduleParameters(volume.getId(), false), ExecutionHandler.createInternalJobContext()); if (!returnValue.getSucceeded()) { log.warn("Unbale to set volume snapshot scheduling flag to gluster CLI scheduler"); } else { cluster.setIsGlusterCliBasedSchedulingOn(false); getClusterDao().update(cluster); logUtil.logVolumeMessage(volume, AuditLogType.GLUSTER_CLI_SNAPSHOT_SCHEDULE_DISABLED); } } } }