[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] Comment on libguestfs code in https://bitbucket.org/swamiyeswanth/pyti



Yeswanth, I'm looking at:

https://bitbucket.org/swamiyeswanth/pyti/src/2b3a7401eccf/diskhandler.py
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).

http://libguestfs.org/guestfs.3.html#guestfs_add_drive
http://libguestfs.org/guestfs.3.html#guestfs_add_drive_opts
https://bugzilla.redhat.com/642934

(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.

http://libguestfs.org/guestfs.3.html#guestfs_mount
http://libguestfs.org/guestfs.3.html#guestfs_mount_options
http://libguestfs.org/guestfs.3.html#libguestfs_gotchas

(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
thing.

HTH,

Rich.

-- 
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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]