summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorjaypipes@gmail.com <>2010-07-21 02:57:31 +0000
committerTarmac <>2010-07-21 02:57:31 +0000
commitd44943d84db793937185b044ecb72c52522cfe72 (patch)
tree2d0c0bf0ac3b8fbb6f5a1f9fd8ad793a4c8a901e /nova/compute
parentc771ef02cdbae6a9f409a1ec9fb8aed965f13639 (diff)
parentc39b3add4b3db1c027c32ea0f145c3d3ab3f4d1c (diff)
update the logic for calculating network sizes
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/network.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/nova/compute/network.py b/nova/compute/network.py
index bdb8a22f9..43011f696 100644
--- a/nova/compute/network.py
+++ b/nova/compute/network.py
@@ -162,6 +162,7 @@ class Vlan(datastore.BasicModel):
class BaseNetwork(datastore.BasicModel):
override_type = 'network'
+ NUM_STATIC_IPS = 3 # Network, Gateway, and CloudPipe
@property
def identifier(self):
@@ -237,11 +238,15 @@ class BaseNetwork(datastore.BasicModel):
def available(self):
# the .2 address is always CloudPipe
# and the top <n> are for vpn clients
- for idx in range(3, len(self.network)-(1 + FLAGS.cnt_vpn_clients)):
+ for idx in range(self.num_static_ips, len(self.network)-(1 + FLAGS.cnt_vpn_clients)):
address = str(self.network[idx])
if not address in self.hosts.keys():
yield str(address)
+ @property
+ def num_static_ips(self):
+ return BaseNetwork.NUM_STATIC_IPS
+
def allocate_ip(self, user_id, project_id, mac):
for address in self.available:
logging.debug("Allocating IP %s to %s" % (address, project_id))