Revision a1713485 snf-cyclades-app/synnefo/api/util.py
b/snf-cyclades-app/synnefo/api/util.py | ||
---|---|---|
47 | 47 |
|
48 | 48 |
from snf_django.lib.api import faults |
49 | 49 |
from synnefo.db.models import (Flavor, VirtualMachine, VirtualMachineMetadata, |
50 |
Network, NetworkInterface, BridgePoolTable, |
|
51 |
MacPrefixPoolTable, IPAddress, IPPoolTable) |
|
50 |
Network, NetworkInterface, SecurityGroup, |
|
51 |
BridgePoolTable, MacPrefixPoolTable, IPAddress, |
|
52 |
IPPoolTable) |
|
52 | 53 |
from synnefo.db import pools |
53 | 54 |
|
54 | 55 |
from synnefo.plankton.utils import image_backend |
... | ... | |
243 | 244 |
except (ValueError, NetworkInterface.DoesNotExist): |
244 | 245 |
raise faults.ItemNotFound('Port not found.') |
245 | 246 |
|
247 |
def get_security_group(sg_id): |
|
248 |
try: |
|
249 |
sg = SecurityGroup.objects.get(id=sg_id) |
|
250 |
return sg |
|
251 |
except (ValueError, SecurityGroup.DoesNotExist): |
|
252 |
raise faults.ItemNotFound("Not valid security group") |
|
246 | 253 |
|
247 | 254 |
def get_floating_ip_by_address(userid, address, for_update=False): |
248 | 255 |
try: |
Also available in: Unified diff