1 TODO list for libguestfs
2 ======================================================================
4 This list contains random ideas and musings on features we could add
5 to libguestfs in future.
12 The API needs more test coverage, particularly lesser-used system
15 The big unresolved issue is UID/GID mapping between guest filesystem
16 IDs and the host. It's not easy to automate this because you need
17 extra details about the guest itself in order to get to its
18 UID->username map (eg. /etc/passwd from the guest).
23 Complete the Haskell bindings (see discussion on haskell-cafe).
28 Add bindtests to PHP bindings.
33 Complete the bind tests - must test the return values and error cases.
35 virt-inspector - make libvirt XML
36 ---------------------------------
38 It should be possible to generate libvirt XML from virt-inspector
39 data, at least partially. This would be just another output type so:
41 virt-inspector --libvirt guest.img
43 Note that recent versions of libvirt/virt-install allow guests to be
44 imported, so this is not so useful any more.
46 "Standalone/local mode"
47 -----------------------
49 Instead of running guestfsd (the daemon) inside qemu, there should be
50 an option to just run guestfsd directly.
52 The architecture in this mode would look like:
67 (1) This only makes sense if we are running as root.
69 (2) There is no console / kernel messages in this configuration, but
70 we might consider capturing stderr from the daemon.
72 (3) guestfs_config and guestfs_add_drive become no-ops.
74 Obviously in this configuration, commands are run directly on the
75 local machine's disks. You could just run the commands themselves
76 directly, but libguestfs provides a convenient API and language
77 bindings. Also deals with tricky stuff like parsing the output of the
78 LVM commands. Also we get to leverage other code such as
81 This is mainly useful from live CDs, ie. virt-p2v.
83 Should we bother having the daemon at all and just link the guestfsd
84 code directly into libguestfs?
86 Ideas for extra commands
87 ------------------------
89 General glibc / core programs:
116 Other initrd-* commands
117 -----------------------
124 Simple editing of configuration files
125 -------------------------------------
127 Some easy non-Augeas methods to edit configuration files.
130 replace /etc/file key value
132 which would look in /etc/file for any instances of
138 and replace them with
144 That would solve about 50% of reconfiguration needs, and for the
145 rest you'd use Augeas, 'download'+'upload' or 'edit'.
147 RWMJ: I had a go at implementing this, but it's quite error-prone to
148 do this sort of editing inside the C-based daemon code. It's far
149 better to do it with Augeas, or else to use an external language like
155 Currently we can't do Perl "one-liners". ie. The current syntax for
156 any short Perl one-liner would be:
158 perl -MSys::Guestfs -e '$g = Sys::Guestfs->new(); $g->add_drive ("foo"); $g->launch; $g->mount ("/dev/sda1", "/"); ....'
160 You can see we're well beyond a single line just getting to the point
161 of adding drives and mounting.
165 $h = create ($filename, \"/dev/sda1\" => \"/\");
167 $h = create ([$file1, $file2], \"/dev/sda1\" => \"/\");
169 To mount read-only, add C<ro =E<gt> 1> like this:
171 $h = create ($filename, \"/dev/sda1\" => \"/\", ro => 1);
173 which is equivalent to the following sequence of calls:
175 $h = Sys::Guestfs->new ();
176 $h->add_drive_ro ($filename);
178 $h->mount_ro (\"/dev/sda1\", \"/\");
180 Command-line form would be:
182 perl -MSys::Guestfs=:all -e '$_=create("guest.img", "/dev/sda1" => "/"); $_->cat ("/etc/fstab");'
184 That's not brief enough for one-liners, so we could have an extra
185 autogenerated module which creates a Sys::Guestfs handle singleton
186 (the handle is an implicit global variable as in guestfish), eg:
188 perl -MSys::Guestfs::One -e 'inspect("guest.img"); cat ("/etc/fstab");'
190 How would editing files work?
196 http://search.cpan.org/~rgiersig/IO-Tty-1.08/Pty.pm
197 http://www.perlmonks.org/index.pl?node_id=582185
199 Note that pty requires cooperation inside the C code too (there are
200 two sides to a pty, and one has to be handled after the fork).
202 [I tried to implement this in the new C virt-rescue, but it doesn't
203 work. qemu is implementing its own ptys, and they are broken. Need
206 Windows-based daemon/appliance
207 ------------------------------
209 See discussion on list:
210 https://www.redhat.com/archives/libguestfs/2009-November/msg00165.html
215 Add -drive file=...,lock=exclusive and -drive file=...,lock=shared
217 Change libguestfs and libvirt to do the right thing, so that multiple
218 instances of qemu cannot stomp on each other.
223 For multi-level disk images such as live CDs:
224 http://rwmj.wordpress.com/2009/07/15/unpack-the-russian-doll-of-a-f11-live-cd/
226 It's possible with libguestfs to recursively look for anything that
227 might be a filesystem, mount-{,loop} it and look in those, revealing
228 anything in a disk image.
230 However this won't work easily for VM disk images in the disk image.
231 One would have to download those to the host and launch another
234 [Not sure this is such a good idea. See also live CD inspection idea below.]
236 Map filesystems to disk blocks
237 ------------------------------
239 Map files/filesystems/(any other object) to the actual disk
246 See also contribs/visualize-alignment/
248 Integration with host intrusion systems
249 ---------------------------------------
251 Perfect way to monitor VMs from outside the VM. Look for file
252 hashes, log events, login/logout etc.
254 http://www.ossec.net/
255 http://la-samhna.de/samhain/
256 http://sourceforge.net/projects/aide/
257 http://osiris.shmoo.com/
258 http://sourceforge.net/projects/tripwire/
263 https://www.redhat.com/archives/libguestfs/2010-June/msg00053.html
264 https://www.redhat.com/archives/libguestfs/2010-June/msg00079.html
266 Freeze/thaw filesystems
267 -----------------------
269 Access to these ioctls:
270 http://git.kernel.org/linus/fcccf502540e3d7
272 Tips for new users in guestfish
273 -------------------------------
276 Tip: You need to 'add disk.img' or 'alloc disk.img nn' to make a new image.
277 Type 'notips' to disable tips permanently.
279 Tip: You need to type 'run' before you can see into the disk image.
281 Tip: Use 'list-filesystems' to see what filesystems are available.
282 ><fs> list-filesystems
284 Tip: Use 'mount fs /' to mount a filesystem.
285 ><fs> mount /dev/vda1 /
286 Tip: Use 'll /' to view the filesystem or ...
289 Could we make guestfish interactive if commands are used without params?
290 ------------------------------------------------------------------------
300 How can we solve these common user problems?
302 [space for common problems here]
304 Better support for encrypted devices
305 ------------------------------------
307 Currently LUKS support only works if the device contains volume
308 groups. If it contains, eg., partitions, you cannot access them.
309 We would like to add:
311 - Direct access to the /dev/mapper device (eg. if it contains
312 anything apart from VGs).
317 Display the structure of an image file as a PS.
319 Greater use of blkid / libblkid
320 -------------------------------
322 guestfs_zero should use wipefs. See wipefs(8).
324 There are various useful functions in libblkid for listing partitions,
325 devices etc which we are essentially duplicating in the daemon. It
326 would make more sense to just use libblkid for this.
328 There are some places where we call out to the 'blkid' program. This
329 might be replaced by direct use of the library (if this is easier).
334 Eric Sandeen pointed out the blktrace tool which is a better way of
335 capturing traces than using patched qemu (see
336 contrib/visualize-alignment). We would still use the same
337 visualization tools in conjunction with blktrace traces.
342 At the moment guestfish uses an ad hoc parser which has many
343 shortcomings. We should change to using a lex/yacc-based scanner and
344 parser (there are better parsers out there, but yacc is sufficient and
345 very widely available).
347 The scanner must deal with the case of parsing a whole command string,
348 eg. for a command that the user types in:
350 ><fs> add-drive-opts "/tmp/foo" readonly:true
352 and also with parsing single words from the command line:
354 guestfish add-drive-opts /tmp/foo readonly:true
356 Note the quotes are for scanning and don't indicate types.
358 We should also allow variables and expressions as part of this new
362 set product inspect-get-product-name %{roots[0]}
364 % is better than $ because of shell escaping and confusion with shell
367 Can we combine this with ability to set and read environment
368 variables? Currently guestfish uses many environment variables like
369 $EDITOR without any corresponding ability to set them.
371 set EDITOR /usr/bin/emacs
372 echo $EDITOR # or %{EDITOR}
373 edit /etc/resolv.conf
375 live CD inspection for Windows 7
376 --------------------------------
378 Windows 7 install CDs are quite different and pretty impenetrable.
379 There are no obvious files to parse.
384 ntfsprogs actually has a lot more useful tools than we currently
385 use. Interesting ones are:
387 ntfslabel: display or change filesystem label (we should unify all
388 set*label APIs into a single set_vfs_label which can deal with any
391 ntfsclone: clone, image, restore, rescue NTFS
393 ntfsinfo: print various information about NTFS volume and files
395 ntfs streams: extract alternate streams from NTFS files
397 ntfsck: checker for NTFS filesystems
407 More mkfs_opts options
408 ----------------------
410 Useful options to offer:
414 Use /proc/self/mountinfo
415 ------------------------
417 This file contains lots of interesting information about
418 what is mounted and where. eg:
420 16 21 0:3 / /proc rw,relatime - proc /proc rw
421 17 21 0:16 / /sys rw,relatime - sysfs /sys rw,seclabel
422 18 23 0:5 / /dev rw,relatime - devtmpfs udev rw,seclabel,size=1906740k,nr_inodes=476685,mode=755
423 26 21 253:3 / /home rw,relatime - ext4 /dev/mapper/vg-lv_home rw,seclabel,barrier=1,data=ordered
425 This could be used instead of current hairy code to parse the output
426 of the 'mount' command. We could add new APIs to return kernel mount
427 options, type of filesystem at a mountpoint etc.
429 guestfish drive letters
430 -----------------------
432 There should be an option to mount all Windows drives as separate
433 paths, like C: => /c/, D: => /d/ etc.