Changed findOrCreateDhcpServers() to check if start IP is null before retrieving an IP address object

This commit is contained in:
keshav 2011-08-05 16:51:58 -07:00
parent 49709d716a
commit b8c9205000
1 changed files with 1 additions and 1 deletions

View File

@ -1074,7 +1074,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
String defaultNetworkStartIp = null;
if (guestNetwork.getCidr() != null) {
String startIp = _networkMgr.getStartIpAddress(guestNetwork.getId());
if (_ipAddressDao.findByIpAndSourceNetworkId(guestNetwork.getId(), startIp).getAllocatedTime() == null) {
if (startIp != null && _ipAddressDao.findByIpAndSourceNetworkId(guestNetwork.getId(), startIp).getAllocatedTime() == null) {
defaultNetworkStartIp = startIp;
} else if (s_logger.isDebugEnabled()){
s_logger.debug("First ip " + startIp + " in network id=" + guestNetwork.getId() + " is already allocated, can't use it for domain router; will get random ip address from the range");