GlobalLoadBalancerRuleVO gslbRuleWithDomainName = _gslbRuleDao.findByDomainName(domainName);
if (gslbRuleWithDomainName != null) {
throw new InvalidParameterValueException("Domain name " + domainName + "is in use");
}
Region region = _regionDao.findById(regionId);
if (region == null) {
throw new InvalidParameterValueException("Invalid region ID: " + regionId);
}
String providerDnsName = _globalConfigDao.getValue(Config.CloudDnsName.key());
if (!region.checkIfServiceEnabled(Region.Service.Gslb) || (providerDnsName == null)) {
throw new CloudRuntimeException("GSLB service is not enabled in region : " + region.getName());
}
Transaction txn = Transaction.currentTxn();
txn.start();
GlobalLoadBalancerRuleVO newGslbRule = new GlobalLoadBalancerRuleVO(name, description, domainName, algorithm,