Description of problem: libvirtd returns but libvirt is not fully initialized. Version-Release number of selected component (if applicable): 0.7.0 How reproducible: Always Steps to Reproduce: 1. # libvirtd -d && /etc/init.d/libvirt-suspendonreboot start 2. libvirt should be started and the virsh-based script should work Actual results: The virsh-based script can't connect to libvirt: resuming debian_sid ... error: unable to connect to '/var/run/libvirt/libvirt-sock': Connexion refusée error: failed to connect to the hypervisor Expected results: The virsh-based script should be able to connect to libvirt. Additional info: If the virsh-based script is launched 1/2 second later it works great: # libvirtd -d && sleep 0.5 && /etc/init.d/libvirt-suspendonreboot start resuming debian_sid ... Domain restored from /var/lib/libvirt/autosuspend/debian_sid.dump This problem is specially annoying when a virsh-based script should be executed at boot time, just after libvirt init script.
This patch should address the problem http://www.redhat.com/archives/libvir-list/2009-October/msg00654.html the libvirt initscript won't exit until at least the network sockets are setup, even though QEMU isn't initialized yet. So any virsh process run immediately after starting will successfully make the TCP connection & be blocked until initialization is fully completed. This should avoids the 'failed to connect' race
I confirm your patch fixes the issue.
Fixed in 0.7.4 release