Hi all, I would like to set a short connection timeout (only some seconds) when using libvirt in my Python program instead of the long default one. I found the C function:?virEventAddTimeoutFunc()?in the C libvirt API here: http://libvirt.org/html/libvirt-libvirt.html#virEventAddTimeoutFunc and?eventInvokeTimeoutCallback(timer, callback, opaque)?in?libvirt.py?around the line#150 but I do not know how to use it. I did not find any example on the net. ? I tried this but I get a segmentation fault:?:-( import libvirt def timeout_cb_d(): ? ? print 'Timeout !' try: ? ? # try to set the libvirt timeout to 2 seconds: ? ? t = libvirt.eventInvokeTimeoutCallback(2, timeout_cb_d, "from dom0_class") except: ? ? ... Does anyone can give me a working example please? ? ? Antoine Coetsier -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20110512/ac982f17/attachment.htm>
I'm getting the 7b bluescreen when trying to bring up an imaged XP system for recovery. Looks like possible cause is AHCI on VM if missing from original hardware, or visa versa. Or moving to sata hard drive from pata... which shouldn't be applicable here. Also during an earlier recovery attempt I ran gparted from an ubuntu live CD on the VM/disk image. It gave me a Warning bad sector message.... the disk image is a qcow image. How can it have a bad sector? Thanks all! David.
2011/5/12 Antoine COETSIER <acoetsier at veepee.com>:> Hi all, > I would like to set a short connection timeout (only some seconds) when > using libvirt in my Python program instead of the long default one.What do you mean by connection timeout? The time libvirt waits before reporting an connection attempt (as in calling libvirt.open()) as error? I'm not sure it that value is configurable? Can you be more specific? For example what connection URI do you use in libvirt.open() as the timeout handling will probably be transport specific.> I found the C function:?virEventAddTimeoutFunc()?in the C libvirt API here: > http://libvirt.org/html/libvirt-libvirt.html#virEventAddTimeoutFunc > > and?eventInvokeTimeoutCallback(timer, callback, opaque)?in?libvirt.py?around > the line#150 but I do not know how to use it. I did not find any example on > the net. > > > > I tried this but I get a segmentation fault:?:-( > > import libvirt > > def timeout_cb_d(): > ? ? print 'Timeout !' > > try: > ? ? # try to set the libvirt timeout to 2 seconds: > ? ? t = libvirt.eventInvokeTimeoutCallback(2, timeout_cb_d, "from > dom0_class") > except: > ? ? ... > > Does anyone can give me a working example please?eventInvokeTimeoutCallback has nothing to do with a connection timeout. This function is related to the event handling. eventInvokeTimeoutCallback is there since 2008 and on a quick look it seems like dead code that should be removed as I can't find any caller for it. Matthias
Hello, We have developped our own cloud manager for 2 years now and have been using libvirt to deploy and monitor xen domains with 2 daemons written in Python. As the number of domains increased and when one of them is down, it can ruin our monitoring capability, the daemon getting stuck with the defect connection. Antoine Coetsier -----Message d'origine----- De?: Matthias Bolte [mailto:matthias.bolte at googlemail.com] Envoy??: jeudi 12 mai 2011 19:23 ??: Antoine COETSIER Cc?: libvirt-users at redhat.com; Julien MOREAU Objet?: Re: [libvirt-users] libvirt connection timeout 2011/5/12 Antoine COETSIER <acoetsier at veepee.com>:> Hi all, > I would like to set a short connection timeout (only some seconds) when > using libvirt in my Python program instead of the long default one.What do you mean by connection timeout? The time libvirt waits before reporting an connection attempt (as in calling libvirt.open()) as error? I'm not sure it that value is configurable? Can you be more specific? For example what connection URI do you use in libvirt.open() as the timeout handling will probably be transport specific.> I found the C function:?virEventAddTimeoutFunc()?in the C libvirt API here: > http://libvirt.org/html/libvirt-libvirt.html#virEventAddTimeoutFunc > > and?eventInvokeTimeoutCallback(timer, callback, opaque)?in?libvirt.py?around > the line#150 but I do not know how to use it. I did not find any example on > the net. > > > > I tried this but I get a segmentation fault:?:-( > > import libvirt > > def timeout_cb_d(): > ? ? print 'Timeout !' > > try: > ? ? # try to set the libvirt timeout to 2 seconds: > ? ? t = libvirt.eventInvokeTimeoutCallback(2, timeout_cb_d, "from > dom0_class") > except: > ? ? ... > > Does anyone can give me a working example please?eventInvokeTimeoutCallback has nothing to do with a connection timeout. This function is related to the event handling. eventInvokeTimeoutCallback is there since 2008 and on a quick look it seems like dead code that should be removed as I can't find any caller for it. Matthias