You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by mr...@apache.org on 2009/12/16 21:56:15 UTC
svn commit: r891443 - /incubator/tashi/trunk/src/tashi/agents/dhcpdns.py
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: