[Libguestfs] Comment on libguestfs code in https://bitbucket.org/swamiyeswanth/pyti
Richard W.M. Jones
rjones at redhat.com
Thu Jun 16 11:27:29 UTC 2011
Yeswanth, I'm looking at:
from this thread: http://librelist.com/browser//pyti/2011/6/13/disk-handler/
(1) I don't think the code you posted will work unless you move line
23 ('launch') up to just after you've added the drive (after line 12).
(2) You probably don't want to use 'add_drive'. This deprecated
function has a potential vulnerability, although it will only affect
you if you are modifying untrusted raw-format guests. The suggested
replacement is 'add_drive_opts' (which also has more features).
(3) Instead of using 'mount', use 'mount_options'. The 'mount' call
adds some flags to the mountpoint which are not very useful and also
make disk writes very slow.
(4) After line 33 ('umount_all') you should also call
'self.disk_fs.sync()' which causes the libguestfs drive to be fully
synced. Alternatively you can delete the handle ('del self.disk_fs')
which assuming no other references are being held will do the same
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
More information about the Libguestfs