Version 1.5.15.
[libguestfs.git] / TODO
1 TODO list for libguestfs
2 ======================================================================
3
4 This list contains random ideas and musings on features we could add
5 to libguestfs in future.
6
7    - RWMJ
8
9 FUSE API
10 --------
11
12 The API needs more test coverage, particularly lesser-used system
13 calls.
14
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).
19
20 febootstrap / debootstrap inside appliance
21 ------------------------------------------
22
23 This was originally proposed as a way to install new operating systems
24 in the appliance.  However no one has come up with a workable
25 solution.
26
27 Haskell bindings
28 ----------------
29
30 Complete the Haskell bindings (see discussion on haskell-cafe).
31
32 PHP bindings
33 ------------
34
35 Add bindtests to PHP bindings.
36
37 Complete bind tests
38 -------------------
39
40 Complete the bind tests - must test the return values and error cases.
41
42 virt-inspector - make libvirt XML
43 ---------------------------------
44
45 It should be possible to generate libvirt XML from virt-inspector
46 data, at least partially.  This would be just another output type so:
47
48  virt-inspector --libvirt guest.img
49
50 Note that recent versions of libvirt/virt-install allow guests to be
51 imported, so this is not so useful any more.
52
53 "Standalone/local mode"
54 -----------------------
55
56 Instead of running guestfsd (the daemon) inside qemu, there should be
57 an option to just run guestfsd directly.
58
59 The architecture in this mode would look like:
60
61      +------------------+
62      | main program     |
63      |------------------|
64      | libguestfs       |
65      +--------^---------+
66           |   | reply
67       cmd |   |
68      +----v-------------+
69      | guestfsd         |
70      +------------------+
71
72 Notes:
73
74 (1) This only makes sense if we are running as root.
75
76 (2) There is no console / kernel messages in this configuration, but
77 we might consider capturing stderr from the daemon.
78
79 (3) guestfs_config and guestfs_add_drive become no-ops.
80
81 Obviously in this configuration, commands are run directly on the
82 local machine's disks.  You could just run the commands themselves
83 directly, but libguestfs provides a convenient API and language
84 bindings.  Also deals with tricky stuff like parsing the output of the
85 LVM commands.  Also we get to leverage other code such as
86 virt-inspector.
87
88 This is mainly useful from live CDs, ie. virt-p2v.
89
90 Should we bother having the daemon at all and just link the guestfsd
91 code directly into libguestfs?
92
93 Ideas for extra commands
94 ------------------------
95
96   General glibc / core programs:
97     chgrp
98     more mk*temp calls
99
100   ext2 properties:
101     chattr
102     lsattr
103     badblocks
104     blkid
105     debugfs
106     dumpe2fs
107     e2image
108     e2undo
109     filefrag
110     findfs
111     logsave
112     mklost+found
113     ext2undelete
114
115   SELinux:
116     chcat
117     restorecon
118     ch???
119
120   Oddball:
121     pivot_root
122     fts(3) / ftw(3)
123
124 Other initrd-* commands
125 -----------------------
126
127 Such as:
128
129 initrd-extract
130 initrd-replace
131
132 Simple editing of configuration files
133 -------------------------------------
134
135 Some easy non-Augeas methods to edit configuration files.
136 I'm thinking:
137
138   replace /etc/file key value
139
140 which would look in /etc/file for any instances of
141
142   key=...
143   key ...
144   key:...
145
146 and replace them with
147
148   key=value
149   key value
150   key:value
151
152 That would solve about 50% of reconfiguration needs, and for the
153 rest you'd use Augeas, 'download'+'upload' or 'edit'.
154
155 RWMJ: I had a go at implementing this, but it's quite error-prone to
156 do this sort of editing inside the C-based daemon code.  It's far
157 better to do it with Augeas, or else to use an external language like
158 Perl.
159
160 Quick Perl scripts
161 ------------------
162
163 Currently we can't do Perl "one-liners".  ie. The current syntax for
164 any short Perl one-liner would be:
165
166   perl -MSys::Guestfs -e '$g = Sys::Guestfs->new(); $g->add_drive ("foo"); $g->launch; $g->mount ("/dev/sda1", "/"); ....'
167
168 You can see we're well beyond a single line just getting to the point
169 of adding drives and mounting.
170
171 First suggestion:
172
173  $h = create ($filename, \"/dev/sda1\" => \"/\");
174
175  $h = create ([$file1, $file2], \"/dev/sda1\" => \"/\");
176
177 To mount read-only, add C<ro =E<gt> 1> like this:
178
179  $h = create ($filename, \"/dev/sda1\" => \"/\", ro => 1);
180
181 which is equivalent to the following sequence of calls:
182
183  $h = Sys::Guestfs->new ();
184  $h->set_autosync (1);
185  $h->add_drive_ro ($filename);
186  $h->launch ();
187  $h->mount_ro (\"/dev/sda1\", \"/\");
188
189 Command-line form would be:
190
191  perl -MSys::Guestfs=:all -e '$_=create("guest.img", "/dev/sda1" => "/"); $_->cat ("/etc/fstab");'
192
193 That's not brief enough for one-liners, so we could have an extra
194 autogenerated module which creates a Sys::Guestfs handle singleton
195 (the handle is an implicit global variable as in guestfish), eg:
196
197  perl -MSys::Guestfs::One -e 'inspect("guest.img"); cat ("/etc/fstab");'
198
199 How would editing files work?
200
201 ntfsclone
202 ---------
203
204 Useful imaging tool:
205 http://man.linux-ntfs.org/ntfsclone.8.html
206
207 virt-rescue pty
208 ---------------
209
210 See:
211 http://search.cpan.org/~rgiersig/IO-Tty-1.08/Pty.pm
212 http://www.perlmonks.org/index.pl?node_id=582185
213
214 Note that pty requires cooperation inside the C code too (there are
215 two sides to a pty, and one has to be handled after the fork).
216
217 Windows-based daemon/appliance
218 ------------------------------
219
220 See discussion on list:
221 https://www.redhat.com/archives/libguestfs/2009-November/msg00165.html
222
223 qemu locking
224 ------------
225
226 Add -drive file=...,lock=exclusive and -drive file=...,lock=shared
227
228 Change libguestfs and libvirt to do the right thing, so that multiple
229 instances of qemu cannot stomp on each other.
230
231 virt-disk-explore
232 -----------------
233
234 For multi-level disk images such as live CDs:
235 http://rwmj.wordpress.com/2009/07/15/unpack-the-russian-doll-of-a-f11-live-cd/
236
237 It's possible with libguestfs to recursively look for anything that
238 might be a filesystem, mount-{,loop} it and look in those, revealing
239 anything in a disk image.
240
241 However this won't work easily for VM disk images in the disk image.
242 One would have to download those to the host and launch another
243 libguestfs instance.
244
245 List, mount filesystems by UUID and label
246 -----------------------------------------
247
248 [See related:
249 http://www.redhat.com/archives/libguestfs/2009-August/msg00031.html]
250
251 List filesystems by UUID or label.
252
253 Mount filesystems by UUID or label.  (I'm not really sure if we can do
254 this at the moment but we ought to be able to do it, and perhaps make
255 it easier by having a direct command).
256
257 Map filesystems to disk blocks
258 ------------------------------
259
260 Map files/filesystems/(any other object) to the actual disk
261 blocks they occupy.
262
263 And vice versa.
264
265 Is it even possible?
266
267 Integration with host intrusion systems
268 ---------------------------------------
269
270 Perfect way to monitor VMs from outside the VM.  Look for file
271 hashes, log events, login/logout etc.
272
273 http://www.ossec.net/
274 http://la-samhna.de/samhain/
275 http://sourceforge.net/projects/aide/
276 http://osiris.shmoo.com/
277 http://sourceforge.net/projects/tripwire/
278
279 -N option should be generated
280 -----------------------------
281
282 '-N' option should generate documentation in guestfish(1) manpage.
283
284 Fix 'file'
285 ----------
286
287 https://www.redhat.com/archives/libguestfs/2010-June/msg00053.html
288 https://www.redhat.com/archives/libguestfs/2010-June/msg00079.html
289
290 Regression test on virt-inspector
291 ---------------------------------
292
293 Occasionally we break virt-inspector through some change.  We should
294 add a regression test for it.  However this is hard because we'd need
295 to avoid having to carry huge images.
296
297 Update: I managed to fit a real-but-minimal Fedora 13 image into 6.2 MB.
298 See: http://rwmj.wordpress.com/2010/09/07/tip-pack-files-into-a-new-disk-image/#content
299
300 Freeze/thaw filesystems
301 -----------------------
302
303 Access to these ioctls:
304 http://git.kernel.org/linus/fcccf502540e3d7
305
306 Tips for new users in guestfish
307 -------------------------------
308
309 $ guestfish
310 Tip: You need to 'add disk.img' or 'alloc disk.img nn' to make a new image.
311 Type 'notips' to disable tips permanently.
312 ><fs> add mydisk
313 Tip: You need to type 'run' before you can see into the disk image.
314 ><fs> run
315 Tip: Use 'list-filesystems' to see what filesystems are available.
316 ><fs> list-filesystems
317 /dev/vda1
318 Tip: Use 'mount fs /' to mount a filesystem.
319 ><fs> mount /dev/vda1 /
320 Tip: Use 'll /' to view the filesystem or ...
321 ><fs> ll /
322
323 New guestfish commands
324 ----------------------
325
326 'list-filesystems' => list mountable filesystems
327
328 We could implement this as a new API call, replacing a number of areas
329 of the current code where this is done already (in virt-inspector and
330 elsewhere).  What we normally do to find out if a partition contains a
331 mountable filesystem is to just blindly mount it, and see if that
332 succeeds.  However the kernel won't let us do this if the filesystem
333 is already mounted somewhere, so a naive implementation of this in the
334 daemon won't work.  We would have to check if the partition was
335 already mounted.
336
337 Could we make guestfish interactive if commands are used without params?
338 ------------------------------------------------------------------------
339
340 ><fs> sparse
341 [[Prints man page]]
342 Image name? disk.img
343 Size of image? 10M
344
345 Common problems
346 ---------------
347
348 How can we solve these common user problems?
349
350 - http://lists.fedoraproject.org/pipermail/users/2010-June/374931.html
351   In guestfish, specified -m non-existent filesystem.  We could suggest
352   a list of filesystems, or suggest they run the virt-list-filesystems
353   command.
354
355   Related to the above: There should be an API call to list all
356   mountable / accessible devices.  Or a guestfish command to replace
357   list-devices, list-partitions, lvs, vfs-type.
358
359 Better support for encrypted devices
360 ------------------------------------
361
362 Currently LUKS support only works if the device contains volume
363 groups.  If it contains, eg., partitions, you cannot access them.
364 We would like to add:
365
366   - An easier way to use this from guestfish.
367   - Direct access to the /dev/mapper device (eg. if it contains
368     anything apart from VGs).
369
370 Display image as PS
371 -------------------
372
373 Display the structure of an image file as a PS.
374
375 Greater use of blkid / libblkid
376 -------------------------------
377
378 guestfs_zero should use wipefs.  See wipefs(8).
379
380 There are various useful functions in libblkid for listing partitions,
381 devices etc which we are essentially duplicating in the daemon.  It
382 would make more sense to just use libblkid for this.
383
384 There are some places where we call out to the 'blkid' program.  This
385 might be replaced by direct use of the library (if this is easier).