diff --git a/src/main/java/com/ctrip/zeus/service/model/handler/impl/SlbSyncImpl.java b/src/main/java/com/ctrip/zeus/service/model/handler/impl/SlbSyncImpl.java index 17911f39..0722737c 100644 --- a/src/main/java/com/ctrip/zeus/service/model/handler/impl/SlbSyncImpl.java +++ b/src/main/java/com/ctrip/zeus/service/model/handler/impl/SlbSyncImpl.java @@ -88,6 +88,16 @@ public class SlbSyncImpl implements SlbSync { if (slb.getSlbServers() == null || slb.getSlbServers().size() == 0) { throw new ValidationException("Slb with invalid server data cannot be persisted."); } + Set existingHost = new HashSet<>(); + for (VirtualServer virtualServer : slb.getVirtualServers()) { + for (Domain domain : virtualServer.getDomains()) { + String key = domain.getName() + ":" + virtualServer.getPort(); + if (existingHost.contains(key)) + throw new ValidationException("Duplicate domain and port is found: " + key); + else + existingHost.add(key); + } + } } private boolean removable(SlbDo d) throws DalException {