[Libguestfs] How to use libguestfs access LVM as non-root user?

Richard W.M. Jones rjones at redhat.com
Fri May 31 11:29:24 UTC 2013

On Fri, May 31, 2013 at 06:39:53PM +0800, Qiu Yu wrote:
> $ cat test.py
> import guestfs
> g = guestfs.GuestFS()
> g.add_drive_opts("/dev/xenvg/123", format="qcow2")

Another option is to completely omit the 'format = ...' option.

Then libguestfs will autodetect the format for you.

However this is not as secure as specifying the format:
so in production code you should specify the format if you know it,
especially if the guest is not trusted.

In recent libguestfs >= 1.20 you can also query the format using:
`g.disk_format (filename)' but you should still be careful that
you don't accidentally hit CVE-2010-3851.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.

More information about the Libguestfs mailing list