Revision ab6d1a2f snf-cyclades-app/synnefo/api/management/commands/network-modify.py

b/snf-cyclades-app/synnefo/api/management/commands/network-modify.py
72 72
                 " conversation the network will be created to all"
73 73
                 " available Ganeti backends."),
74 74
        make_option(
75
            '--add-reserved-ips',
76
            dest="add_reserved_ips",
77
            help="Comma seperated list of IPs to externally reserve."),
78
        make_option(
79
            '--remove-reserved-ips',
80
            dest="remove_reserved_ips",
81
            help="Comma seperated list of IPs to externally release."),
82
        make_option(
83 75
            "--add-to-backend",
84 76
            dest="add_to_backend",
85 77
            metavar="BACKEND_ID",
......
148 140
                               " '%s'\n" % (network, backend))
149 141
                        self.stdout.write(msg)
150 142

  
151
        add_reserved_ips = options.get('add_reserved_ips')
152
        remove_reserved_ips = options.get('remove_reserved_ips')
153
        if add_reserved_ips or remove_reserved_ips:
154
            if add_reserved_ips:
155
                add_reserved_ips = add_reserved_ips.split(",")
156
            if remove_reserved_ips:
157
                remove_reserved_ips = remove_reserved_ips.split(",")
158

  
159
            for bnetwork in network.backend_networks.filter(offline=False):
160
                with pooled_rapi_client(bnetwork.backend) as c:
161
                    c.ModifyNetwork(network=network.backend_id,
162
                                    add_reserved_ips=add_reserved_ips,
163
                                    remove_reserved_ips=remove_reserved_ips)
164

  
165 143
        add_to_backend = options["add_to_backend"]
166 144
        if add_to_backend is not None:
167 145
            backend = get_backend(add_to_backend)

Also available in: Unified diff