Revision 09b76b7e snf-cyclades-app/synnefo/api/util.py
b/snf-cyclades-app/synnefo/api/util.py | ||
---|---|---|
231 | 231 |
Return a NetworkInteface instance or raise ItemNotFound. |
232 | 232 |
""" |
233 | 233 |
try: |
234 |
objects = NetworkInterface.objects |
|
234 |
objects = NetworkInterface.objects.filter(userid=user_id)
|
|
235 | 235 |
if for_update: |
236 | 236 |
objects = objects.select_for_update() |
237 |
|
|
238 |
if not user_id: |
|
239 |
port = objects.get(id=port_id) |
|
240 |
else: |
|
241 |
port = objects.get(network__userid=user_id, id=port_id) |
|
242 |
|
|
243 | 237 |
# if (port.device_owner != "vm") and for_update: |
244 | 238 |
# raise faults.BadRequest('Can not update non vm port') |
245 |
|
|
246 |
return port |
|
239 |
return objects.get(id=port_id) |
|
247 | 240 |
except (ValueError, NetworkInterface.DoesNotExist): |
248 |
raise faults.ItemNotFound('Port not found.')
|
|
241 |
raise faults.ItemNotFound("Port '%s' not found." % port_id)
|
|
249 | 242 |
|
250 | 243 |
|
251 | 244 |
def get_security_group(sg_id): |
Also available in: Unified diff