Revision 0c50c760 snf-cyclades-app/synnefo/api/floating_ips.py

b/snf-cyclades-app/synnefo/api/floating_ips.py
138 138
            network, address = util.get_free_ip(net_objects)
139 139
        else:
140 140
            try:
141
                network = Network.objects.select_for_update()\
142
                                         .get(id=pool, public=True,
143
                                              deleted=False,
144
                                              floating_ip_pool=True)
145

  
146
            except Network.DoesNotExist:
141
                network_id = int(pool)
142
            except ValueErrorx:
143
                raise faults.BadRequest("Invalid pool ID.")
144
            network = next((n for n in net_objects if n.id==pool), None)
145
            if network is None:
147 146
                raise faults.ItemNotFound("Pool '%s' does not exist." % pool)
148 147
            if address is None:
149 148
                # User did not specified an IP address. Choose a random one

Also available in: Unified diff