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

Fri Mar 12 12:53:26 UTC 2010
Tom Georgoulias <tomg at mcclatchyinteractive.com>

On 03/11/2010 04:46 PM, Akemi Yagi wrote:
> On Thu, Mar 11, 2010 at 12:54 PM, Tom Georgoulias
> <tomg at mcclatchyinteractive.com>  wrote:
>
>> So the virsh command works as expected, but not when I use python.
>
> Because the user running the python script is not part of the group 'testu' ?

Sorry, I should've been more clear about the user running the python 
script in my previous post.   The script runs as the testu user and is 
in the testu group.  I repeated the experiment this morning just to be sure:

[testu at 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 at kvm ~]$ virsh -c qemu:///system list --all
  Id Name                 State
----------------------------------
   8 changed              running
  13 changed2             running
  14 changed3             running

[testu at 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
[]
 >>>