Revision 014df29c

b/snf-cyclades-app/synnefo/api/management/commands/port-create.py
68 68
            dest="server_id",
69 69
            default=None,
70 70
            help="The ID of the server that the port will be connected to."),
71
        make_option(
72
            "--router",
73
            dest="router_id",
74
            default=None,
75
            help="The ID of the router that the port will be connected to."),
71
        #make_option(
72
        #    "--router",
73
        #    dest="router_id",
74
        #    default=None,
75
        #    help="The ID of the router that the port will be connected to."),
76 76
        make_option(
77 77
            "--floating-ip",
78 78
            dest="floating_ip_id",
......
94 94
        name = options["name"]
95 95
        network_id = options["network_id"]
96 96
        server_id = options["server_id"]
97
        router_id = options["router_id"]
97
        #router_id = options["router_id"]
98
        router_id = None
98 99
        floating_ip_id = options["floating_ip_id"]
99 100
        # assume giving security groups comma separated
100 101
        security_group_ids = options["security-groups"]
101 102

  
102 103
        if not name:
103
            name=""
104
            name = ""
104 105

  
105 106
        if (server_id and router_id) or not (server_id or router_id):
106 107
            raise CommandError("Please give either a server or a router id")
......
111 112
        if server_id:
112 113
            owner = "vm"
113 114
            vm = get_vm(server_id)
114
            if vm.router:
115
                raise CommandError("Server '%s' does not exist." % server_id)
115
            #if vm.router:
116
            #    raise CommandError("Server '%s' does not exist." % server_id)
116 117
        elif router_id:
117 118
            owner = "router"
118 119
            vm = get_vm(router_id)
......
121 122
        else:
122 123
            raise CommandError("Neither server or router is specified")
123 124

  
125
        floating_ip = None
124 126
        if floating_ip_id:
125 127
            floating_ip = get_floating_ip_by_id(floating_ip_id,
126 128
                                                for_update=True)
b/snf-cyclades-app/synnefo/logic/servers.py
305 305
        # TODO: What if is in settings ?
306 306
        raise faults.BuildInProgress('Network not active yet')
307 307

  
308
    device_owner = "router" if vm.router else "vm"
308
    #device_owner = "router" if vm.router else "vm"
309
    device_owner = "vm"
309 310
    nic = NetworkInterface.objects.create(machine=vm, network=network,
310 311
                                          state="BUILDING",
311 312
                                          device_owner=device_owner)

Also available in: Unified diff