diff --git a/cloudcontrol/node/hypervisor/domains/vm_tags.py b/cloudcontrol/node/hypervisor/domains/vm_tags.py index 32def24ef38263de4db41a355230cca79deed256..4f9d83ce5d2a6e606d654529f0c222f004056ec3 100644 --- a/cloudcontrol/node/hypervisor/domains/vm_tags.py +++ b/cloudcontrol/node/hypervisor/domains/vm_tags.py @@ -23,7 +23,13 @@ def _vir_tag(func): return try: return func(dom) - except libvirt.libvirtError: + except libvirt.libvirtError as exc: + if 'Domain not found' in str(exc): + # sometimes, libvirt tells us too late when a domain is removed + # we just ignore the error and remove the domain + dom.hypervisor.domains.pop(dom.name) + dom.tag_db.remove_sub_object(dom.name) + return logger.exception('Unexpected libvirt error') dom.hypervisor.handler.virt_connect_restart()