Revision 9446e7e5
b/snf-cyclades-app/conf/20-snf-cyclades-app-api.conf | ||
---|---|---|
17 | 17 |
## Network Configuration |
18 | 18 |
## |
19 | 19 |
# |
20 |
## List of network IDs. All created instances will get a NIC connected to each |
|
21 |
## network of this list. If the special network ID "SNF:ANY_PUBLIC" is used, |
|
22 |
## Cyclades will automatically choose a public network and connect the server to |
|
23 |
## it. |
|
24 |
#DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"] |
|
25 |
# |
|
26 |
# |
|
20 | 27 |
## Maximum allowed network size for private networks. |
21 | 28 |
#MAX_CIDR_BLOCK = 22 |
22 | 29 |
# |
b/snf-cyclades-app/synnefo/api/test/servers.py | ||
---|---|---|
315 | 315 |
request = deepcopy(self.request) |
316 | 316 |
request["server"]["networks"] = [bnet3.network.id, bnet4.network.id] |
317 | 317 |
with override_settings(settings, |
318 |
DEFAULT_INSTANCE_NETWORKS=["public", bnet1.network.id,
|
|
318 |
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC", bnet1.network.id,
|
|
319 | 319 |
bnet2.network.id]): |
320 | 320 |
with mocked_quotaholder(): |
321 | 321 |
response = self.mypost('servers', 'test_user', |
... | ... | |
359 | 359 |
# test connect to public netwok |
360 | 360 |
request = deepcopy(self.request) |
361 | 361 |
request["server"]["networks"] = [self.network.id] |
362 |
with override_settings(settings, DEFAULT_INSTANCE_NETWORKS=["public"]): |
|
362 |
with override_settings(settings, |
|
363 |
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"]): |
|
363 | 364 |
response = self.mypost('servers', 'test_user', |
364 | 365 |
json.dumps(request), 'json') |
365 | 366 |
self.assertFault(response, 403, "forbidden") |
366 | 367 |
# test wrong user |
367 | 368 |
request = deepcopy(self.request) |
368 | 369 |
request["server"]["networks"] = [bnet3.network.id] |
369 |
with override_settings(settings, DEFAULT_INSTANCE_NETWORKS=["public"]): |
|
370 |
with override_settings(settings, |
|
371 |
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"]): |
|
370 | 372 |
with mocked_quotaholder(): |
371 | 373 |
response = self.mypost('servers', 'dummy_user', |
372 | 374 |
json.dumps(request), 'json') |
b/snf-cyclades-app/synnefo/app_settings/default/api.py | ||
---|---|---|
17 | 17 |
# Network Configuration |
18 | 18 |
# |
19 | 19 |
|
20 |
# List of network IDs. All created instances will get a NIC connected to each |
|
21 |
# network of this list. If the special network ID "SNF:ANY_PUBLIC" is used, |
|
22 |
# Cyclades will automatically choose a public network and connect the server to |
|
23 |
# it. |
|
24 |
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"] |
|
25 |
|
|
20 | 26 |
# Maximum allowed network size for private networks. |
21 | 27 |
MAX_CIDR_BLOCK = 22 |
22 | 28 |
|
b/snf-cyclades-app/synnefo/logic/servers.py | ||
---|---|---|
234 | 234 |
attachments = [] |
235 | 235 |
for network_id in settings.DEFAULT_INSTANCE_NETWORKS: |
236 | 236 |
network, address = None, None |
237 |
if network_id == "public":
|
|
237 |
if network_id == "SNF:ANY_PUBLIC":
|
|
238 | 238 |
network, address = util.allocate_public_address(backend=vm.backend) |
239 | 239 |
else: |
240 | 240 |
try: |
Also available in: Unified diff