Skip to content
Snippets Groups Projects
Commit 5b4552dc authored by Anael Beutot's avatar Anael Beutot
Browse files

Recreate domain when libvirt send us a create event and domain already exists.

parent 35b3fe63
No related branches found
No related tags found
No related merge requests found
......@@ -652,6 +652,13 @@ class Hypervisor(object):
event = EVENTS[event]
if event == 'Added':
if dom.name() in self.domains:
# sometimes libvirt send us the same event multiple times
# this can be the result of a change in the domain configuration
# we first remove the old domain
vm = self.domains.pop(dom.name())
self.handler.tag_db.remove_sub_object(vm.name)
logger.debug('Domain %s recreated', dom.name())
vm = VirtualMachine(dom, self)
logger.info('Created domain %s', vm.name)
self.domains[vm.name] = vm
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment