Revision 7b438672 snf-cyclades-app/synnefo/logic/callbacks.py

b/snf-cyclades-app/synnefo/logic/callbacks.py
85 85
        try:
86 86
            vm_id = utils.id_from_instance_name(msg["instance"])
87 87
            vm = VirtualMachine.objects.select_for_update().get(id=vm_id)
88
            if vm.deleted:
89
                log.debug("Ignoring message for deleted instance '%s'", vm)
90
                return
88 91
            func(vm, msg)
89 92
        except VirtualMachine.InvalidBackendIdError:
90 93
            log.debug("Ignoring msg for unknown instance %s.", msg['instance'])
91 94
        except VirtualMachine.DoesNotExist:
92 95
            log.error("VM for instance %s with id %d not found in DB.",
93 96
                      msg['instance'], vm_id)
94
        except (Network.InvalidBackendIdError, Network.DoesNotExist) as e:
97
        except (Network.InvalidBackendIdError, Network.DoesNotExist):
95 98
            log.error("Invalid message, can not find network. msg: %s", msg)
96 99
    return wrapper
97 100

  
......
106 109
        try:
107 110
            network_id = utils.id_from_network_name(msg["network"])
108 111
            network = Network.objects.select_for_update().get(id=network_id)
112
            if network.deleted:
113
                log.debug("Ignoring message for deleted network '%s'", network)
114
                return
109 115
            backend = Backend.objects.get(clustername=msg['cluster'])
110 116
            bnet, new = BackendNetwork.objects.get_or_create(network=network,
111 117
                                                             backend=backend)

Also available in: Unified diff