Revision 84813b31
b/snf-cyclades-app/synnefo/logic/networks.py | ||
---|---|---|
91 | 91 |
|
92 | 92 |
validate_mac(mac_prefix + "0:00:00:00") |
93 | 93 |
|
94 |
# Check that given link is unique! |
|
95 |
if (link is not None and flavor == "IP_LESS_ROUTED" and |
|
96 |
Network.objects.filter(deleted=False, mode=mode, link=link).exists()): |
|
97 |
msg = "Link '%s' is already used." % link |
|
98 |
raise faults.BadRequest(msg) |
|
99 |
|
|
94 | 100 |
network = Network.objects.create( |
95 | 101 |
name=name, |
96 | 102 |
userid=userid, |
... | ... | |
110 | 116 |
network.link = "%slink-%d" % (settings.BACKEND_PREFIX_ID, network.id) |
111 | 117 |
network.save() |
112 | 118 |
|
113 |
if (flavor == "IP_LESS_ROUTED" and |
|
114 |
Network.objects.filter(deleted=False, mode=mode, link=link).exists()): |
|
115 |
msg = "Link '%s' is already used." % link |
|
116 |
raise faults.BadRequest(msg) |
|
117 |
|
|
118 | 119 |
# Issue commission to Quotaholder and accept it since at the end of |
119 | 120 |
# this transaction the Network object will be created in the DB. |
120 | 121 |
# Note: the following call does a commit! |
Also available in: Unified diff