Revision 72dea98f snf-cyclades-app/synnefo/api/floating_ips.py
b/snf-cyclades-app/synnefo/api/floating_ips.py | ||
---|---|---|
144 | 144 |
address = util.get_network_free_address(network) # Get X-Lock |
145 | 145 |
else: |
146 | 146 |
if FloatingIP.objects.filter(network=network, |
147 |
deleted=False, |
|
147 | 148 |
ipv4=address).exists(): |
148 | 149 |
msg = "Floating IP '%s' is reserved" % address |
149 | 150 |
raise faults.Conflict(msg) |
... | ... | |
190 | 191 |
raise faults.ItemNotFound("Floating IP '%s' does not exist" % |
191 | 192 |
floating_ip_id) |
192 | 193 |
|
194 |
# Since we have got an exlusively lock in floating IP, and since |
|
195 |
# to remove a floating IP you need the same lock, the in_use() query |
|
196 |
# is safe |
|
193 | 197 |
if floating_ip.in_use(): |
194 | 198 |
msg = "Floating IP '%s' is used" % floating_ip.id |
195 | 199 |
raise faults.Conflict(message=msg) |
Also available in: Unified diff