Fixes duplicate subnet addition in add_floaters.py

While there was a check to make sure that the public network
was already created, there was no such check to ensure that
the subnet for floating IP addresses had not already been
created...

Change-Id: Ib494f9796f89932fd1b87d2d4fa548bd94f29d7b
This commit is contained in:
Jay Pipes 2013-09-07 15:59:35 -04:00
parent 009f8e87ef
commit 2dd5a554de
1 changed files with 7 additions and 0 deletions

View File

@ -31,6 +31,7 @@ class FloatingAddress(object):
network, nova-manage doesn't account for this.
TODO(retr0h): This should really be added to nova-manage.
TODO(jaypipes): Instead of subprocess calls, just use the quantumclient
"""
def __init__(self, args):
@ -82,6 +83,12 @@ class FloatingAddress(object):
print "ERROR: Failed to query the quantum api for the public network"
return
cmd = "quantum subnet-list -Fcidr -fcsv --quote=none | grep '%s'" % cidr
res = subprocess.call(cmd, shell=True)
if res == 0:
# Subnet has already been created...
return
# calculate the start and end values
ip_start = cidr.ip