Pass '-z' parameter to 'file' command so it looks inside compressed files.
[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 FTP server or FUSE?
16 -------------------
17
18 Originally we had intended to implement an NFS server inside the
19 appliance, which would allow the guest filesystems to be mounted on
20 the host, and large changes to be made.  We eventually rejected the
21 idea of using NFS, partly because it requires root to mount
22 filesystems in the host, and partly because of problems handling UID
23 mappings between host and guest filesystem.
24
25 Then we look at implementing an FTP server instead.  FTP clients are
26 widely available for many languages, don't require root, and don't
27 have any UID mapping problems.  However there is the problem of
28 getting the TCP connection into the guest, and that FTP requires a
29 secondary data connection either in or out of the guest (the NFS
30 situation is even more dire).
31
32 Thirdly we looked at implementing a FUSE-based filesystem.  This is
33 plausible - it could be implemented just by adding the additional FUSE
34 operations to the standard guestfs(3) API, and then implementing a
35 simple FUSE daemon.  (The FUSE website has some very helpful
36 documentation and examples).  I [RWMJ] am not particularly convinced
37 that a FUSE-based filesystem would really be useful to anyone, but am
38 prepared to accept patches if someone does all the work.
39
40 See also the mountlo project:
41 http://sourceforge.net/project/showfiles.php?group_id=121684&package_id=150116
42
43 BufferIn
44 --------
45
46 BufferIn should turn into <char *, int> and simple strings in other
47 languages that can handle 8 bit clean strings.
48
49 Limit on transfers would still be 2MB for these types.
50  - then implement write-file properly
51
52 febootstrap / debootstrap inside appliance
53 ------------------------------------------
54
55 This was originally proposed as a way to install new operating systems
56 in the appliance.  However no one has come up with a workable
57 solution.
58
59 Haskell bindings
60 ----------------
61
62 Complete the Haskell bindings (see discussion on haskell-cafe).
63
64 Complete bind tests
65 -------------------
66
67 Complete the bind tests - must test the return values and error cases.
68
69 virt-inspector - make libvirt XML
70 ---------------------------------
71
72 It should be possible to generate libvirt XML from virt-inspector
73 data, at least partially.  This would be just another output type so:
74
75  virt-inspector --libvirt guest.img
76
77 Note that recent versions of libvirt/virt-install allow guests to be
78 imported, so this is not so useful any more.
79
80 "Standalone/local mode"
81 -----------------------
82
83 Instead of running guestfsd (the daemon) inside qemu, there should be
84 an option to just run guestfsd directly.
85
86 The architecture in this mode would look like:
87
88      +------------------+
89      | main program     |
90      |------------------|
91      | libguestfs       |
92      +--------^---------+
93           |   | reply
94       cmd |   |
95      +----v-------------+
96      | guestfsd         |
97      +------------------+
98
99 Notes:
100
101 (1) This only makes sense if we are running as root.
102
103 (2) There is no console / kernel messages in this configuration, but
104 we might consider capturing stderr from the daemon.
105
106 (3) guestfs_config and guestfs_add_drive become no-ops.
107
108 Obviously in this configuration, commands are run directly on the
109 local machine's disks.  You could just run the commands themselves
110 directly, but libguestfs provides a convenient API and language
111 bindings.  Also deals with tricky stuff like parsing the output of the
112 LVM commands.  Also we get to leverage other code such as
113 virt-inspector.
114
115 This is mainly useful from live CDs, ie. virt-p2v.
116
117 Should we bother having the daemon at all and just link the guestfsd
118 code directly into libguestfs?
119
120 PPC problems
121 ------------
122
123 [This section should be filed as bugs, but no one seems to care for
124 PPC hosts and the hardware is rapidly becoming obsolete]
125
126   ppc (32 bit) works with qemu from git, however there is no serial console
127
128   ppc64 requires extra parameters:
129     -M mac99 -cpu ppc64
130   however it still fails:
131     invalid/unsupported opcode: 01 - 01 - 1a (06301e83) 00000000018c2738 1
132     invalid bits: 00400000 for opcode: 0b - 19 - 15 (2d746572) 0000000000009230
133
134   no serial console in ppc or ppc64 because no one can tell us what
135   console=ttyXX option to use
136
137 Supermin appliance to febootstrap
138 ---------------------------------
139
140 Supermin appliance functionality should be moved into febootstrap.
141
142 Ideas for extra commands
143 ------------------------
144
145   General glibc / core programs:
146     chgrp
147     grep (do it locally using pipe?)
148     dd (?)
149     ln / ln -s
150     readlink
151     utime / utimes / futimes / futimens / l..
152     more mk*temp calls
153     some sort of alloc/fallocate/posix_fallocate call to create empty space
154     realpath
155     trunc[ate??]
156
157   ext2 properties:
158     chattr
159     lsattr
160     badblocks
161     blkid
162     debugfs
163     dumpe2fs
164     e2image
165     e2undo
166     filefrag
167     findfs
168     logsave
169     mklost+found
170
171   SELinux:
172     chcat
173     restorecon
174     ch???
175
176   Oddball:
177     pivot_root
178     fts(3) / ftw(3)
179
180 Swap space
181 ----------
182
183 Allow swap space from the guest to be used.  Is it a good idea?
184
185 Query guest architecture
186 ------------------------
187
188 Need a way to query a binary or library file for its architecture.
189 Using objdump or readelf?
190 What about non-ELF files (eg. Windows, BSD).
191
192 To do this properly requires some serious logic, eg. to cover Linux
193 and Windows we'd need objdump and i686-pc-mingw32-objdump, and more to
194 cover a.out, COFF and 64 bit Windows.  Therefore this cannot be done
195 inside the daemon, and should be done by a separate, external program
196 similar to virt-inspector.
197
198 Probably we should go all the way and have virt-inspector able to
199 determine kernel and userspace architectures of guests.
200
201 Other initrd-* commands
202 -----------------------
203
204 Such as:
205
206 initrd-extract
207 initrd-replace
208
209 Simple editing of configuration files
210 -------------------------------------
211
212 Some easy non-Augeas methods to edit configuration files.
213 I'm thinking:
214
215   replace /etc/file key value
216
217 which would look in /etc/file for any instances of
218
219   key=...
220   key ...
221   key:...
222
223 and replace them with
224
225   key=value
226   key value
227   key:value
228
229 That would solve about 50% of reconfiguration needs, and for the
230 rest you'd use Augeas, 'download'+'upload' or 'edit'.
231
232 RWMJ: I had a go at implementing this, but it's quite error-prone to
233 do this sort of editing inside the C-based daemon code.  It's far
234 better to do it with Augeas, or else to use an external language like
235 Perl.
236
237 Quick Perl scripts
238 ------------------
239
240 Currently we can't do Perl "one-liners".  ie. The current syntax for
241 any short Perl one-liner would be:
242
243   perl -MSys::Guestfs -e '$g = Sys::Guestfs->new(); $g->add_drive ("foo"); $g->launch; $g->wait_ready; $g->mount ("/dev/sda1", "/"); ....'
244
245 You can see we're well beyond a single line just getting to the point
246 of adding drives and mounting.
247
248 First suggestion:
249
250  $h = create ($filename, \"/dev/sda1\" => \"/\");
251
252  $h = create ([$file1, $file2], \"/dev/sda1\" => \"/\");
253
254 To mount read-only, add C<ro =E<gt> 1> like this:
255
256  $h = create ($filename, \"/dev/sda1\" => \"/\", ro => 1);
257
258 which is equivalent to the following sequence of calls:
259
260  $h = Sys::Guestfs->new ();
261  $h->set_autosync (1);
262  $h->add_drive_ro ($filename);
263  $h->launch ();
264  $h->wait_ready ();
265  $h->mount_ro (\"/dev/sda1\", \"/\");
266
267 Command-line form would be:
268
269  perl -MSys::Guestfs=:all -e '$_=create("guest.img", "/dev/sda1" => "/"); $_->cat ("/etc/fstab");'
270
271 That's not brief enough for one-liners, so we could have an extra
272 autogenerated module which creates a Sys::Guestfs handle singleton
273 (the handle is an implicit global variable as in guestfish), eg:
274
275  perl -MSys::Guestfs::One -e 'inspect("guest.img"); cat ("/etc/fstab");'
276
277 How would editing files work?