Commit bf996283 authored by Christos Stavrakakis's avatar Christos Stavrakakis

cyclades: Add --drained option to network-create

parent e294121a
......@@ -138,6 +138,13 @@ class Command(BaseCommand):
"ending IP. If no allocation pools are given, the whole "
"subnet range is used, excluding the gateway IP, the "
"broadcast address and the network address"),
make_option(
"--drained",
dest="drained",
metavar="True|False",
choices=["True", "False"],
default="False",
help="Set network as drained to prevent creation of new ports."),
)
@convert_api_faults
......@@ -160,6 +167,7 @@ class Command(BaseCommand):
allocation_pools = options["allocation_pools"]
floating_ip_pool = parse_bool(options["floating_ip_pool"])
dhcp = parse_bool(options["dhcp"])
drained = parse_bool(options["drained"])
if name is None:
name = ""
......@@ -182,7 +190,8 @@ class Command(BaseCommand):
network = networks.create(userid=userid, name=name, flavor=flavor,
public=public, mode=mode,
link=link, mac_prefix=mac_prefix, tags=tags,
floating_ip_pool=floating_ip_pool)
floating_ip_pool=floating_ip_pool,
drained=drained)
if subnet is not None:
alloc = None
......
......@@ -61,8 +61,7 @@ class Command(BaseCommand):
dest="drained",
metavar="True|False",
choices=["True", "False"],
help="Set as drained to exclude for IP allocation."
" Only used for public networks."),
help="Set network as drained to prevent creation of new ports."),
make_option(
"--floating-ip-pool",
dest="floating_ip_pool",
......
......@@ -64,7 +64,7 @@ def network_command(action):
@transaction.commit_on_success
def create(userid, name, flavor, link=None, mac_prefix=None, mode=None,
floating_ip_pool=False, tags=None, public=False):
floating_ip_pool=False, tags=None, public=False, drained=False):
if flavor is None:
raise faults.BadRequest("Missing request parameter 'type'")
elif flavor not in Network.FLAVORS.keys():
......@@ -107,7 +107,8 @@ def create(userid, name, flavor, link=None, mac_prefix=None, mode=None,
external_router=public,
floating_ip_pool=floating_ip_pool,
action='CREATE',
state='ACTIVE')
state='ACTIVE',
drained=drained)
# Issue commission to Quotaholder and accept it since at the end of
# this transaction the Network object will be created in the DB.
......
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