Revision 3785b737 snf-cyclades-app/synnefo/logic/networks.py
b/snf-cyclades-app/synnefo/logic/networks.py | ||
---|---|---|
63 | 63 |
|
64 | 64 |
|
65 | 65 |
@transaction.commit_on_success |
66 |
def create(userid, name, flavor, subnet=None, gateway=None, subnet6=None, |
|
67 |
gateway6=None, public=False, dhcp=True, link=None, mac_prefix=None, |
|
68 |
mode=None, floating_ip_pool=False, tags=None, backends=None, |
|
66 |
def create(userid, name, flavor, link=None, mac_prefix=None, mode=None, |
|
67 |
floating_ip_pool=False, tags=None, backends=None, public=False, |
|
69 | 68 |
lazy_create=True): |
70 | 69 |
if flavor is None: |
71 | 70 |
raise faults.BadRequest("Missing request parameter 'type'") |
... | ... | |
77 | 76 |
if link is not None and flavor == "PHYSICAL_VLAN": |
78 | 77 |
raise faults.BadRequest("Cannot override PHYSICAL_VLAN link") |
79 | 78 |
|
80 |
if subnet is None and floating_ip_pool: |
|
81 |
raise faults.BadRequest("IPv6 only networks cannot be floating" |
|
82 |
" pools.") |
|
83 |
# Check that network parameters are valid |
|
84 |
subnets.validate_subnet_params(subnet, gateway, subnet6, gateway6) |
|
85 |
|
|
86 | 79 |
try: |
87 | 80 |
fmode, flink, fmac_prefix, ftags = util.values_from_flavor(flavor) |
88 | 81 |
except EmptyPool: |
... | ... | |
117 | 110 |
action='CREATE', |
118 | 111 |
state='ACTIVE') |
119 | 112 |
|
120 |
if subnet: |
|
121 |
subnets._create_subnet(network.id, cidr=subnet, name="", ipversion=4, |
|
122 |
gateway=gateway, dhcp=dhcp, user_id=userid) |
|
123 |
if subnet6: |
|
124 |
subnets._create_subnet(network.id, cidr=subnet6, name="", ipversion=6, |
|
125 |
gateway=gateway6, dhcp=dhcp, user_id=userid) |
|
126 |
|
|
127 | 113 |
# Issue commission to Quotaholder and accept it since at the end of |
128 | 114 |
# this transaction the Network object will be created in the DB. |
129 | 115 |
# Note: the following call does a commit! |
Also available in: Unified diff