unable to get domain list of KVM guests from libvirt as non-root user

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

 



I have a python script that monitors the guest VMs on a servers running Xen, but the script doesn't work properly on a server I just built with KVM. The script runs as a non-root user (same on all servers) and simply gathers some details on the status and names of the domains running on the host.

The Xen and KVM servers are running CentOS 5.4 x86_64 and are using the same version of libvirt:

libvirt-0.6.3-20.1.el5_4
libvirt-python-0.6.3-20.1.el5_4

Both Xen and KVM servers have the default libvirt.conf config file and the following /var/run/libvirt permissions:

KVM:

[root@kvm ~]# ls -l /var/run/libvirt
total 16
srwx------ 1 root root    0 Mar 12 08:37 libvirt-sock
srwxrwxrwx 1 root root    0 Mar 12 08:37 libvirt-sock-ro
drwxr-xr-x 2 root root 4096 Mar  8 13:05 network
drwxr-xr-x 2 root root 4096 Mar 11 16:17 qemu

Xen:

[root@xen ~]# ls -l /var/run/libvirt
total 16
srwx------ 1 root root    0 Feb  5 08:53 libvirt-sock
srwxrwxrwx 1 root root    0 Feb  5 08:53 libvirt-sock-ro
drwxr-xr-x 2 root root 4096 Jan 21 14:38 network
drwxr-xr-x 2 root root 4096 Oct 20 18:50 qemu

Kernel/hypervisor versions of Xen and KVM servers:

kernel-xen-2.6.18-164.9.1.el5
xen-3.0.3-94.el5_4.2

kvm-83-105.el5_4.27
kvm-qemu-img-83-105.el5_4.27
kernel-2.6.18-164.11.1.el5

To troubleshoot, I've been running python interactively as the non-root user. Here's how my Xen servers behave:

[testu@xen ~]$ python
Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
  >>> import libvirt
  >>> conn = libvirt.openReadOnly(None)
  >>> domains = conn.listDomainsID()
  >>> print domains
[0, 3, 15, 16, 21, 24, 26, 30, 32, 36, 38, 41, 43, 45, 47, 49, 51, 55,
63, 67]
  >>>

When I try the same thing on the KVM server:

[testu@kvm ~]$ python
Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
  >>> import libvirt
  >>> conn = libvirt.openReadOnly(None)
14:33:07.303: error : No vport operation path found for host0
14:33:07.320: error : No vport operation path found for host4
14:33:07.325: error : No vport operation path found for host3
14:33:07.367: error : No vport operation path found for host1
14:33:07.368: error : No vport operation path found for host2
  >>> domains = conn.listDomainsID()
  >>> print domains
[]
  >>>

However, when logged in as root on the KVM server, it works just like my Xen servers:

[root@kvm ~]# python
Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
  >>> import libvirt
  >>> conn = libvirt.openReadOnly(None)
  >>> domains = conn.listDomainsID()
  >>> print domains
[1]

As an experiment suggested by a someone on the centos-virt list, I modified the ownership and permissions of the socket files in /etc/libvirt/libvirtd.conf to use the same user running the python script. That didn't make a difference.

[testu@kvm ~]$ ls -l /var/run/libvirt
total 16
srwxrwx--- 1 root testu     0 Mar 12 07:45 libvirt-sock
srwxrwxrwx 1 root testu     0 Mar 12 07:45 libvirt-sock-ro
drwxr-xr-x 2 root root   4096 Mar  8 13:05 network
drwxr-xr-x 2 root root   4096 Mar 11 16:17 qemu

[testu@kvm ~]$ python
Python 2.4.3 (#1, Sep  3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import libvirt
 >>> conn = libvirt.openReadOnly(None)
07:45:56.893: error : No vport operation path found for host0
07:45:56.912: error : No vport operation path found for host4
07:45:56.919: error : No vport operation path found for host3
07:45:56.967: error : No vport operation path found for host1
07:45:56.968: error : No vport operation path found for host2
 >>> domains = conn.listDomainsID()
 >>> print domains
[]
 >>>

Can someone give me some pointers on what to check next? I'm running out of ideas.

Thanks,
Tom


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux