Blame SOURCES/kvm-nbd-client-Trace-all-server-option-error-messages.patch

7711c0
From 3fb57e060f7c7a01f4061eab781b03ad789f5bf5 Mon Sep 17 00:00:00 2001
7711c0
From: John Snow <jsnow@redhat.com>
7711c0
Date: Wed, 27 Mar 2019 17:22:18 +0100
7711c0
Subject: [PATCH 079/163] nbd/client: Trace all server option error messages
7711c0
7711c0
RH-Author: John Snow <jsnow@redhat.com>
7711c0
Message-id: <20190327172308.31077-6-jsnow@redhat.com>
7711c0
Patchwork-id: 85181
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 05/55] nbd/client: Trace all server option error messages
7711c0
Bugzilla: 1691009
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
From: Eric Blake <eblake@redhat.com>
7711c0
7711c0
Not all servers send free-form text alongside option error replies, but
7711c0
for servers that do (such as qemu), we pass the server's message as a
7711c0
hint alongside our own error reporting.  However, it would also be
7711c0
useful to trace such server messages, since we can't guarantee how the
7711c0
hint may be consumed.
7711c0
7711c0
Signed-off-by: Eric Blake <eblake@redhat.com>
7711c0
Message-Id: <20181218225714.284495-3-eblake@redhat.com>
7711c0
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
7711c0
(cherry picked from commit bee21ef0950c8b109d3bad05a3c3f2d94ec1a3af)
7711c0
Signed-off-by: John Snow <jsnow@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 nbd/client.c     | 2 ++
7711c0
 nbd/trace-events | 1 +
7711c0
 2 files changed, 3 insertions(+)
7711c0
7711c0
diff --git a/nbd/client.c b/nbd/client.c
7711c0
index b4d457a..0ad7147 100644
7711c0
--- a/nbd/client.c
7711c0
+++ b/nbd/client.c
7711c0
@@ -171,6 +171,8 @@ static int nbd_handle_reply_err(QIOChannel *ioc, NBDOptionReply *reply,
7711c0
             goto cleanup;
7711c0
         }
7711c0
         msg[reply->length] = '\0';
7711c0
+        trace_nbd_server_error_msg(reply->type,
7711c0
+                                   nbd_reply_type_lookup(reply->type), msg);
7711c0
     }
7711c0
 
7711c0
     switch (reply->type) {
7711c0
diff --git a/nbd/trace-events b/nbd/trace-events
7711c0
index 5e1d4af..5492042 100644
7711c0
--- a/nbd/trace-events
7711c0
+++ b/nbd/trace-events
7711c0
@@ -1,6 +1,7 @@
7711c0
 # nbd/client.c
7711c0
 nbd_send_option_request(uint32_t opt, const char *name, uint32_t len) "Sending option request %" PRIu32" (%s), len %" PRIu32
7711c0
 nbd_receive_option_reply(uint32_t option, const char *optname, uint32_t type, const char *typename, uint32_t length) "Received option reply %" PRIu32" (%s), type %" PRIu32" (%s), len %" PRIu32
7711c0
+nbd_server_error_msg(uint32_t err, const char *type, const char *msg) "server reported error 0x%" PRIx32 " (%s) with additional message: %s"
7711c0
 nbd_reply_err_unsup(uint32_t option, const char *name) "server doesn't understand request %" PRIu32 " (%s), attempting fallback"
7711c0
 nbd_opt_go_start(const char *name) "Attempting NBD_OPT_GO for export '%s'"
7711c0
 nbd_opt_go_success(void) "Export is good to go"
7711c0
-- 
7711c0
1.8.3.1
7711c0