[libvirt] virDomainGetInfo() returns 0 although the domain is not running anymore

Johannes Formann johannes at formann.de
Wed Sep 10 00:12:29 UTC 2008


Hello,

if I understand the API-documentation, virDomainGetInfo() should return
-1 when the domain does not exists anymore, or some other problem
happens.

But with this code below
...
if (virDomainGetInfo(domainPtr,domainInfo) == 0 ) {
        if (debugLevel > 15) {puts("virDomainGetInfo() returns 0");}
        if (domainInfo->state == VIR_DOMAIN_NOSTATE ||
                domainInfo->state == VIR_DOMAIN_RUNNING ||      
                domainInfo->state == VIR_DOMAIN_BLOCKED || 
                domainInfo->state == VIR_DOMAIN_PAUSED ) {
            return(false);
        }
   }
...

I notized, virDomainGetInfo() always returns zero, even if libvirt
prints an error.

If I destroy a domain (xm destroy) I'll get this Message with each call
of virDomainGetInfo(): 
"libvir: Xen Daemon error : GET operation failed:"

But virDomainGetInfo() still returns zero, a bug, or did I
missunderstood the API?


regards

Johannes




More information about the libvir-list mailing list