mirror of
https://github.com/ctripcorp/zeus.git
synced 2024-11-11 09:46:31 +08:00
add domain check
This commit is contained in:
parent
bb66c7f5f5
commit
e24bccb3f1
1 changed files with 10 additions and 0 deletions
|
@ -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<String> 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 {
|
||||
|
|
Loading…
Reference in a new issue