|
|
538efe |
From 83c72d9bf9d6a9ccf6939b4ebd0028b62673a78a Mon Sep 17 00:00:00 2001
|
|
|
538efe |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
538efe |
Date: Thu, 12 Dec 2019 10:57:52 +0000
|
|
|
538efe |
Subject: [PATCH 03/19] server: Add -D nbdkit.backend.controlpath and -D
|
|
|
538efe |
nbdkit.backend.datapath.
|
|
|
538efe |
|
|
|
538efe |
These can be used to suppress verbose debugging messages from the
|
|
|
538efe |
backend.
|
|
|
538efe |
|
|
|
538efe |
BugLink: https://bugzilla.redhat.com/1782868
|
|
|
538efe |
|
|
|
538efe |
Cherry picked from commit 231717e8cd5f27d76631be6651062d5a5ccf7fdc.
|
|
|
538efe |
Remove use of nofilter from the test.
|
|
|
538efe |
---
|
|
|
538efe |
docs/nbdkit.pod | 35 ++++++++++++-
|
|
|
538efe |
server/backend.c | 83 ++++++++++++++++++------------
|
|
|
538efe |
tests/Makefile.am | 4 ++
|
|
|
538efe |
tests/test-nbdkit-backend-debug.sh | 70 +++++++++++++++++++++++++
|
|
|
538efe |
4 files changed, 158 insertions(+), 34 deletions(-)
|
|
|
538efe |
create mode 100755 tests/test-nbdkit-backend-debug.sh
|
|
|
538efe |
|
|
|
538efe |
diff --git a/docs/nbdkit.pod b/docs/nbdkit.pod
|
|
|
538efe |
index 346d8332..38e6bfca 100644
|
|
|
538efe |
--- a/docs/nbdkit.pod
|
|
|
538efe |
+++ b/docs/nbdkit.pod
|
|
|
538efe |
@@ -182,7 +182,7 @@ value C<N>. See L<nbdkit-plugin(3)/Debug Flags>.
|
|
|
538efe |
=item B<--debug> nbdkit.FLAG=N
|
|
|
538efe |
|
|
|
538efe |
Set the nbdkit server Debug Flag called C<FLAG> to the integer value
|
|
|
538efe |
-C<N>.
|
|
|
538efe |
+C<N>. See L</SERVER DEBUG FLAGS> below.
|
|
|
538efe |
|
|
|
538efe |
=item B<--dump-config>
|
|
|
538efe |
|
|
|
538efe |
@@ -527,6 +527,39 @@ languages. The file should be executable. For example:
|
|
|
538efe |
|
|
|
538efe |
(see L<nbdkit-perl-plugin(3)> for a full example).
|
|
|
538efe |
|
|
|
538efe |
+=head1 SERVER DEBUG FLAGS
|
|
|
538efe |
+
|
|
|
538efe |
+As well as enabling or disabling debugging in the server using
|
|
|
538efe |
+I<--verbose> you can control extra debugging in the server using the
|
|
|
538efe |
+C<-D nbdkit.*> flags listed in this section. Note these flags are an
|
|
|
538efe |
+internal implementation detail of the server and may be changed or
|
|
|
538efe |
+removed at any time in the future.
|
|
|
538efe |
+
|
|
|
538efe |
+=over 4
|
|
|
538efe |
+
|
|
|
538efe |
+=item B<-D nbdkit.backend.controlpath=0>
|
|
|
538efe |
+
|
|
|
538efe |
+=item B<-D nbdkit.backend.controlpath=1>
|
|
|
538efe |
+
|
|
|
538efe |
+=item B<-D nbdkit.backend.datapath=0>
|
|
|
538efe |
+
|
|
|
538efe |
+=item B<-D nbdkit.backend.datapath=1>
|
|
|
538efe |
+
|
|
|
538efe |
+These flags control the verbosity of nbdkit backend debugging messages
|
|
|
538efe |
+(the ones which show every request processed by the server). The
|
|
|
538efe |
+default for both settings is C<1> (normal debugging) but you can set
|
|
|
538efe |
+them to C<0> to suppress these messages.
|
|
|
538efe |
+
|
|
|
538efe |
+C<-D nbdkit.backend.datapath=0> is the more useful setting which lets you
|
|
|
538efe |
+suppress messages about pread, pwrite, zero, trim, etc. commands.
|
|
|
538efe |
+When transferring large amounts of data these messages are numerous
|
|
|
538efe |
+and not usually very interesting.
|
|
|
538efe |
+
|
|
|
538efe |
+C<-D nbdkit.backend.controlpath=0> suppresses the non-datapath
|
|
|
538efe |
+commands (config, open, close, can_write, etc.)
|
|
|
538efe |
+
|
|
|
538efe |
+=back
|
|
|
538efe |
+
|
|
|
538efe |
=head1 SIGNALS
|
|
|
538efe |
|
|
|
538efe |
nbdkit responds to the following signals:
|
|
|
538efe |
diff --git a/server/backend.c b/server/backend.c
|
|
|
538efe |
index b9fe2a21..208c07b1 100644
|
|
|
538efe |
--- a/server/backend.c
|
|
|
538efe |
+++ b/server/backend.c
|
|
|
538efe |
@@ -46,6 +46,22 @@
|
|
|
538efe |
|
|
|
538efe |
/* Helpers for registering a new backend. */
|
|
|
538efe |
|
|
|
538efe |
+/* Use:
|
|
|
538efe |
+ * -D nbdkit.backend.controlpath=0 to suppress control path debugging.
|
|
|
538efe |
+ * -D nbdkit.backend.datapath=0 to suppress data path debugging.
|
|
|
538efe |
+ */
|
|
|
538efe |
+int nbdkit_debug_backend_controlpath = 1;
|
|
|
538efe |
+int nbdkit_debug_backend_datapath = 1;
|
|
|
538efe |
+
|
|
|
538efe |
+#define controlpath_debug(fs, ...) \
|
|
|
538efe |
+ do { \
|
|
|
538efe |
+ if (nbdkit_debug_backend_controlpath) debug ((fs), ##__VA_ARGS__); \
|
|
|
538efe |
+ } while (0)
|
|
|
538efe |
+#define datapath_debug(fs, ...) \
|
|
|
538efe |
+ do { \
|
|
|
538efe |
+ if (nbdkit_debug_backend_datapath) debug ((fs), ##__VA_ARGS__); \
|
|
|
538efe |
+ } while (0)
|
|
|
538efe |
+
|
|
|
538efe |
void
|
|
|
538efe |
backend_init (struct backend *b, struct backend *next, size_t index,
|
|
|
538efe |
const char *filename, void *dl, const char *type)
|
|
|
538efe |
@@ -108,7 +124,7 @@ backend_load (struct backend *b, const char *name, void (*load) (void))
|
|
|
538efe |
apply_debug_flags (b->dl, name);
|
|
|
538efe |
|
|
|
538efe |
/* Call the on-load callback if it exists. */
|
|
|
538efe |
- debug ("%s: load", name);
|
|
|
538efe |
+ controlpath_debug ("%s: load", name);
|
|
|
538efe |
if (load)
|
|
|
538efe |
load ();
|
|
|
538efe |
}
|
|
|
538efe |
@@ -121,7 +137,7 @@ backend_unload (struct backend *b, void (*unload) (void))
|
|
|
538efe |
*/
|
|
|
538efe |
lock_unload ();
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: unload %s", b->name, b->type);
|
|
|
538efe |
+ controlpath_debug ("%s: unload %s", b->name, b->type);
|
|
|
538efe |
if (unload)
|
|
|
538efe |
unload ();
|
|
|
538efe |
|
|
|
538efe |
@@ -139,7 +155,7 @@ backend_open (struct backend *b, struct connection *conn, int readonly)
|
|
|
538efe |
{
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: open readonly=%d", b->name, readonly);
|
|
|
538efe |
+ controlpath_debug ("%s: open readonly=%d", b->name, readonly);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle == NULL);
|
|
|
538efe |
assert ((h->state & HANDLE_OPEN) == 0);
|
|
|
538efe |
@@ -151,7 +167,7 @@ backend_open (struct backend *b, struct connection *conn, int readonly)
|
|
|
538efe |
* inner-to-outer ordering.
|
|
|
538efe |
*/
|
|
|
538efe |
h->handle = b->open (b, conn, readonly);
|
|
|
538efe |
- debug ("%s: open returned handle %p", b->name, h->handle);
|
|
|
538efe |
+ controlpath_debug ("%s: open returned handle %p", b->name, h->handle);
|
|
|
538efe |
|
|
|
538efe |
if (h->handle == NULL) {
|
|
|
538efe |
if (b->i) /* Do not strand backend if this layer failed */
|
|
|
538efe |
@@ -179,7 +195,7 @@ backend_prepare (struct backend *b, struct connection *conn)
|
|
|
538efe |
if (b->i && backend_prepare (b->next, conn) == -1)
|
|
|
538efe |
return -1;
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: prepare readonly=%d", b->name, h->can_write == 0);
|
|
|
538efe |
+ controlpath_debug ("%s: prepare readonly=%d", b->name, h->can_write == 0);
|
|
|
538efe |
|
|
|
538efe |
if (b->prepare (b, conn, h->handle, h->can_write == 0) == -1)
|
|
|
538efe |
return -1;
|
|
|
538efe |
@@ -196,7 +212,7 @@ backend_finalize (struct backend *b, struct connection *conn)
|
|
|
538efe |
* filter furthest away from the plugin, and matching .close order.
|
|
|
538efe |
*/
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: finalize", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: finalize", b->name);
|
|
|
538efe |
|
|
|
538efe |
/* Once finalize fails, we can do nothing further on this connection */
|
|
|
538efe |
if (h->state & HANDLE_FAILED)
|
|
|
538efe |
@@ -223,7 +239,7 @@ backend_close (struct backend *b, struct connection *conn)
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
/* outer-to-inner order, opposite .open */
|
|
|
538efe |
- debug ("%s: close", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: close", b->name);
|
|
|
538efe |
|
|
|
538efe |
if (h->handle) {
|
|
|
538efe |
assert (h->state & HANDLE_OPEN);
|
|
|
538efe |
@@ -252,7 +268,7 @@ backend_valid_range (struct backend *b, struct connection *conn,
|
|
|
538efe |
int
|
|
|
538efe |
backend_reopen (struct backend *b, struct connection *conn, int readonly)
|
|
|
538efe |
{
|
|
|
538efe |
- debug ("%s: reopen readonly=%d", b->name, readonly);
|
|
|
538efe |
+ controlpath_debug ("%s: reopen readonly=%d", b->name, readonly);
|
|
|
538efe |
|
|
|
538efe |
if (backend_finalize (b, conn) == -1)
|
|
|
538efe |
return -1;
|
|
|
538efe |
@@ -274,7 +290,7 @@ backend_get_size (struct backend *b, struct connection *conn)
|
|
|
538efe |
{
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: get_size", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: get_size", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->exportsize == -1)
|
|
|
538efe |
@@ -287,7 +303,7 @@ backend_can_write (struct backend *b, struct connection *conn)
|
|
|
538efe |
{
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: can_write", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_write", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->can_write == -1)
|
|
|
538efe |
@@ -300,7 +316,7 @@ backend_can_flush (struct backend *b, struct connection *conn)
|
|
|
538efe |
{
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: can_flush", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_flush", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->can_flush == -1)
|
|
|
538efe |
@@ -313,7 +329,7 @@ backend_is_rotational (struct backend *b, struct connection *conn)
|
|
|
538efe |
{
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: is_rotational", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: is_rotational", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->is_rotational == -1)
|
|
|
538efe |
@@ -327,7 +343,7 @@ backend_can_trim (struct backend *b, struct connection *conn)
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
int r;
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: can_trim", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_trim", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->can_trim == -1) {
|
|
|
538efe |
@@ -347,7 +363,7 @@ backend_can_zero (struct backend *b, struct connection *conn)
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
int r;
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: can_zero", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_zero", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->can_zero == -1) {
|
|
|
538efe |
@@ -367,7 +383,7 @@ backend_can_fast_zero (struct backend *b, struct connection *conn)
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
int r;
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: can_fast_zero", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_fast_zero", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->can_fast_zero == -1) {
|
|
|
538efe |
@@ -386,7 +402,7 @@ backend_can_extents (struct backend *b, struct connection *conn)
|
|
|
538efe |
{
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: can_extents", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_extents", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->can_extents == -1)
|
|
|
538efe |
@@ -400,7 +416,7 @@ backend_can_fua (struct backend *b, struct connection *conn)
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
int r;
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: can_fua", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_fua", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->can_fua == -1) {
|
|
|
538efe |
@@ -420,7 +436,7 @@ backend_can_multi_conn (struct backend *b, struct connection *conn)
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
- debug ("%s: can_multi_conn", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_multi_conn", b->name);
|
|
|
538efe |
|
|
|
538efe |
if (h->can_multi_conn == -1)
|
|
|
538efe |
h->can_multi_conn = b->can_multi_conn (b, conn, h->handle);
|
|
|
538efe |
@@ -432,7 +448,7 @@ backend_can_cache (struct backend *b, struct connection *conn)
|
|
|
538efe |
{
|
|
|
538efe |
struct b_conn_handle *h = &conn->handles[b->i];
|
|
|
538efe |
|
|
|
538efe |
- debug ("%s: can_cache", b->name);
|
|
|
538efe |
+ controlpath_debug ("%s: can_cache", b->name);
|
|
|
538efe |
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
if (h->can_cache == -1)
|
|
|
538efe |
@@ -451,8 +467,8 @@ backend_pread (struct backend *b, struct connection *conn,
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
assert (backend_valid_range (b, conn, offset, count));
|
|
|
538efe |
assert (flags == 0);
|
|
|
538efe |
- debug ("%s: pread count=%" PRIu32 " offset=%" PRIu64,
|
|
|
538efe |
- b->name, count, offset);
|
|
|
538efe |
+ datapath_debug ("%s: pread count=%" PRIu32 " offset=%" PRIu64,
|
|
|
538efe |
+ b->name, count, offset);
|
|
|
538efe |
|
|
|
538efe |
r = b->pread (b, conn, h->handle, buf, count, offset, flags, err);
|
|
|
538efe |
if (r == -1)
|
|
|
538efe |
@@ -475,8 +491,8 @@ backend_pwrite (struct backend *b, struct connection *conn,
|
|
|
538efe |
assert (!(flags & ~NBDKIT_FLAG_FUA));
|
|
|
538efe |
if (fua)
|
|
|
538efe |
assert (h->can_fua > NBDKIT_FUA_NONE);
|
|
|
538efe |
- debug ("%s: pwrite count=%" PRIu32 " offset=%" PRIu64 " fua=%d",
|
|
|
538efe |
- b->name, count, offset, fua);
|
|
|
538efe |
+ datapath_debug ("%s: pwrite count=%" PRIu32 " offset=%" PRIu64 " fua=%d",
|
|
|
538efe |
+ b->name, count, offset, fua);
|
|
|
538efe |
|
|
|
538efe |
r = b->pwrite (b, conn, h->handle, buf, count, offset, flags, err);
|
|
|
538efe |
if (r == -1)
|
|
|
538efe |
@@ -494,7 +510,7 @@ backend_flush (struct backend *b, struct connection *conn,
|
|
|
538efe |
assert (h->handle && (h->state & HANDLE_CONNECTED));
|
|
|
538efe |
assert (h->can_flush == 1);
|
|
|
538efe |
assert (flags == 0);
|
|
|
538efe |
- debug ("%s: flush", b->name);
|
|
|
538efe |
+ datapath_debug ("%s: flush", b->name);
|
|
|
538efe |
|
|
|
538efe |
r = b->flush (b, conn, h->handle, flags, err);
|
|
|
538efe |
if (r == -1)
|
|
|
538efe |
@@ -518,8 +534,8 @@ backend_trim (struct backend *b, struct connection *conn,
|
|
|
538efe |
assert (!(flags & ~NBDKIT_FLAG_FUA));
|
|
|
538efe |
if (fua)
|
|
|
538efe |
assert (h->can_fua > NBDKIT_FUA_NONE);
|
|
|
538efe |
- debug ("%s: trim count=%" PRIu32 " offset=%" PRIu64 " fua=%d",
|
|
|
538efe |
- b->name, count, offset, fua);
|
|
|
538efe |
+ datapath_debug ("%s: trim count=%" PRIu32 " offset=%" PRIu64 " fua=%d",
|
|
|
538efe |
+ b->name, count, offset, fua);
|
|
|
538efe |
|
|
|
538efe |
r = b->trim (b, conn, h->handle, count, offset, flags, err);
|
|
|
538efe |
if (r == -1)
|
|
|
538efe |
@@ -547,9 +563,10 @@ backend_zero (struct backend *b, struct connection *conn,
|
|
|
538efe |
assert (h->can_fua > NBDKIT_FUA_NONE);
|
|
|
538efe |
if (fast)
|
|
|
538efe |
assert (h->can_fast_zero == 1);
|
|
|
538efe |
- debug ("%s: zero count=%" PRIu32 " offset=%" PRIu64
|
|
|
538efe |
- " may_trim=%d fua=%d fast=%d",
|
|
|
538efe |
- b->name, count, offset, !!(flags & NBDKIT_FLAG_MAY_TRIM), fua, fast);
|
|
|
538efe |
+ datapath_debug ("%s: zero count=%" PRIu32 " offset=%" PRIu64
|
|
|
538efe |
+ " may_trim=%d fua=%d fast=%d",
|
|
|
538efe |
+ b->name, count, offset,
|
|
|
538efe |
+ !!(flags & NBDKIT_FLAG_MAY_TRIM), fua, fast);
|
|
|
538efe |
|
|
|
538efe |
r = b->zero (b, conn, h->handle, count, offset, flags, err);
|
|
|
538efe |
if (r == -1) {
|
|
|
538efe |
@@ -572,8 +589,8 @@ backend_extents (struct backend *b, struct connection *conn,
|
|
|
538efe |
assert (h->can_extents >= 0);
|
|
|
538efe |
assert (backend_valid_range (b, conn, offset, count));
|
|
|
538efe |
assert (!(flags & ~NBDKIT_FLAG_REQ_ONE));
|
|
|
538efe |
- debug ("%s: extents count=%" PRIu32 " offset=%" PRIu64 " req_one=%d",
|
|
|
538efe |
- b->name, count, offset, !!(flags & NBDKIT_FLAG_REQ_ONE));
|
|
|
538efe |
+ datapath_debug ("%s: extents count=%" PRIu32 " offset=%" PRIu64 " req_one=%d",
|
|
|
538efe |
+ b->name, count, offset, !!(flags & NBDKIT_FLAG_REQ_ONE));
|
|
|
538efe |
|
|
|
538efe |
if (h->can_extents == 0) {
|
|
|
538efe |
/* By default it is safe assume that everything in the range is
|
|
|
538efe |
@@ -602,8 +619,8 @@ backend_cache (struct backend *b, struct connection *conn,
|
|
|
538efe |
assert (h->can_cache > NBDKIT_CACHE_NONE);
|
|
|
538efe |
assert (backend_valid_range (b, conn, offset, count));
|
|
|
538efe |
assert (flags == 0);
|
|
|
538efe |
- debug ("%s: cache count=%" PRIu32 " offset=%" PRIu64,
|
|
|
538efe |
- b->name, count, offset);
|
|
|
538efe |
+ datapath_debug ("%s: cache count=%" PRIu32 " offset=%" PRIu64,
|
|
|
538efe |
+ b->name, count, offset);
|
|
|
538efe |
|
|
|
538efe |
if (h->can_cache == NBDKIT_CACHE_EMULATE) {
|
|
|
538efe |
static char buf[MAX_REQUEST_SIZE]; /* data sink, never read */
|
|
|
538efe |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
|
538efe |
index 01341973..d225cc63 100644
|
|
|
538efe |
--- a/tests/Makefile.am
|
|
|
538efe |
+++ b/tests/Makefile.am
|
|
|
538efe |
@@ -135,6 +135,7 @@ EXTRA_DIST = \
|
|
|
538efe |
test-nbd-extents.sh \
|
|
|
538efe |
test-nbd-tls.sh \
|
|
|
538efe |
test-nbd-tls-psk.sh \
|
|
|
538efe |
+ test-nbdkit-backend-debug.sh \
|
|
|
538efe |
test-nozero.sh \
|
|
|
538efe |
test-null-extents.sh \
|
|
|
538efe |
test_ocaml_plugin.ml \
|
|
|
538efe |
@@ -746,6 +747,9 @@ endif HAVE_VDDK
|
|
|
538efe |
# zero plugin test.
|
|
|
538efe |
TESTS += test-zero.sh
|
|
|
538efe |
|
|
|
538efe |
+# -D nbdkit.backend.* settings.
|
|
|
538efe |
+TESTS += test-nbdkit-backend-debug.sh
|
|
|
538efe |
+
|
|
|
538efe |
#----------------------------------------------------------------------
|
|
|
538efe |
# Tests of language plugins.
|
|
|
538efe |
|
|
|
538efe |
diff --git a/tests/test-nbdkit-backend-debug.sh b/tests/test-nbdkit-backend-debug.sh
|
|
|
538efe |
new file mode 100755
|
|
|
538efe |
index 00000000..69a69a7c
|
|
|
538efe |
--- /dev/null
|
|
|
538efe |
+++ b/tests/test-nbdkit-backend-debug.sh
|
|
|
538efe |
@@ -0,0 +1,70 @@
|
|
|
538efe |
+#!/usr/bin/env bash
|
|
|
538efe |
+# nbdkit
|
|
|
538efe |
+# Copyright (C) 2019 Red Hat Inc.
|
|
|
538efe |
+#
|
|
|
538efe |
+# Redistribution and use in source and binary forms, with or without
|
|
|
538efe |
+# modification, are permitted provided that the following conditions are
|
|
|
538efe |
+# met:
|
|
|
538efe |
+#
|
|
|
538efe |
+# * Redistributions of source code must retain the above copyright
|
|
|
538efe |
+# notice, this list of conditions and the following disclaimer.
|
|
|
538efe |
+#
|
|
|
538efe |
+# * Redistributions in binary form must reproduce the above copyright
|
|
|
538efe |
+# notice, this list of conditions and the following disclaimer in the
|
|
|
538efe |
+# documentation and/or other materials provided with the distribution.
|
|
|
538efe |
+#
|
|
|
538efe |
+# * Neither the name of Red Hat nor the names of its contributors may be
|
|
|
538efe |
+# used to endorse or promote products derived from this software without
|
|
|
538efe |
+# specific prior written permission.
|
|
|
538efe |
+#
|
|
|
538efe |
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
|
|
|
538efe |
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
538efe |
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
|
538efe |
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
|
|
|
538efe |
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
538efe |
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
538efe |
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
|
|
538efe |
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
|
538efe |
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
538efe |
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
538efe |
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
538efe |
+# SUCH DAMAGE.
|
|
|
538efe |
+
|
|
|
538efe |
+source ./functions.sh
|
|
|
538efe |
+set -x
|
|
|
538efe |
+set -e
|
|
|
538efe |
+
|
|
|
538efe |
+requires qemu-img --version
|
|
|
538efe |
+
|
|
|
538efe |
+out="test-nbdkit-backend-debug.out"
|
|
|
538efe |
+debug="test-nbdkit-backend-debug.debug"
|
|
|
538efe |
+files="$out $debug"
|
|
|
538efe |
+rm -f $files
|
|
|
538efe |
+cleanup_fn rm -f $files
|
|
|
538efe |
+
|
|
|
538efe |
+nbdkit -U - \
|
|
|
538efe |
+ -v \
|
|
|
538efe |
+ memory 10M \
|
|
|
538efe |
+ --run "qemu-img convert \$nbd $out" |& tee $debug
|
|
|
538efe |
+
|
|
|
538efe |
+# Should contain all debugging messages.
|
|
|
538efe |
+grep '^nbdkit:.*debug: memory: open' $debug
|
|
|
538efe |
+grep '^nbdkit:.*debug: memory: pread' $debug
|
|
|
538efe |
+
|
|
|
538efe |
+nbdkit -U - \
|
|
|
538efe |
+ -v -D nbdkit.backend.controlpath=0 \
|
|
|
538efe |
+ memory 10M \
|
|
|
538efe |
+ --run "qemu-img convert \$nbd $out" |& tee $debug
|
|
|
538efe |
+
|
|
|
538efe |
+# Should contain only datapath messages.
|
|
|
538efe |
+grep -v '^nbdkit:.*debug: memory: open' $debug
|
|
|
538efe |
+grep '^nbdkit:.*debug: memory: pread' $debug
|
|
|
538efe |
+
|
|
|
538efe |
+nbdkit -U - \
|
|
|
538efe |
+ -v -D nbdkit.backend.datapath=0 \
|
|
|
538efe |
+ memory 10M \
|
|
|
538efe |
+ --run "qemu-img convert \$nbd $out" |& tee $debug
|
|
|
538efe |
+
|
|
|
538efe |
+# Should contain only controlpath messages.
|
|
|
538efe |
+grep '^nbdkit:.*debug: memory: open' $debug
|
|
|
538efe |
+grep -v '^nbdkit:.*debug: memory: pread' $debug
|
|
|
538efe |
--
|
|
|
538efe |
2.18.2
|
|
|
538efe |
|