incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mry...@apache.org
Subject svn commit: r891443 - /incubator/tashi/trunk/src/tashi/agents/dhcpdns.py
Date Wed, 16 Dec 2009 21:56:15 GMT
Author: mryan3
Date: Wed Dec 16 21:56:14 2009
New Revision: 891443

URL: http://svn.apache.org/viewvc?rev=891443&view=rev
Log:
Gracefully deal with running out of IP addresses


Modified:
    incubator/tashi/trunk/src/tashi/agents/dhcpdns.py

Modified: incubator/tashi/trunk/src/tashi/agents/dhcpdns.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/agents/dhcpdns.py?rev=891443&r1=891442&r2=891443&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/agents/dhcpdns.py (original)
+++ incubator/tashi/trunk/src/tashi/agents/dhcpdns.py Wed Dec 16 21:56:14 2009
@@ -89,11 +89,15 @@
 		network = nic.network
 		allocatedIP = None
 		requestedIP = self.strToIp(nic.ip)
+		wrapToMinAlready = False
 		if (requestedIP <= self.ipMax[network] and requestedIP >= self.ipMin[network] and
(requestedIP not in self.usedIPs)):
 			allocatedIP = requestedIP
 		while (allocatedIP == None):
+			if (self.currentIP[network] > self.ipMax[network] and wrapToMinAlready):
+				raise UserWarning("No available IP addresses for network %d" % (network))
 			if (self.currentIP[network] > self.ipMax[network]):
 				self.currentIP[network] = self.ipMin[network]
+				wrapToMinAlready = True
 			elif (self.currentIP[network] in self.usedIPs):
 				self.currentIP[network] = self.currentIP[network] + 1
 			else:



Mime
View raw message