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:
http://libguestfs.org/guestfs.3.html#cve-2010-3851
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.
Rich.
--
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.
http://libguestfs.org/virt-v2v