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