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:
117 Other initrd-* commands
118 -----------------------
125 Simple editing of configuration files
126 -------------------------------------
128 Some easy non-Augeas methods to edit configuration files.
131 replace /etc/file key value
133 which would look in /etc/file for any instances of
139 and replace them with
145 That would solve about 50% of reconfiguration needs, and for the
146 rest you'd use Augeas, 'download'+'upload' or 'edit'.
148 RWMJ: I had a go at implementing this, but it's quite error-prone to
149 do this sort of editing inside the C-based daemon code. It's far
150 better to do it with Augeas, or else to use an external language like
156 Currently we can't do Perl "one-liners". ie. The current syntax for
157 any short Perl one-liner would be:
159 perl -MSys::Guestfs -e '$g = Sys::Guestfs->new(); $g->add_drive ("foo"); $g->launch; $g->mount ("/dev/sda1", "/"); ....'
161 You can see we're well beyond a single line just getting to the point
162 of adding drives and mounting.
166 $h = create ($filename, \"/dev/sda1\" => \"/\");
168 $h = create ([$file1, $file2], \"/dev/sda1\" => \"/\");
170 To mount read-only, add C<ro =E<gt> 1> like this:
172 $h = create ($filename, \"/dev/sda1\" => \"/\", ro => 1);
174 which is equivalent to the following sequence of calls:
176 $h = Sys::Guestfs->new ();
177 $h->add_drive_ro ($filename);
179 $h->mount_ro (\"/dev/sda1\", \"/\");
181 Command-line form would be:
183 perl -MSys::Guestfs=:all -e '$_=create("guest.img", "/dev/sda1" => "/"); $_->cat ("/etc/fstab");'
185 That's not brief enough for one-liners, so we could have an extra
186 autogenerated module which creates a Sys::Guestfs handle singleton
187 (the handle is an implicit global variable as in guestfish), eg:
189 perl -MSys::Guestfs::One -e 'inspect("guest.img"); cat ("/etc/fstab");'
191 How would editing files work?
197 http://man.linux-ntfs.org/ntfsclone.8.html
203 http://search.cpan.org/~rgiersig/IO-Tty-1.08/Pty.pm
204 http://www.perlmonks.org/index.pl?node_id=582185
206 Note that pty requires cooperation inside the C code too (there are
207 two sides to a pty, and one has to be handled after the fork).
209 [I tried to implement this in the new C virt-rescue, but it doesn't
210 work. qemu is implementing its own ptys, and they are broken. Need
213 Windows-based daemon/appliance
214 ------------------------------
216 See discussion on list:
217 https://www.redhat.com/archives/libguestfs/2009-November/msg00165.html
222 Add -drive file=...,lock=exclusive and -drive file=...,lock=shared
224 Change libguestfs and libvirt to do the right thing, so that multiple
225 instances of qemu cannot stomp on each other.
230 For multi-level disk images such as live CDs:
231 http://rwmj.wordpress.com/2009/07/15/unpack-the-russian-doll-of-a-f11-live-cd/
233 It's possible with libguestfs to recursively look for anything that
234 might be a filesystem, mount-{,loop} it and look in those, revealing
235 anything in a disk image.
237 However this won't work easily for VM disk images in the disk image.
238 One would have to download those to the host and launch another
241 [Not sure this is such a good idea. See also live CD inspection idea below.]
243 Map filesystems to disk blocks
244 ------------------------------
246 Map files/filesystems/(any other object) to the actual disk
253 See also contribs/visualize-alignment/
255 Integration with host intrusion systems
256 ---------------------------------------
258 Perfect way to monitor VMs from outside the VM. Look for file
259 hashes, log events, login/logout etc.
261 http://www.ossec.net/
262 http://la-samhna.de/samhain/
263 http://sourceforge.net/projects/aide/
264 http://osiris.shmoo.com/
265 http://sourceforge.net/projects/tripwire/
270 https://www.redhat.com/archives/libguestfs/2010-June/msg00053.html
271 https://www.redhat.com/archives/libguestfs/2010-June/msg00079.html
273 Freeze/thaw filesystems
274 -----------------------
276 Access to these ioctls:
277 http://git.kernel.org/linus/fcccf502540e3d7
279 Tips for new users in guestfish
280 -------------------------------
283 Tip: You need to 'add disk.img' or 'alloc disk.img nn' to make a new image.
284 Type 'notips' to disable tips permanently.
286 Tip: You need to type 'run' before you can see into the disk image.
288 Tip: Use 'list-filesystems' to see what filesystems are available.
289 ><fs> list-filesystems
291 Tip: Use 'mount fs /' to mount a filesystem.
292 ><fs> mount /dev/vda1 /
293 Tip: Use 'll /' to view the filesystem or ...
296 Could we make guestfish interactive if commands are used without params?
297 ------------------------------------------------------------------------
307 How can we solve these common user problems?
309 [space for common problems here]
311 Better support for encrypted devices
312 ------------------------------------
314 Currently LUKS support only works if the device contains volume
315 groups. If it contains, eg., partitions, you cannot access them.
316 We would like to add:
318 - Direct access to the /dev/mapper device (eg. if it contains
319 anything apart from VGs).
324 Display the structure of an image file as a PS.
326 Greater use of blkid / libblkid
327 -------------------------------
329 guestfs_zero should use wipefs. See wipefs(8).
331 There are various useful functions in libblkid for listing partitions,
332 devices etc which we are essentially duplicating in the daemon. It
333 would make more sense to just use libblkid for this.
335 There are some places where we call out to the 'blkid' program. This
336 might be replaced by direct use of the library (if this is easier).
341 Eric Sandeen pointed out the blktrace tool which is a better way of
342 capturing traces than using patched qemu (see
343 contrib/visualize-alignment). We would still use the same
344 visualization tools in conjunction with blktrace traces.
349 At the moment guestfish uses an ad hoc parser which has many
350 shortcomings. We should change to using a lex/yacc-based scanner and
351 parser (there are better parsers out there, but yacc is sufficient and
352 very widely available).
354 The scanner must deal with the case of parsing a whole command string,
355 eg. for a command that the user types in:
357 ><fs> add-drive-opts "/tmp/foo" readonly:true
359 and also with parsing single words from the command line:
361 guestfish add-drive-opts /tmp/foo readonly:true
363 Note the quotes are for scanning and don't indicate types.
365 We should also allow variables and expressions as part of this new
369 set product inspect-get-product-name %{roots[0]}
371 % is better than $ because of shell escaping and confusion with shell
377 guestfish -i livecd.iso
379 Could this be done through the core API and existing calls?