Revision 0711e5aa snf-cyclades-app/synnefo/api/util.py
b/snf-cyclades-app/synnefo/api/util.py | ||
---|---|---|
247 | 247 |
except (ValueError, NetworkInterface.DoesNotExist): |
248 | 248 |
raise faults.ItemNotFound('Port not found.') |
249 | 249 |
|
250 |
|
|
250 | 251 |
def get_security_group(sg_id): |
251 | 252 |
try: |
252 | 253 |
sg = SecurityGroup.objects.get(id=sg_id) |
... | ... | |
254 | 255 |
except (ValueError, SecurityGroup.DoesNotExist): |
255 | 256 |
raise faults.ItemNotFound("Not valid security group") |
256 | 257 |
|
258 |
|
|
257 | 259 |
def get_floating_ip_by_address(userid, address, for_update=False): |
258 | 260 |
try: |
259 | 261 |
objects = IPAddress.objects |
... | ... | |
271 | 273 |
if for_update: |
272 | 274 |
objects = objects.select_for_update() |
273 | 275 |
return objects.get(id=floating_ip_id, floating_ip=True, |
274 |
userid=userid, deleted=False)
|
|
276 |
userid=userid, deleted=False) |
|
275 | 277 |
except IPAddress.DoesNotExist: |
276 | 278 |
raise faults.ItemNotFound("Floating IP %s does not exist." % |
277 | 279 |
floating_ip_id) |
Also available in: Unified diff