Re: [libvirt] domain.info() sometimes returns state zero for running machines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I found that virt-manager 0.7.0 does the following:

----------------------------------------------------------------------------------------
def _normalize_status(self, status):
       if status == libvirt.VIR_DOMAIN_NOSTATE:
           return libvirt.VIR_DOMAIN_RUNNING
       elif status == libvirt.VIR_DOMAIN_BLOCKED:
           return libvirt.VIR_DOMAIN_RUNNING
       return status

def _update_status(self, status=None):
       if status == None:
           info = self.vm.info()
           status = info[0]
       status = self._normalize_status(status)

       if status != self.lastStatus:
           if self.lastStatus in [ libvirt.VIR_DOMAIN_SHUTDOWN,
                                   libvirt.VIR_DOMAIN_SHUTOFF,
                                   libvirt.VIR_DOMAIN_CRASHED ]:
               # Domain just started. Invalidate inactive xml
               self._orig_inactive_xml = None
           self.lastStatus = status
           self.emit("status-changed", status)
----------------------------------------------------------------------------------------

VIR_DOMAIN_NOSTATE doesn't make much sense in that case?!


Andreas Sommer wrote:
I'm using Xen-3.2-1 on Debian 5.0.1-lenny and retrieve information about running domains using

domain.info()[0]

The domain object is retrieved via connection.lookupByUUIDString(...) and stored as a variable called "domain". Usually the running domains have the state 1 (VIR_DOMAIN_RUNNING) or 2 (VIR_DOMAIN_BLOCKED), but sometimes it happens that 0 (VIR_DOMAIN_NOSTATE) is returned. Why does that happen? I don't think it is an error because then it would've raised an exception...

Regards
Andreas

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]