[CentOS-virt] unable to get domain status from libvirt & KVM
Tom Georgoulias
tomg at mcclatchyinteractive.com
Fri Mar 12 16:26:50 UTC 2010
On 03/12/2010 11:16 AM, Akemi Yagi wrote:
> In the case of virsh, you have a chance to add the -c qemu:///system
> option (which is required when running the command as non-root). So,
> the question is if this option can be somehow added in python.
I posted this question on the libvirt-users list and here's the fix:
Instead of using:
conn = libvirt.openReadOnly(None)
I need to use:
conn = libvirt.openReadOnly("qemu:///system")
sh-3.2$ 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("qemu:///system")
>>> domains = conn.listDomainsID()
>>> print domains
[14, 8, 13]
>>>
That wass the only change needed to make this work on the KVM server.
Thank you very much for your help with this, I appreciate it!
Tom
More information about the CentOS-virt
mailing list