Source:
private void removeDeletedSessions(Guid clusterId, final Map<String, GlusterGeoRepSession> sessionsMap, GlusterVolumeEntity volume) { List<GlusterGeoRepSession> sessionsInDb; if (volume != null) { sessionsInDb = getGeoRepDao().getGeoRepSessions(volume.getId()); } else { sessionsInDb = getGeoRepDao().getGeoRepSessionsInCluster(clusterId); } if (CollectionUtils.isEmpty(sessionsInDb)) { return; } List<GlusterGeoRepSession> sessionsToDelete = new ArrayList<>(); for (GlusterGeoRepSession grepSession: sessionsInDb) { if (sessionsMap.get(grepSession.getSessionKey()) == null) { sessionsToDelete.add(grepSession); } } for (final GlusterGeoRepSession session : sessionsToDelete) { log.info("geo-rep session '{}' detected removed for volume '{}'", session.getSessionKey(), session.getMasterVolumeName()); List<StorageDomainDR> storageDRs = getStorageDomainDRDao().getWithGeoRepSession(session.getId()); for (StorageDomainDR storageDR: storageDRs) { log.info("Deleted geo-rep session '{}' - for volume '{}' has associated DR sync schedules", session.getSessionKey(), session.getMasterVolumeName()); if (storageDR.getJobId() != null) { schedulerUtil.deleteJob(storageDR.getJobId()); } getStorageDomainDRDao().remove(storageDR.getStorageDomainId(), storageDR.getGeoRepSessionId()); StorageDomainStatic storageDomain = getStorageDomainStaticDao().get(storageDR.getStorageDomainId()); logGeoRepMessage(AuditLogType.STORAGE_DOMAIN_DR_DELETED, clusterId, new HashMap<String, String>() { { put("storageDomainName", storageDomain.getName()); put("geoRepSessionKey", session.getSessionKey()); } }); } getGeoRepDao().remove(session.getId()); logGeoRepMessage(AuditLogType.GLUSTER_GEOREP_SESSION_DELETED_FROM_CLI, clusterId, session); } }

Target:
private void removeDeletedSessions(Guid clusterId, final Map<String, GlusterGeoRepSession> sessionsMap, GlusterVolumeEntity volume) { List<GlusterGeoRepSession> sessionsInDb; if (volume != null) { sessionsInDb = getGeoRepDao().getGeoRepSessions(volume.getId()); } else { sessionsInDb = getGeoRepDao().getGeoRepSessionsInCluster(clusterId); } if (CollectionUtils.isEmpty(sessionsInDb)) { return; } List<GlusterGeoRepSession> sessionsToDelete = new ArrayList<>(); for (GlusterGeoRepSession grepSession: sessionsInDb) { if (sessionsMap.get(grepSession.getSessionKey()) == null) { sessionsToDelete.add(grepSession); } } for (final GlusterGeoRepSession session : sessionsToDelete) { log.info("geo-rep session '{}' detected removed for volume '{}'", session.getSessionKey(), session.getMasterVolumeName()); List<StorageDomainDR> storageDRs = getStorageDomainDRDao().getWithGeoRepSession(session.getId()); for (StorageDomainDR storageDR: storageDRs) { log.info("Geo-rep session '{}'- for volume '{}' that has been deleted from CLI " + "has associated DR sync schedules which will be removed", session.getSessionKey(), session.getMasterVolumeName()); if (storageDR.getJobId() != null) { schedulerUtil.deleteJob(storageDR.getJobId()); } getStorageDomainDRDao().remove(storageDR.getStorageDomainId(), storageDR.getGeoRepSessionId()); StorageDomainStatic storageDomain = getStorageDomainStaticDao().get(storageDR.getStorageDomainId()); logGeoRepMessage(AuditLogType.STORAGE_DOMAIN_DR_DELETED, clusterId, new HashMap<String, String>() { { put("storageDomainName", storageDomain.getName()); put("geoRepSessionKey", session.getSessionKey()); } }); } getGeoRepDao().remove(session.getId()); logGeoRepMessage(AuditLogType.GLUSTER_GEOREP_SESSION_DELETED_FROM_CLI, clusterId, session); } }