Revision 85919a0f

b/snf-cyclades-app/synnefo/api/util.py
59 59
from snf_django.lib.api import faults
60 60
from synnefo.db.models import (Flavor, VirtualMachine, VirtualMachineMetadata,
61 61
                               Network, BackendNetwork, NetworkInterface,
62
                               BridgePoolTable, MacPrefixPoolTable)
62
                               BridgePoolTable, MacPrefixPoolTable, Backend)
63 63
from synnefo.db.pools import EmptyPool
64 64

  
65 65
from snf_django.lib.astakos import get_user
......
267 267
    This method should run inside a transaction.
268 268

  
269 269
    """
270

  
271
    # Guarantee exclusive access to backend, because accessing the IP pools of
272
    # the backend networks may result in a deadlock with backend allocator
273
    # which also checks that backend networks have a free IP.
274
    backend = Backend.objects.select_for_update().get(id=backend.id)
275

  
270 276
    address = None
271 277
    if settings.PUBLIC_USE_POOL:
272 278
        (network, address) = allocate_public_address(backend)

Also available in: Unified diff