Commit 8745ef8d authored by Anael Beutot's avatar Anael Beutot
Browse files

Update libvirt related tags when libvirt connection state changes.

parent c7abd77f
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -45,7 +45,9 @@ class Handler(HostHandler):
    def virt_connected(self, value):
        self._virt_connected = value
        # update tags
        for tag in ('vir_status', 'hvver', 'libvirtver'):
        for tag in ('vir_status', 'sto', 'nvm', 'vmpaused', 'vmstarted',
                    'vmstopped', 'hvver', 'libvirtver', 'hv'):
            # TODO tag annoucement
            self.tag_db['__main__'][tag].calculate_value()

    def start(self):
@@ -287,6 +289,11 @@ class Hypervisor(object):
                             state)
                vm.state = state

        # update domain state counts
        for tag in ('nvm', 'vmpaused', 'vmstarted', 'vmstopped'):
            # TODO tag announcement
            self.handler.tag_db['__main__'][tag].calculate_value()

    def vm_define(self, xml_desc):
        """Create a VM on the Hypervisor
        :param str xml_desc: XML description in libvirt format
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ class VirtualMachine(object):
    @state.setter
    def state(self, value):
        self._state = value
        # TODO tag announcement
        self.tags['status'].value = value

    @property