[libvirt] virConnectOpenReadOnly?

Richard W.M. Jones rjones at redhat.com
Wed Aug 27 10:59:09 UTC 2008


On Tue, Aug 26, 2008 at 03:45:06PM +0900, Jun Koi wrote:
> According to the comment of virConnectOpenReadOnly, this function has
> some restrictions on available methods to control domains. Could you
> be more specific? What kind of restrictions we are having (compare to
> virConnectOpen())?
> 
> And when should we use virConnectOpenReadOnly() instead of virConnectOpen() ?

I don't think the list of restrictions is explicit anywhere, although
the idea of virConnectOpenReadOnly is to allow merely "safe" status/
monitoring-type operations, and not any operations which could change
the state of the system.  Virt-top, for example, opens all connections
in read-only mode.

In ocaml-libvirt we actually enforce the restriction at compile time.
So at some point a very long time ago I went through the calls in
libvirt to see which ones are restricted.  If you look at:

  http://hg.et.redhat.com/virt/applications/ocaml-libvirt--devel/?f=6c6fec205451;file=libvirt/libvirt.mli

then any calls which have the phantom type[1] of "[>`W] t" require
write access.

Rich.

[1] http://camltastic.blogspot.com/2008/05/phantom-types.html

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the libvir-list mailing list