Revision 44bd008a

b/snf-cyclades-app/synnefo/api/management/commands/network-create.py
135 135
            help="IP allocation pools to be used for assigning IPs to"
136 136
                 " VMs. Can be used multiple times. Syntax: \n"
137 137
                 "192.168.42.220,192.168.42.240. Starting IP must proceed "
138
                 "ending IP."),
138
                 "ending IP. If no allocation pools are given, the whole "
139
                 "subnet range is used, excluding the gateway IP, the "
140
                 "broadcast address and the network address"),
139 141
    )
140 142

  
141 143
    @convert_api_faults
......
183 185
                                  floating_ip_pool=floating_ip_pool)
184 186

  
185 187
        if subnet is not None:
186
            alloc = subnets.parse_allocation_pools(allocation_pools)
188
            alloc = None
189
            if allocation_pools is not None:
190
                alloc = subnets.parse_allocation_pools(allocation_pools)
191
                alloc.sort()
187 192
            name = "IPv4 Subnet of Network %s" % network.id
188 193
            subnets.create_subnet(network.id, cidr=subnet, name=name,
189 194
                                  ipversion=4, gateway=gateway, dhcp=dhcp,
190 195
                                  user_id=userid,
191
                                  allocation_pools=sorted(alloc))
196
                                  allocation_pools=alloc)
192 197

  
193 198
        if subnet6 is not None:
194 199
            name = "IPv6 Subnet of Network %s" % network.id
b/snf-cyclades-app/synnefo/api/management/commands/subnet-create.py
63 63
                    help="IP allocation pools to be used for assigning IPs to"
64 64
                    " VMs. Can be used multiple times. Syntax: \n"
65 65
                    "192.168.42.220,192.168.42.240. Starting IP must proceed "
66
                    "ending IP."),
66
                    "ending IP.20,192.168.42.240. Starting IP must proceed "
67
                    "ending IP. If no allocation pools are given, the whole "
68
                    "subnet range is used, excluding the gateway IP, the "
69
                    "broadcast address and the network address"),
67 70
        make_option("--name", dest="name",
68 71
                    help="An arbitrary string for naming the subnet."),
69 72
        make_option("--ip-version", dest="ipversion", choices=["4", "6"],
......
110 113
        dns = options["dns"]
111 114
        host_routes = options["host_routes"]
112 115

  
113
        alloc = subnets.parse_allocation_pools(allocation_pools)
116
        alloc = None
117
        if allocation_pools is not None:
118
            alloc = subnets.parse_allocation_pools(allocation_pools)
119
            alloc.sort()
114 120

  
115 121
        sub = subnets.create_subnet(name=name,
116 122
                                    network_id=network_id,
117 123
                                    cidr=cidr,
118
                                    allocation_pools=sorted(alloc),
124
                                    allocation_pools=alloc,
119 125
                                    gateway=gateway,
120 126
                                    ipversion=ipversion,
121 127
                                    dhcp=dhcp,
b/snf-cyclades-app/synnefo/logic/subnets.py
293 293
            alloc.append([ipaddr.IPv4Address(start),
294 294
                          ipaddr.IPv4Address(end)])
295 295
        except ValueError:
296
            raise CommandError("Malformed IPv4 address")
296
            raise faults.BadRequest("Malformed IPv4 address")
297 297

  
298 298
    return alloc

Also available in: Unified diff