[libvirt-users] Defined VM goes missing in multi-threaded environment.

Sharad Mishra snmishra at us.ibm.com
Thu Nov 17 21:32:46 UTC 2011


In a multi-threaded environment where multiple threads are trying to get
list of all VMs on host, we have seen that at times this list is missing
couple of VMs. The code used is fairly simple, it makes three libvirt
calls.

1. Call virConnectNumOfDefinedDomains() to get number of defined domains.

2. Call virConnectNumOfDomains() to get a list of active domains.

3. If there are defined domains, then call virConnectListDefinedDomains
(conn, (char **)names, n_names), where n_names is the count returned from
#1.

The count returned from #3 is less than the one returned from #1.

I have bumped up the connection count in libvirtd.conf to 100, and using 20
threads. On average I get one missing defined VM every 5 runs of this test.

I have 25 running VMs and 8 defined VMs  on this host.

# rpm -aq | grep libvirt
libvirt-python-0.8.7-18.el6_1.1.x86_64
libvirt-0.8.7-18.el6_1.1.x86_64
libvirt-cim-0.5.14-1.el6.x86_64
libvirt-client-0.8.7-18.el6_1.1.x86_64

Its RHEL 6.1 running 2.6.32-131.17.1.el6.x86_64

Regards,
Sharad Mishra




More information about the libvirt-users mailing list