Revision 40d53b77 snf-cyclades-app/synnefo/logic/backend.py

b/snf-cyclades-app/synnefo/logic/backend.py
97 97
        #
98 98
        if status == 'success' or (status == 'error' and
99 99
                                   vm.operstate == 'ERROR'):
100
            release_instance_nics(vm)
101
            vm.nics.all().delete()
100
            _process_net_status(vm, etime, nics=[])
102 101
            vm.deleted = True
103 102
            vm.operstate = state_for_success
104 103
            vm.backendtime = etime
......
133 132
    ganeti_nics = process_ganeti_nics(nics)
134 133
    if not nics_changed(vm.nics.order_by('index'), ganeti_nics):
135 134
        log.debug("NICs for VM %s have not changed", vm)
135
        return
136

  
137
    # Get X-Lock on backend before getting X-Lock on network IP pools, to
138
    # guarantee that no deadlock will occur with Backend allocator.
139
    Backend.objects.select_for_update().get(id=vm.backend_id)
136 140

  
137 141
    release_instance_nics(vm)
138 142

  

Also available in: Unified diff