Commit b3f2dce2 authored by Dionysis Grigoropoulos's avatar Dionysis Grigoropoulos
Browse files

cyclades: Fix a bug in logic/subnets.py

* Don't allow creation of subnets on a network that is initilized in a
backend
parent cc1fc541
......@@ -209,4 +209,4 @@ class Command(BaseCommand):
# TODO: Add --wait option to track job progress and report successful
# creation in each backend.
self.stdout.write("\nSuccessfully issued job to create network in"
" in backends\n")
" backends\n")
......@@ -93,6 +93,11 @@ def _create_subnet(network_id, user_id, cidr, name, ipversion=4, gateway=None,
check_number_of_subnets(network, ipversion)
if network.backend_networks.exists():
raise api.faults.BadRequest("Cannot create subnet in network %s, VMs"
" are already connected to this network" %
network_id)
try:
cidr_ip = ipaddr.IPNetwork(cidr)
except ValueError:
......
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