Revision 03992c72 snf-cyclades-app/synnefo/api/util.py

b/snf-cyclades-app/synnefo/api/util.py
59 59
                                BadMediaType)
60 60
from synnefo.db.models import (Flavor, VirtualMachine, VirtualMachineMetadata,
61 61
                               Network, BackendNetwork, NetworkInterface,
62
                               BridgePool)
62
                               BridgePoolTable)
63 63

  
64 64
from synnefo.lib.astakos import get_user
65 65
from synnefo.plankton.backend import ImageBackend
66
from synnefo.logic import ippool
66
from synnefo.db.pools import IPPool
67 67
from synnefo.settings import MAX_CIDR_BLOCK
68 68

  
69 69

  
......
231 231
def get_network_free_address(network):
232 232
    """Reserve an IP address from the IP Pool of the network.
233 233

  
234
    Raises Network.DoesNotExist , ippool.IPPool.IPPoolExhausted
234
    Raises Network.DoesNotExist , IPPool.IPPoolExhausted
235 235

  
236 236
    """
237 237

  
238 238
    # Get the Network object in exclusive mode in order to
239 239
    # safely (isolated) reserve an IP address
240 240
    network = Network.objects.select_for_update().get(id=network.id)
241
    pool = ippool.IPPool(network)
241
    pool = IPPool(network)
242 242
    address = pool.get_free_address()
243 243
    pool.save()
244 244
    return address
......
399 399
    if network_type == 'PRIVATE_MAC_FILTERED':
400 400
        link = settings.PRIVATE_MAC_FILTERED_BRIDGE
401 401
    elif network_type == 'PRIVATE_PHYSICAL_VLAN':
402
        link = BridgePool.get_available().value
402
        pool = BridgePoolTable.get_pool()
403
        link = pool.get()
404
        pool.save()
403 405
    elif network_type == 'CUSTOM_ROUTED':
404 406
        link = settings.CUSTOM_ROUTED_ROUTING_TABLE
405 407
    elif network_type == 'CUSTOM_BRIDGED':

Also available in: Unified diff