Commit bf996283 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Add --drained option to network-create

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