nbd: More debug details
[nbdkit/ericb.git] / TODO
blob9d6e727cda30a41dd73077620e684260c0154c9e
1 To-do list for nbdkit
2 ======================================================================
4 General ideas for improvements
5 ------------------------------
7 * Listen on specific interfaces or protocols (eg. only IPv6).
9 * Performance - measure and improve it.
11 * Exit on last connection (the default behaviour of qemu-nbd unless
12   you use -t).
14 * Limit number of incoming connections (like qemu-nbd -e).
16 * For parallel plugins, only create threads on demand from parallel
17   client requests, rather than pre-creating all threads at connection
18   time, up to the thread pool size limit.  Of course, once created, a
19   thread is reused as possible until the connection closes.
21 * Async callbacks.  The current parallel support requires one thread
22   per pending message; a solution with fewer threads would split
23   low-level code between request and response, where the callback has
24   to inform nbdkit when the response is ready:
25   https://www.redhat.com/archives/libguestfs/2018-January/msg00149.html
27 * More NBD protocol features. Qemu has implemented Structured Replies,
28   which allows for more efficient serving of sparse files.  Also in
29   the upstream pipeline: proposals for block status and online resize.
31 * Add a callback to let plugins request minimum alignment for the
32   buffer to pread/pwrite; useful for a plugin utilizing O_DIRECT or
33   other situation where pre-aligned buffers are more efficient.
34   Ideally, a blocksize filter would honor strict alignment below and
35   advertise loose alignment above; all other filters (particularly
36   ones like offset) can fail to initialize if they can't guarantee
37   strict alignment and don't want to deal with bounce buffers.
39 * Add per-connection caching of .can_FOO callbacks (we already have
40   some: .can_write is only called once, but .can_fua is called on
41   every request with the FUA flag set).
43 * Test that zero-length read/write requests behave correctly
44   (NBD protocol says they are unspecified).
46 * Test and document how to run nbdkit from inetd and xinetd in
47   nbdkit-service(1).
49 Suggestions for plugins
50 -----------------------
52 Note: qemu supports other formats such as libssh, libnfs, iscsi,
53 gluster and ceph/rbd, and while similar plugins could be written for
54 nbdkit there is no compelling reason unless the result is better than
55 qemu-nbd.  For the majority of users it would be better if they were
56 directed to qemu-nbd for these use cases.
58 * XVA files
60   https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg02971.html
61   is a partial solution but it needs cleaning up.
63 * Create ext2 filesystems
65   Similar to nbdkit-floppy-plugin which creates FAT32 filesystems, we
66   could also create ext2 filesystems.  This is relatively
67   straightforward using libext2fs (part of e2fsprogs).  In fact we
68   already use this library for the unrelated nbdkit-ext2-plugin.
70 nbdkit-nbd-plugin could use enhancements:
72 * FUA passthrough, rather than extra FLUSH calls.  For this, .can_fua
73   must be exposed to plugins (not just filters), and needs to be
74   tri-state rather than just bool.
76 * Enable client-side TLS (right now, the nbd plugin allows us to
77   support an encrypted client connecting to a plain server; but we
78   would need TLS to support a plain client connecting to an encrypted
79   server).
81 * Support for connecting to a server over IP rather than just Unix
82   sockets.
84 nbdkit-floppy-plugin needs boot sector support.  In theory this is
85 easy (eg. using SYSLINUX), but the practical reality of making a fully
86 bootable floppy is rather more complex.
88 Suggestions for filters
89 -----------------------
91 * tar plugin should really be a filter
93 * gzip plugin should really be a filter
95 * libarchive could be used to implement a general tar/zip filter
97 * LUKS encrypt/decrypt filter, bonus points if compatible with qemu
98   LUKS-encrypted disk images
100 * masking plugin features for testing clients (see 'nozero' and 'fua'
101   filters for examples)
103 nbdkit-cache-filter needs considerable work:
105 * allow the user to limit the total size of the cache
107 * handle ENOSPC errors
109 * implement some cache replacement policies
111 * some sort of background task or thread to write out dirty blocks
113 Composing nbdkit
114 ----------------
116 Filters allow certain types of composition, but others would not be
117 possible, for example RAIDing over multiple nbd sources.  Because the
118 plugin API limits us to loading a single plugin to the server, the
119 best way to do this (and the most robust) is to compose multiple
120 nbdkit processes.
122 The nbd plugin (plugins/nbd) already contains an NBD client, so we
123 could factor this client out and make it available to other plugins to
124 use.