Commit 0a84aa41 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Rename "public" to "SNF:ANY_PUBLIC"

Rename reserved work for automatically choosing a public network from
"public" to "SNF:ANY_PUBLIC". Also add the setting description to conf
files.
parent 83b300a1
......@@ -17,6 +17,13 @@
## Network Configuration
##
#
## List of network IDs. All created instances will get a NIC connected to each
## network of this list. If the special network ID "SNF:ANY_PUBLIC" is used,
## Cyclades will automatically choose a public network and connect the server to
## it.
#DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"]
#
#
## Maximum allowed network size for private networks.
#MAX_CIDR_BLOCK = 22
#
......
......@@ -315,7 +315,7 @@ class ServerCreateAPITest(ComputeAPITest):
request = deepcopy(self.request)
request["server"]["networks"] = [bnet3.network.id, bnet4.network.id]
with override_settings(settings,
DEFAULT_INSTANCE_NETWORKS=["public", bnet1.network.id,
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC", bnet1.network.id,
bnet2.network.id]):
with mocked_quotaholder():
response = self.mypost('servers', 'test_user',
......@@ -359,14 +359,16 @@ class ServerCreateAPITest(ComputeAPITest):
# test connect to public netwok
request = deepcopy(self.request)
request["server"]["networks"] = [self.network.id]
with override_settings(settings, DEFAULT_INSTANCE_NETWORKS=["public"]):
with override_settings(settings,
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"]):
response = self.mypost('servers', 'test_user',
json.dumps(request), 'json')
self.assertFault(response, 403, "forbidden")
# test wrong user
request = deepcopy(self.request)
request["server"]["networks"] = [bnet3.network.id]
with override_settings(settings, DEFAULT_INSTANCE_NETWORKS=["public"]):
with override_settings(settings,
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"]):
with mocked_quotaholder():
response = self.mypost('servers', 'dummy_user',
json.dumps(request), 'json')
......
......@@ -17,6 +17,12 @@ POLL_LIMIT = 3600
# Network Configuration
#
# List of network IDs. All created instances will get a NIC connected to each
# network of this list. If the special network ID "SNF:ANY_PUBLIC" is used,
# Cyclades will automatically choose a public network and connect the server to
# it.
DEFAULT_INSTANCE_NETWORKS=["SNF:ANY_PUBLIC"]
# Maximum allowed network size for private networks.
MAX_CIDR_BLOCK = 22
......
......@@ -234,7 +234,7 @@ def create_instance_nics(vm, userid, private_networks=[], floating_ips=[]):
attachments = []
for network_id in settings.DEFAULT_INSTANCE_NETWORKS:
network, address = None, None
if network_id == "public":
if network_id == "SNF:ANY_PUBLIC":
network, address = util.allocate_public_address(backend=vm.backend)
else:
try:
......
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