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
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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