[CentOS] unable to get domain status from libvirt & KVM

Akemi Yagi amyagi at gmail.com
Thu Mar 11 00:08:24 UTC 2010


On Wed, Mar 10, 2010 at 12:02 PM, Tom Georgoulias
<tomg at mcclatchyinteractive.com> wrote:
> I have a python script that monitors the VMs on physical host 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 and simply gathers
> some details on the status and names of the domains running on the host.
(snip)
> Again, on the KVM server, plain old "virsh list" with the debug level
> set to "2"
>
> $ export LIBVIRT_DEBUG=2
> $ virsh list
> 14:21:06.532: error : No vport operation path found for host0
> 14:21:06.550: error : No vport operation path found for host4
> 14:21:06.555: error : No vport operation path found for host3
> 14:21:06.598: error : No vport operation path found for host1
> 14:21:06.599: error : No vport operation path found for host2
> 14:21:06.615: info : No security driver available
>  Id Name                 State
> ----------------------------------
>
> Permissions in /var/run/libvirt:
>
> # ls -ld /var/run/libvirt/*
> srwx------ 1 root root    0 Feb  5 08:53 /var/run/libvirt/libvirt-sock
> srwxrwxrwx 1 root root    0 Feb  5 08:53 /var/run/libvirt/libvirt-sock-ro
> drwxr-xr-x 2 root root 4096 Jan 21 14:38 /var/run/libvirt/network
> drwxr-xr-x 2 root root 4096 Oct 20 18:50 /var/run/libvirt/qemu
>
> Can someone provide some tips on what else I can check, if this might be
> a bug, or point out any mistakes that I might've made?  Any help is
> appreciated.

Well, I am learning / testing kvm myself, so what I write might not be
precise. But because no one seems to be responding ... :)

Look into /etc/libvirt/libvirtd.conf and check out the section "UNIX
socket access controls" and make appropriate adjustment.  [ I created
group 'libvirt' , added myself to the group, and uncommented the line
"unix_sock_group = "libvirt"".]  Then adjust also the permission bits
of the directories and files in /var/run/libvirt to allow access to
the group libvirt.

With some luck, you should be able to run the virsh command (for example):

virsh -c qemu:///system list --all

I'm sure there are more authentic way of achieving this. :)

Also, if you create a guest with the -c qemu:///session option, that
would allow non-root user to connect it.  For more details, please see
http://libvirt.org/uri.html .

Another hint: you will have a better chance of getting replies by
posting to the centos-virt mailing list.

Akemi


More information about the CentOS mailing list