[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libvir] [PATCH] Remote 0/8: Plan



Richard W.M. Jones wrote:
1 Additional error handling
---------------------------

M include/libvirt/virterror.h
M src/virterror.c

Attached is the patch to add the additional types of errors to virterror. VIR_FROM_REMOTE indicates that the error originated in the remote driver. There are two further subclasses for general RPC-related errors and GnuTLS-related errors.

Note that if a regular error (eg. VIR_FROM_XEN) is generated on the server side it is passed through the connection to the client transparently (there is no "wrapping" of errors or anything like that).

Rich.

--
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421

Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.
Registered in England and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA) and David
Owens (Ireland)
Index: include/libvirt/virterror.h
===================================================================
RCS file: /data/cvs/libvirt/include/libvirt/virterror.h,v
retrieving revision 1.22
diff -u -r1.22 virterror.h
--- include/libvirt/virterror.h	18 Apr 2007 10:14:07 -0000	1.22
+++ include/libvirt/virterror.h	2 May 2007 17:55:56 -0000
@@ -50,6 +50,7 @@
     VIR_FROM_QEMU,      /* Error at the QEMU daemon */
     VIR_FROM_NET,       /* Error when operating on a network */
     VIR_FROM_TEST,	/* Error from test driver */
+    VIR_FROM_REMOTE,	/* Error from remote driver */
 } virErrorDomain;
 
 
@@ -121,6 +122,8 @@
     VIR_ERR_INVALID_NETWORK, /* invalid network object */
     VIR_ERR_NETWORK_EXIST, /* the network already exist */
     VIR_ERR_SYSTEM_ERROR, /* general system call failure */
+    VIR_ERR_RPC, /* some sort of RPC error */
+    VIR_ERR_GNUTLS_ERROR, /* error from a GNUTLS call */
 } virErrorNumber;
 
 /**
Index: src/virterror.c
===================================================================
RCS file: /data/cvs/libvirt/src/virterror.c,v
retrieving revision 1.24
diff -u -r1.24 virterror.c
--- src/virterror.c	18 Apr 2007 10:14:08 -0000	1.24
+++ src/virterror.c	2 May 2007 17:55:56 -0000
@@ -277,6 +277,9 @@
         case VIR_FROM_TEST:
             dom = "Test ";
             break;
+        case VIR_FROM_REMOTE:
+            dom = "Remote ";
+            break;
     }
     if ((err->dom != NULL) && (err->code != VIR_ERR_INVALID_DOMAIN)) {
         domain = err->dom->name;
@@ -613,6 +616,18 @@
         else
             errmsg = "%s";
         break;
+    case VIR_ERR_RPC:
+        if (info == NULL)
+            errmsg = _("RPC error");
+        else
+            errmsg = "%s";
+        break;
+    case VIR_ERR_GNUTLS_ERROR:
+        if (info == NULL)
+            errmsg = _("GNUTLS call error");
+        else
+            errmsg = "%s";
+        break;
     }
     return (errmsg);
 }

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]