New APIs: Support for creating LUKS and managing keys.
[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 Complete bind tests
33 -------------------
34
35 Complete the bind tests - must test the return values and error cases.
36
37 virt-inspector - make libvirt XML
38 ---------------------------------
39
40 It should be possible to generate libvirt XML from virt-inspector
41 data, at least partially.  This would be just another output type so:
42
43  virt-inspector --libvirt guest.img
44
45 Note that recent versions of libvirt/virt-install allow guests to be
46 imported, so this is not so useful any more.
47
48 "Standalone/local mode"
49 -----------------------
50
51 Instead of running guestfsd (the daemon) inside qemu, there should be
52 an option to just run guestfsd directly.
53
54 The architecture in this mode would look like:
55
56      +------------------+
57      | main program     |
58      |------------------|
59      | libguestfs       |
60      +--------^---------+
61           |   | reply
62       cmd |   |
63      +----v-------------+
64      | guestfsd         |
65      +------------------+
66
67 Notes:
68
69 (1) This only makes sense if we are running as root.
70
71 (2) There is no console / kernel messages in this configuration, but
72 we might consider capturing stderr from the daemon.
73
74 (3) guestfs_config and guestfs_add_drive become no-ops.
75
76 Obviously in this configuration, commands are run directly on the
77 local machine's disks.  You could just run the commands themselves
78 directly, but libguestfs provides a convenient API and language
79 bindings.  Also deals with tricky stuff like parsing the output of the
80 LVM commands.  Also we get to leverage other code such as
81 virt-inspector.
82
83 This is mainly useful from live CDs, ie. virt-p2v.
84
85 Should we bother having the daemon at all and just link the guestfsd
86 code directly into libguestfs?
87
88 Supermin appliance to febootstrap
89 ---------------------------------
90
91 Supermin appliance functionality should be moved into febootstrap.
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 be generated code, and should generate
283 documentation in guestfish(1) manpage.
284
285 Fix 'file'
286 ----------
287
288 https://www.redhat.com/archives/libguestfs/2010-June/msg00053.html
289 https://www.redhat.com/archives/libguestfs/2010-June/msg00079.html
290
291 Regression test on virt-inspector
292 ---------------------------------
293
294 Occasionally we break virt-inspector through some change.  We should
295 add a regression test for it.  However this is hard because we'd need
296 to avoid having to carry huge images.
297
298 Freeze/thaw filesystems
299 -----------------------
300
301 Access to these ioctls:
302 http://git.kernel.org/linus/fcccf502540e3d7
303
304 Tips for new users in guestfish
305 -------------------------------
306
307 $ guestfish
308 Tip: You need to 'add disk.img' or 'alloc disk.img nn' to make a new image.
309 Type 'notips' to disable tips permanently.
310 ><fs> add mydisk
311 Tip: You need to type 'run' before you can see into the disk image.
312 ><fs> run
313 Tip: Use 'list-filesystems' to see what filesystems are available.
314 ><fs> list-filesystems
315 /dev/vda1
316 Tip: Use 'mount fs /' to mount a filesystem.
317 ><fs> mount /dev/vda1 /
318 Tip: Use 'll /' to view the filesystem or ...
319 ><fs> ll /
320
321 New guestfish commands
322 ----------------------
323
324 'list-filesystems' => list mountable filesystems
325
326 We could implement this as a new API call, replacing a number of areas
327 of the current code where this is done already (in virt-inspector and
328 elsewhere).  What we normally do to find out if a partition contains a
329 mountable filesystem is to just blindly mount it, and see if that
330 succeeds.  However the kernel won't let us do this if the filesystem
331 is already mounted somewhere, so a naive implementation of this in the
332 daemon won't work.  We would have to check if the partition was
333 already mounted.
334
335 Could we make guestfish interactive if commands are used without params?
336 ------------------------------------------------------------------------
337
338 ><fs> sparse
339 [[Prints man page]]
340 Image name? disk.img
341 Size of image? 10M
342
343 Common problems
344 ---------------
345
346 How can we solve these common user problems?
347
348 - http://lists.fedoraproject.org/pipermail/users/2010-June/374931.html
349   In guestfish, specified -m non-existent filesystem.  We could suggest
350   a list of filesystems, or suggest they run the virt-list-filesystems
351   command.
352
353 Progress of long-running operations
354 -----------------------------------
355
356 For example, copying in virt-resize.  How can we display the progress
357 of these operations?  This is a basic usability requirement, and
358 frequently requested.
359
360 Better support for encrypted devices
361 ------------------------------------
362
363 Currently LUKS support only works if the device contains volume
364 groups.  If it contains, eg., partitions, you cannot access them.
365 We would like to add:
366
367   - An easier way to use this from guestfish.
368   - Direct access to the /dev/mapper device (eg. if it contains
369     anything apart from VGs).