From 2dd5a554dee644621551417906dec098c1f7f70f Mon Sep 17 00:00:00 2001 From: Jay Pipes Date: Sat, 7 Sep 2013 15:59:35 -0400 Subject: [PATCH] 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 --- files/default/add_floaters.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/files/default/add_floaters.py b/files/default/add_floaters.py index 1e5cb390..ddd2443a 100644 --- a/files/default/add_floaters.py +++ b/files/default/add_floaters.py @@ -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