CS-15398: Fix for dns issue in multiple pods

This commit is contained in:
Jayapal 2012-08-02 12:32:10 +05:30
parent 3e9eea42f0
commit dd4e19c16f
3 changed files with 12 additions and 2 deletions

View File

@ -2379,7 +2379,7 @@ VirtualMachineGuru<DomainRouterVO>, Listener {
}
//find domR's nic in the network
NicVO domrDefaultNic = _nicDao.findByNetworkIdAndType(defaultNic.getNetworkId(), VirtualMachine.Type.DomainRouter);
NicVO domrDefaultNic = _nicDao.findByNetworkIdTypeAndGateway(defaultNic.getNetworkId(), VirtualMachine.Type.DomainRouter, defaultNic.getGateway());
return domrDefaultNic.getIp4Address();
}

View File

@ -33,8 +33,8 @@ public interface NicDao extends GenericDao<NicVO, Long> {
void removeNicsForInstance(long instanceId);
NicVO findByNetworkIdAndType(long networkId, VirtualMachine.Type vmType);
NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId);
NicVO findByNetworkIdTypeAndGateway(long networkId, VirtualMachine.Type vmType, String gateway);
NicVO findDefaultNicForVM(long instanceId);

View File

@ -41,6 +41,7 @@ public class NicDaoImpl extends GenericDaoBase<NicVO, Long> implements NicDao {
AllFieldsSearch = createSearchBuilder();
AllFieldsSearch.and("instance", AllFieldsSearch.entity().getInstanceId(), Op.EQ);
AllFieldsSearch.and("network", AllFieldsSearch.entity().getNetworkId(), Op.EQ);
AllFieldsSearch.and("gateway", AllFieldsSearch.entity().getGateway(), Op.EQ);
AllFieldsSearch.and("vmType", AllFieldsSearch.entity().getVmType(), Op.EQ);
AllFieldsSearch.and("address", AllFieldsSearch.entity().getIp4Address(), Op.EQ);
AllFieldsSearch.and("isDefault", AllFieldsSearch.entity().isDefaultNic(), Op.EQ);
@ -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();