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