[libvirt-users] Status of Host machine.

Sijo Jose mailtosijojose at gmail.com
Fri Jun 13 09:35:34 UTC 2014


Hi Michal,

virConnectOpen is for connecting to a host right..?

I want to check the host status, whether the connection to the host is
active or not..
for that purpose we have to use virConnectIsAlive()

I'm using libvirt python bindings,
here is the function defnintion.

    def isAlive(self):
        """Determine if the connection to the hypervisor is still alive

        A connection will be classed as alive if it is either local, or
running
        over a channel (TCP or UNIX socket) which is not closed. """
        ret = libvirtmod.virConnectIsAlive(self._o)
        if ret == -1: raise libvirtError ('virConnectIsAlive() failed',
conn=self)
        return ret

Once if you connect to a host thereafter it is always giving status as
1(true), no matter whether the connection is broken or not..

-Sijo


On Fri, Jun 13, 2014 at 1:47 PM, Michal Privoznik <mprivozn at redhat.com>
wrote:

> On 11.06.2014 14:30, Sijo Jose wrote:
>
>>
>> Hi,
>> Using libvirt how can we check the status of a remote/local host machine..
>> isAlive() method is giving true even if the internet connection is broken
>> OR
>>   libvirt demon in the remote machine is being stopped.
>>
>> so isAlive() does not seems to be handy,
>>
>> Is there some other way to get the status of remote host..?
>>
>
> Isn't virConnectOpen*() enough? If it returns NULL then you can tell by
> error message what went wrong.
>
> Michal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20140613/0986506e/attachment.htm>


More information about the libvirt-users mailing list