Revision c988fcca snf-cyclades-app/synnefo/api/util.py

b/snf-cyclades-app/synnefo/api/util.py
284 284
    return address
285 285

  
286 286

  
287
def get_nic(vm, nic_id):
287
def get_vm_nic(vm, nic_id):
288 288
    """Get a VMs NIC by its ID."""
289 289
    try:
290 290
        return vm.nics.get(id=nic_id)
......
292 292
        raise faults.ItemNotFound("NIC '%s' not found" % nic_id)
293 293

  
294 294

  
295
def get_nic(nic_id):
296
    try:
297
        return NetworkInterface.objects.get(id=nic_id)
298
    except NetworkInterface.DoesNotExist:
299
        raise faults.ItemNotFound("NIC '%s' not found" % nic_id)
300

  
301

  
295 302
def render_metadata(request, metadata, use_values=False, status=200):
296 303
    if request.serialization == 'xml':
297 304
        data = render_to_string('metadata.xml', {'metadata': metadata})
......
313 320
    return HttpResponse(data, status=status)
314 321

  
315 322

  
316
def construct_nic_id(nic):
317
    return "-".join(["nic", unicode(nic.machine.id), unicode(nic.id)])
318

  
319

  
320 323
def verify_personality(personality):
321 324
    """Verify that a a list of personalities is well formed"""
322 325
    if len(personality) > settings.MAX_PERSONALITY:

Also available in: Unified diff