Commit 125ba5f1 authored by Christos Stavrakakis's avatar Christos Stavrakakis

cyclades: Remove DEFAULT_ROUTING_TABLE setting

Do not have a default value from 'link' attribute of IP_LESS_ROUTED
networks. Instead if the admin does not specify a value in
network-create command, uniquely name the networks by with the
BACKEND_PREFIX_ID and network id, e.g. snf-link-42.
parent 5a9908a8
......@@ -191,6 +191,9 @@ Cyclades
needed by the newer version of snf-vncauthproxy. Support for older versions
of snf-vncauthproxy has been dropped. See also the upgrade notes for Synnefo
and snf-vncauthproxy-1.5.
* Remove 'DEFAULT_ROUTING_TABLE' setting. If a link for an IP_LESS_ROUTED
network is not specified, the link will be uniquely named
'snf-link-$network_id'.
Cyclades UI
......
......@@ -121,13 +121,13 @@ Existing network flavors are the following:
============== ======= =============================== ====================== ==================
Flavor Name Mode Link MAC prefix Tags
============== ======= =============================== ====================== ==================
IP_LESS_ROUTED routed ``DEFAULT_ROUTING_TABLE`` ``DEFAULT_MAC_PREFIX`` 'ip-less-routed'
IP_LESS_ROUTED routed ``snf-link-$network_id`` ``DEFAULT_MAC_PREFIX`` 'ip-less-routed'
MAC_FILTERED bridged ``DEFAULT_MAC_FILTERED_BRIDGE`` 'pool' 'private'filtered'
PHYSICAL_VLAN bridged 'pool' ``DEFAULT_MAC_PREFIX`` 'physical-vlan'
CUSTOM bridged ``DEFAULT_BRIDGE`` ``DEFAULT_MAC_PREFIX``
============== ======= =============================== ====================== ==================
``DEFAULT_ROUTING_TABLE``, ``DEFAULT_MAC_PREFIX``, ``DEFAULT_BRIDGE``,
``DEFAULT_MAC_PREFIX``, ``DEFAULT_BRIDGE``,
``DEFAULT_MAC_FILTERED_BRIDGE`` are all configurable settings in
``/etc/synnefo/20-snf-cyclades-app-api.conf``. 'pool' is used to denote that a
link or MAC prefix will be allocated from the corresponding Pool. Finally,
......
......@@ -54,14 +54,9 @@
#DEFAULT_BRIDGE = 'br0'
#
## Network flavors that users are allowed to create through API requests
## Available flavors are IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
#API_ENABLED_NETWORK_FLAVORS = ['MAC_FILTERED']
#
## Settings for IP_LESS_ROUTED network:
## -----------------------------------
## In this case VMCs act as routers that forward the traffic to/from VMs, based
## on the defined routing table($DEFAULT_ROUTING_TABLE) and ip rules, that
## exist in every node, implenting an IP-less routed and proxy-arp setup.
#DEFAULT_ROUTING_TABLE = 'snf_public'
#
## Settings for MAC_FILTERED network:
## ------------------------------------------
......
......@@ -53,15 +53,9 @@ DEFAULT_MAC_PREFIX = 'aa:00:0'
DEFAULT_BRIDGE = 'br0'
# Network flavors that users are allowed to create through API requests
# Available flavors are IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
API_ENABLED_NETWORK_FLAVORS = ['MAC_FILTERED']
# Settings for IP_LESS_ROUTED network:
# -----------------------------------
# In this case VMCs act as routers that forward the traffic to/from VMs, based
# on the defined routing table($DEFAULT_ROUTING_TABLE) and ip rules, that
# exist in every node, implenting an IP-less routed and proxy-arp setup.
DEFAULT_ROUTING_TABLE = 'snf_public'
# Settings for MAC_FILTERED network:
# ------------------------------------------
# All networks of this type are bridged to the same bridge. Isolation between
......
......@@ -448,7 +448,7 @@ class Network(models.Model):
},
'IP_LESS_ROUTED': {
'mode': 'routed',
'link': settings.DEFAULT_ROUTING_TABLE,
'link': None,
'mac_prefix': settings.DEFAULT_MAC_PREFIX,
'tags': 'ip-less-routed',
'desc': "Flavor used for an IP-less routed network using"
......
......@@ -33,6 +33,7 @@
from functools import wraps
from django.db import transaction
from django.conf import settings
from snf_django.lib.api import faults
from synnefo.api import util
......@@ -88,11 +89,6 @@ def create(userid, name, flavor, link=None, mac_prefix=None, mode=None,
mac_prefix = mac_prefix or fmac_prefix
tags = tags or ftags
if (flavor == "IP_LESS_ROUTED" and
Network.objects.filter(deleted=False, mode=mode, link=link).exists()):
msg = "Link '%s' is already used." % link
raise faults.BadRequest(msg)
validate_mac(mac_prefix + "0:00:00:00")
network = Network.objects.create(
......@@ -110,6 +106,15 @@ def create(userid, name, flavor, link=None, mac_prefix=None, mode=None,
state='ACTIVE',
drained=drained)
if link is None:
network.link = "%slink-%d" % (settings.BACKEND_PREFIX_ID, network.id)
network.save()
if (flavor == "IP_LESS_ROUTED" and
Network.objects.filter(deleted=False, mode=mode, link=link).exists()):
msg = "Link '%s' is already used." % link
raise faults.BadRequest(msg)
# Issue commission to Quotaholder and accept it since at the end of
# this transaction the Network object will be created in the DB.
# Note: the following call does a commit!
......
......@@ -97,7 +97,8 @@ class NetworkTest(TestCase):
net = networks.create(**kwargs)
self.assertEqual(net.mode, "routed")
self.assertEqual(net.mac_prefix, settings.DEFAULT_MAC_PREFIX)
self.assertEqual(net.link, settings.DEFAULT_ROUTING_TABLE)
self.assertEqual(net.link, "%slink-%d" % (settings.BACKEND_PREFIX_ID,
net.id))
self.assertEqual(net.backend_tag, ["ip-less-routed"])
# CUSTOM
......
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