[libvirt] Operation forbidden for read only access

Daniel Veillard veillard at redhat.com
Mon Jun 6 08:19:36 UTC 2011


On Mon, Jun 06, 2011 at 01:27:47PM +0530, PREETHI RAMESH wrote:
> Sorry for my ignorance, but how do you do that?
> 
> On Mon, Jun 6, 2011 at 11:12 AM, Daniel Veillard <veillard at redhat.com>wrote:
> 
> > On Mon, Jun 06, 2011 at 08:41:51AM +0530, PREETHI RAMESH wrote:
> > > I'm using libvirt's Java API bindingsa and i've opened a connection :
> > [...]
> > > BUILD SUCCESSFUL (total time: 23 minutes 38 seconds)
> > >
> > > I've used qemu:///system but why is my operation being denied?
> >
> >   On a read-only connection any operation which may modify the state of
> >  the system will get denied. You need a read-write connection for
> >  destroying a domain.

  You do that by not asking for a read-only connection !

    /**
     * Constructs a Connect object from the supplied URI.
     * 
     * @param uri
     *            The connection URI
     * @param readOnly
     *            Whether the connection is read-only
     * @throws LibvirtException
     * @see <a href="http://libvirt.org/uri.html">The URI
     * documentation</a>
     */
    public Connect(String uri, boolean readOnly) throws LibvirtException

since your code does

    conn = new Connect("qemu:///system", true);

you asked for it. Please read the docs/code !

Daniel


-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list