Revision 0069a20c snf-cyclades-app/synnefo/logic/ports.py

b/snf-cyclades-app/synnefo/logic/ports.py
55 55
    return decorator
56 56

  
57 57
@transaction.commit_on_success
58
def create(userid, network, machine, name="", security_groups=None,
58
def create(network, machine, name="", security_groups=None,
59 59
           device_owner='vm'):
60 60

  
61 61
    if network.state != 'ACTIVE':
......
65 65
    port = NetworkInterface.objects.create(name=name,
66 66
                                           network=network,
67 67
                                           machine=machine,
68
                                           userid=machine.userid,
68 69
                                           device_owner=device_owner,
69 70
                                           state="BUILDING")
70 71
    #add the security groups if any
......
76 77
        IPAddress.objects.create(subnet=subn,
77 78
                                 network=network,
78 79
                                 nic=port,
79
                                 userid=userid,
80
                                 userid=machine.userid,
80 81
                                 # FIXME
81 82
                                 address="192.168.0." + str(subn.id))
82 83

  
......
86 87
    #quotas.issue_and_accept_commission(new_port)
87 88

  
88 89
    return port
90

  
91
@transaction.commit_on_success
92
def delete(port):
93
    port.ips.all().delete()
94
    port.delete()

Also available in: Unified diff