[libvirt] [PATCH 16/16] Improve error message when XDR marshalling fails

Daniel P. Berrange berrange at redhat.com
Wed May 11 09:10:02 UTC 2011


When failing to marshall an XDR message, include the
full program/version/status/proc/type info, to allow
easier debugging & diagnosis of the problem.

* src/remote/remote_driver.c: Improve error when marshalling
  fails
---
 src/remote/remote_driver.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e113e39..9afa180 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5365,7 +5365,9 @@ prepareCall(struct private_data *priv,
     }
 
     if (!(*args_filter) (&xdr, args)) {
-        remoteError(VIR_ERR_RPC, "%s", _("marshalling args"));
+        remoteError(VIR_ERR_RPC,
+                    _("Unable to marshall arguments for program %d version %d procedure %d type %d status %d"),
+                    hdr.prog, hdr.vers, hdr.proc, hdr.type, hdr.status);
         goto error;
     }
 
@@ -5821,7 +5823,9 @@ processCallDispatchReply(virConnectPtr conn ATTRIBUTE_UNUSED,
     switch (hdr->status) {
     case REMOTE_OK:
         if (!(*thecall->ret_filter) (xdr, thecall->ret)) {
-            remoteError(VIR_ERR_RPC, "%s", _("unmarshalling ret"));
+            remoteError(VIR_ERR_RPC,
+                        _("Unable to marshall reply for program %d version %d procedure %d type %d status %d"),
+                        hdr->prog, hdr->vers, hdr->proc, hdr->type, hdr->status);
             return -1;
         }
         thecall->mode = REMOTE_MODE_COMPLETE;
@@ -5830,7 +5834,9 @@ processCallDispatchReply(virConnectPtr conn ATTRIBUTE_UNUSED,
     case REMOTE_ERROR:
         memset (&thecall->err, 0, sizeof thecall->err);
         if (!xdr_remote_error (xdr, &thecall->err)) {
-            remoteError(VIR_ERR_RPC, "%s", _("unmarshalling remote_error"));
+            remoteError(VIR_ERR_RPC,
+                        _("Unable to marshall error for program %d version %d procedure %d type %d status %d"),
+                        hdr->prog, hdr->vers, hdr->proc, hdr->type, hdr->status);
             return -1;
         }
         thecall->mode = REMOTE_MODE_ERROR;
-- 
1.7.4.4




More information about the libvir-list mailing list