Commit 193a1faa authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Fix bugs in modifying network to IP pool

Fix bugs in network-modify command, and specifically when modifying
a network to a floating IP pool:
* do not check availability of link in backends in which the network is
  already created.
* check about the group list was working only with ganeti>=2.7
* fix wrong string formatting
parent 3c39faa2
......@@ -167,7 +167,11 @@ class Command(BaseCommand):
" still reserved floating IPs.")
raise CommandError(msg)
elif floating_ip_pool is True:
for backend in Backend.objects.filter(offline=False):
existing =\
.values_list("backend", flat=True)
for backend in Backend.objects.filter(offline=False)\
check_link_availability(backend, network)
dhcp = options.get("dhcp")
......@@ -243,8 +247,12 @@ def check_link_availability(backend, network):
link =
for gnet in ganeti_networks:
if (gnet["name"] != name and
(mode, link) in [(m, l) for (_, m, l) in gnet["group_list"]]):
reduce(lambda x, y: x or y,
["(%s, %s)" % (mode, link) in gnet["group_list"]],
# Ganeti >= 2.7
#(mode, link) in [(m, l) for (_, m, l) in gnet["group_list"]]):
msg = "Can not create network '%s' in backend '%s'. Link '%s'" \
" is already used by network '%s" % \
(network, backend, gnet["name"])
(network, backend, link, gnet["name"])
raise CommandError(msg)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment