[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] XenStore fix



Hi,

I have been examining a bug where libvirtd (and virsh) does not show
all virtual machines on a xen host. This proved to be because of this
program flow:
1. virConnectNumOfDomains -> .. -> xenUnifiedNumOfDomains
   -> xenHypervisorNumOfDomains => 3
2. virConnectListDomains(max=3) -> .. -> xenUnifiedListDomains(max=3)
   -> xenStoreNumOfDomains(max=3) => { 0, 2, 7 }
The domain with ID 2 is then removed when it is discovered that it is
not a running domain, which leads to this:

xenhost# xm list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0 14970     2     r-----   2544.7
vm1                                          7   512     1     -b----   2191.7
vm4                                              512     1                28.0
vm5                                         12   512     1     -b----    467.1
vm6                                              512     1                 0.0
vm7                                              512     1               482.4
xenhost# virsh list
 Id Name                 State
----------------------------------
  0 Domain-0             running
  7 vm1                  idle
xenhost# 

But where does "2" come from? If we check all "directories" in
/local/domain which is queried by the xenstore driver, it is apparent
that xenstore is not properly cleaned. We find the sequence {0, 2, 7}
as the first entries:
xenhost# xenstore ls /local/domain |grep '^[^ ]'
0 = ""
2 = ""
7 = ""
9 = ""
10 = ""
11 = ""
12 = ""
xenhost#

This patch checks that the path found in /local/domain/<domid>/vm
exists in xenstore before adding the domid to the return list. The
same thing is done for xenStoreNumOfDomains.

I use SLES11 with Xen 3.3.1_18546_12-3.1.

/Jonas


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]