bug CS-15398: fix for basic zone dns issue in multiple pods

This commit is contained in:
Jayapal 2012-08-29 14:29:25 +05:30 committed by Abhinandan Prateek
parent f128d8e123
commit eb4a3cf6c8

View File

@ -2411,28 +2411,36 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
});
}
private String findDefaultDnsIp(long userVmId) {
NicVO defaultNic = _nicDao.findDefaultNicForVM(userVmId);
//check if DNS provider is the domR
if (!_networkMgr.isProviderSupportServiceInNetwork(defaultNic.getNetworkId(), Service.Dns, Provider.VirtualRouter)) {
return null;
}
NetworkOfferingVO offering = _networkOfferingDao.findById(_networkDao.findById(defaultNic.getNetworkId()).getNetworkOfferingId());
if (offering.getRedundantRouter()) {
return findGatewayIp(userVmId);
}
//find domR's nic in the network
NicVO domrDefaultNic = _nicDao.findByNetworkIdTypeAndGateway(defaultNic.getNetworkId(), VirtualMachine.Type.DomainRouter, defaultNic.getGateway());
return domrDefaultNic.getIp4Address();
}
private String findGatewayIp(long userVmId) {
NicVO defaultNic = _nicDao.findDefaultNicForVM(userVmId);
return defaultNic.getGateway();
}
private String findDefaultDnsIp(long userVmId) {
NicVO defaultNic = _nicDao.findDefaultNicForVM(userVmId);
//check if DNS provider is the domR
if (!_networkMgr.isProviderSupportServiceInNetwork(defaultNic.getNetworkId(), Service.Dns, Provider.VirtualRouter)) {
return null;
}
NetworkOfferingVO offering = _networkOfferingDao.findById(_networkDao.findById(defaultNic.getNetworkId()).getNetworkOfferingId());
if (offering.getRedundantRouter()) {
return findGatewayIp(userVmId);
}
DataCenter dc = _dcDao.findById(_networkMgr.getNetwork(defaultNic.getNetworkId()).getDataCenterId());
boolean isZoneBasic = (dc.getNetworkType() == NetworkType.Basic);
//find domR's nic in the network
NicVO domrDefaultNic;
if (isZoneBasic){
domrDefaultNic = _nicDao.findByNetworkIdTypeAndGateway(defaultNic.getNetworkId(), VirtualMachine.Type.DomainRouter, defaultNic.getGateway());
} else{
domrDefaultNic = _nicDao.findByNetworkIdAndType(defaultNic.getNetworkId(), VirtualMachine.Type.DomainRouter);
}
return domrDefaultNic.getIp4Address();
}
private String findGatewayIp(long userVmId) {
NicVO defaultNic = _nicDao.findDefaultNicForVM(userVmId);
return defaultNic.getGateway();
}
@Override
public boolean applyUserData(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile, DeployDestination dest, List<DomainRouterVO> routers)