diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index cf94b95353e..d9ce3fd3689 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -327,6 +327,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati private int _maxVolumeSizeInGb = Integer.parseInt(Config.MaxVolumeSize.getDefaultValue()); private long _defaultPageSize = Long.parseLong(Config.DefaultPageSize.getDefaultValue()); + private static final String DOMAIN_NAME_PATTERN = "^((?!-)[A-Za-z0-9-]{1,63}(? configValuesForValidation; private Set weightBasedParametersForValidation; private Set overprovisioningFactorsForValidation; @@ -843,6 +844,15 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati if (!NetUtils.verifyInstanceName(value)) { return "Instance name can not contain hyphen, space or plus sign"; } + } else if (range.equalsIgnoreCase("domainName")) { + String domainName = value; + if (value.startsWith("*")) { + domainName = value.substring(2); //skip the "*." + } + //max length for FQDN is 253 + 2, code adds xxx-xxx-xxx-xxx to domain name when creating URL + if (domainName.length() >= 238 || !domainName.matches(DOMAIN_NAME_PATTERN)) { + return "Please enter a valid string for domain name, prefixed with '*.' if applicable"; + } } else if (range.equals("routes")) { String[] routes = value.split(","); for (String route : routes) {