Revision a6e6fe48 snf-cyclades-app/synnefo/logic/management/commands/port-create.py

b/snf-cyclades-app/synnefo/logic/management/commands/port-create.py
1
# Copyright 2013 GRNET S.A. All rights reserved.
1
# Copyright 2013-2014 GRNET S.A. All rights reserved.
2 2
#
3 3
# Redistribution and use in source and binary forms, with or
4 4
# without modification, are permitted provided that the following
......
127 127
        owner = None
128 128
        if server_id:
129 129
            owner = "vm"
130
            vm = common.get_vm(server_id, for_update=True)
130
            vm = common.get_resource("server", server_id, for_update=True)
131 131
            #if vm.router:
132 132
            #    raise CommandError("Server '%s' does not exist." % server_id)
133 133
        elif router_id:
134 134
            owner = "router"
135
            vm = common.get_vm(router_id, for_update=True)
135
            vm = common.get_resource("server", router_id, for_update=True)
136 136
            if not vm.router:
137 137
                raise CommandError("Router '%s' does not exist." % router_id)
138 138

  
......
143 143
                raise CommandError("Please specify the owner of the port.")
144 144

  
145 145
        # get the network
146
        network = common.get_network(network_id)
146
        network = common.get_resource("network", network_id)
147 147

  
148 148
        # Get either floating IP or fixed ip address
149 149
        ipaddress = None
150 150
        floating_ip_id = options["floating_ip_id"]
151 151
        ipv4_address = options["ipv4_address"]
152 152
        if floating_ip_id:
153
            ipaddress = common.get_floating_ip_by_id(floating_ip_id,
154
                                                     for_update=True)
153
            ipaddress = common.get_resource("floating-ip", floating_ip_id,
154
                                            for_update=True)
155 155
            if ipv4_address is not None and ipaddress.address != ipv4_address:
156 156
                raise CommandError("Floating IP address '%s' is different from"
157 157
                                   " specified address '%s'" %
158 158
                                   (ipaddress.address, ipv4_address))
159 159

  
160

  
161 160
        # validate security groups
162 161
        sg_list = []
163 162
        if security_group_ids:

Also available in: Unified diff