Fix for dns issue in multiple pods

Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
This commit is contained in:
Jayapal 2012-08-22 16:45:23 +05:30 committed by Abhinandan Prateek
parent eb4e09ec58
commit a5248f1cfc
3 changed files with 13 additions and 1 deletions

View File

@ -2414,7 +2414,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
}
//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

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

View File

@ -45,6 +45,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);
@ -130,6 +131,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();