[libvirt-users] Non-Root not able to use openReadOnly()

Daniel P. Berrange berrange at redhat.com
Tue Apr 24 09:19:56 UTC 2012


On Tue, Apr 24, 2012 at 01:53:57PM +0530, vipul borikar wrote:
> Hi,
>       I have a code :
> 
> 
> import libvirt
> con = libvirt.openReadOnly(None)
> print con.listDomainsID()
> 
> 
> When i run the above code using root i get the proper output... but when i
> use non-root user it givers be a empty list [ ]
> 
> If i change the 2nd line to
> 
> con = libvirt.open(qemu:///system)
> It works.
> 
> 
> I am using RHEL 6.1 with default kvm and libvirt.

When you pass 'None' to the open API call, libvirt will guess what
driver to use. If you run non-root, it guesses 'qemu:///session'
but when you run as root it guesses 'qemu:///system'. You should
always pass an explicit URI if you know which one you want to use.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list