mirror of https://github.com/apache/cloudstack.git
Fix: CS-15398 fix for basic zone dns issue in multiple pods
This commit is contained in:
parent
0dd17697bb
commit
3455305f69
|
|
@ -2465,9 +2465,19 @@ VirtualMachineGuru<DomainRouterVO>, Listener {
|
|||
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 = _nicDao.findByNetworkIdAndType(defaultNic.getNetworkId(), VirtualMachine.Type.DomainRouter);
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public interface NicDao extends GenericDao<NicVO, Long> {
|
|||
void removeNicsForInstance(long instanceId);
|
||||
|
||||
NicVO findByNetworkIdAndType(long networkId, VirtualMachine.Type vmType);
|
||||
NicVO findByNetworkIdTypeAndGateway(long networkId, VirtualMachine.Type vmType, String gateway);
|
||||
|
||||
NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
|
|||
AllFieldsSearch.and("network", AllFieldsSearch.entity().getNetworkId(), Op.EQ);
|
||||
AllFieldsSearch.and("vmType", AllFieldsSearch.entity().getVmType(), Op.EQ);
|
||||
AllFieldsSearch.and("address", AllFieldsSearch.entity().getIp4Address(), Op.EQ);
|
||||
AllFieldsSearch.and("gateway", AllFieldsSearch.entity().getGateway(), Op.EQ);
|
||||
AllFieldsSearch.and("isDefault", AllFieldsSearch.entity().isDefaultNic(), Op.EQ);
|
||||
AllFieldsSearch.and("broadcastUri", AllFieldsSearch.entity().getBroadcastUri(), Op.EQ);
|
||||
AllFieldsSearch.done();
|
||||
|
|
@ -126,6 +127,15 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
|
|||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicVO findByNetworkIdTypeAndGateway(long networkId, VirtualMachine.Type vmType, String gateway) {
|
||||
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("network", networkId);
|
||||
sc.setParameters("vmType", vmType);
|
||||
sc.setParameters("gateway", gateway);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId) {
|
||||
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
|
||||
|
|
|
|||
Loading…
Reference in New Issue