Mac OS X: Use gnulib setenv module explicitly.
[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 Python bindings
10 ---------------
11
12 Ideas for the Python bindings:
13 https://www.redhat.com/archives/fedora-virt/2009-April/msg00114.html
14
15 FUSE API
16 --------
17
18 The API needs more test coverage, particularly lesser-used system
19 calls.
20
21 The big unresolved issue is UID/GID mapping between guest filesystem
22 IDs and the host.  It's not easy to automate this because you need
23 extra details about the guest itself in order to get to its
24 UID->username map (eg. /etc/passwd from the guest).
25
26 BufferIn
27 --------
28
29 BufferIn should turn into <char *, int> and simple strings in other
30 languages that can handle 8 bit clean strings.
31
32 Limit on transfers would still be 2MB for these types.
33  - then implement write-file properly
34
35 febootstrap / debootstrap inside appliance
36 ------------------------------------------
37
38 This was originally proposed as a way to install new operating systems
39 in the appliance.  However no one has come up with a workable
40 solution.
41
42 Haskell bindings
43 ----------------
44
45 Complete the Haskell bindings (see discussion on haskell-cafe).
46
47 Complete bind tests
48 -------------------
49
50 Complete the bind tests - must test the return values and error cases.
51
52 virt-inspector - make libvirt XML
53 ---------------------------------
54
55 It should be possible to generate libvirt XML from virt-inspector
56 data, at least partially.  This would be just another output type so:
57
58  virt-inspector --libvirt guest.img
59
60 Note that recent versions of libvirt/virt-install allow guests to be
61 imported, so this is not so useful any more.
62
63 "Standalone/local mode"
64 -----------------------
65
66 Instead of running guestfsd (the daemon) inside qemu, there should be
67 an option to just run guestfsd directly.
68
69 The architecture in this mode would look like:
70
71      +------------------+
72      | main program     |
73      |------------------|
74      | libguestfs       |
75      +--------^---------+
76           |   | reply
77       cmd |   |
78      +----v-------------+
79      | guestfsd         |
80      +------------------+
81
82 Notes:
83
84 (1) This only makes sense if we are running as root.
85
86 (2) There is no console / kernel messages in this configuration, but
87 we might consider capturing stderr from the daemon.
88
89 (3) guestfs_config and guestfs_add_drive become no-ops.
90
91 Obviously in this configuration, commands are run directly on the
92 local machine's disks.  You could just run the commands themselves
93 directly, but libguestfs provides a convenient API and language
94 bindings.  Also deals with tricky stuff like parsing the output of the
95 LVM commands.  Also we get to leverage other code such as
96 virt-inspector.
97
98 This is mainly useful from live CDs, ie. virt-p2v.
99
100 Should we bother having the daemon at all and just link the guestfsd
101 code directly into libguestfs?
102
103 PPC problems
104 ------------
105
106 [This section should be filed as bugs, but no one seems to care for
107 PPC hosts and the hardware is rapidly becoming obsolete]
108
109   ppc (32 bit) works with qemu from git, however there is no serial console
110
111   ppc64 requires extra parameters:
112     -M mac99 -cpu ppc64
113   however it still fails:
114     invalid/unsupported opcode: 01 - 01 - 1a (06301e83) 00000000018c2738 1
115     invalid bits: 00400000 for opcode: 0b - 19 - 15 (2d746572) 0000000000009230
116
117   no serial console in ppc or ppc64 because no one can tell us what
118   console=ttyXX option to use
119
120 Supermin appliance to febootstrap
121 ---------------------------------
122
123 Supermin appliance functionality should be moved into febootstrap.
124
125 Ideas for extra commands
126 ------------------------
127
128   General glibc / core programs:
129     chgrp
130     more mk*temp calls
131
132   ext2 properties:
133     chattr
134     lsattr
135     badblocks
136     blkid
137     debugfs
138     dumpe2fs
139     e2image
140     e2undo
141     filefrag
142     findfs
143     logsave
144     mklost+found
145
146   SELinux:
147     chcat
148     restorecon
149     ch???
150
151   Oddball:
152     pivot_root
153     fts(3) / ftw(3)
154
155 Other initrd-* commands
156 -----------------------
157
158 Such as:
159
160 initrd-extract
161 initrd-replace
162
163 Simple editing of configuration files
164 -------------------------------------
165
166 Some easy non-Augeas methods to edit configuration files.
167 I'm thinking:
168
169   replace /etc/file key value
170
171 which would look in /etc/file for any instances of
172
173   key=...
174   key ...
175   key:...
176
177 and replace them with
178
179   key=value
180   key value
181   key:value
182
183 That would solve about 50% of reconfiguration needs, and for the
184 rest you'd use Augeas, 'download'+'upload' or 'edit'.
185
186 RWMJ: I had a go at implementing this, but it's quite error-prone to
187 do this sort of editing inside the C-based daemon code.  It's far
188 better to do it with Augeas, or else to use an external language like
189 Perl.
190
191 Quick Perl scripts
192 ------------------
193
194 Currently we can't do Perl "one-liners".  ie. The current syntax for
195 any short Perl one-liner would be:
196
197   perl -MSys::Guestfs -e '$g = Sys::Guestfs->new(); $g->add_drive ("foo"); $g->launch; $g->mount ("/dev/sda1", "/"); ....'
198
199 You can see we're well beyond a single line just getting to the point
200 of adding drives and mounting.
201
202 First suggestion:
203
204  $h = create ($filename, \"/dev/sda1\" => \"/\");
205
206  $h = create ([$file1, $file2], \"/dev/sda1\" => \"/\");
207
208 To mount read-only, add C<ro =E<gt> 1> like this:
209
210  $h = create ($filename, \"/dev/sda1\" => \"/\", ro => 1);
211
212 which is equivalent to the following sequence of calls:
213
214  $h = Sys::Guestfs->new ();
215  $h->set_autosync (1);
216  $h->add_drive_ro ($filename);
217  $h->launch ();
218  $h->mount_ro (\"/dev/sda1\", \"/\");
219
220 Command-line form would be:
221
222  perl -MSys::Guestfs=:all -e '$_=create("guest.img", "/dev/sda1" => "/"); $_->cat ("/etc/fstab");'
223
224 That's not brief enough for one-liners, so we could have an extra
225 autogenerated module which creates a Sys::Guestfs handle singleton
226 (the handle is an implicit global variable as in guestfish), eg:
227
228  perl -MSys::Guestfs::One -e 'inspect("guest.img"); cat ("/etc/fstab");'
229
230 How would editing files work?
231
232 ntfsclone
233 ---------
234
235 Useful imaging tool:
236 http://man.linux-ntfs.org/ntfsclone.8.html
237
238 Standard images
239 ---------------
240
241 Equip guestfish with some standard images that it can load
242 quickly, eg:
243
244   load ext2
245
246 Maybe it's better to create these on the fly?
247
248 virt-rescue pty
249 ---------------
250
251 See:
252 http://search.cpan.org/~rgiersig/IO-Tty-1.08/Pty.pm
253 http://www.perlmonks.org/index.pl?node_id=582185
254
255 Note that pty requires cooperation inside the C code too (there are
256 two sides to a pty, and one has to be handled after the fork).
257
258 virt-rescue TERM
259 ----------------
260
261 Pass TERM from the library, through the kernel command line, to the
262 init script.
263
264 Windows-based daemon/appliance
265 ------------------------------
266
267 See discussion on list:
268 https://www.redhat.com/archives/libguestfs/2009-November/msg00165.html
269
270 virt-grow, virt-shrink
271 ----------------------
272
273 Grow and shrink existing guests.  The main problem comes with
274 MBR-style partitions where you have to actually copy data around the
275 disk (unless you only want to change the final partition).
276
277 qemu locking
278 ------------
279
280 Add -drive file=...,lock=exclusive and -drive file=...,lock=shared
281
282 Change libguestfs and libvirt to do the right thing, so that multiple
283 instances of qemu cannot stomp on each other.
284
285 virt-disk-explore
286 -----------------
287
288 For multi-level disk images such as live CDs:
289 http://rwmj.wordpress.com/2009/07/15/unpack-the-russian-doll-of-a-f11-live-cd/
290
291 It's possible with libguestfs to recursively look for anything that
292 might be a filesystem, mount-{,loop} it and look in those, revealing
293 anything in a disk image.
294
295 However this won't work easily for VM disk images in the disk image.
296 One would have to download those to the host and launch another
297 libguestfs instance.