[PATCH] Miscellaneous cleanups for virNodeGetFreeMemory and virNodeGetCellsFreeMemory

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

 



(1) Add documentation to the hvsupport page for virNodeGetFreeMemory

(2) Fix documentation on the hvsupport page to show that the two new functions aren't supported in the QEMU, KVM or remote cases yet.

(3) Add DEBUG() calls to both new functions.

(4) xen_internal.c functions may now support a connection argument to virXenError / virXenErrorFunc. I have modified this file so that where the connection is known, it is passed. Because of the way virterror works, errors should always be attached to a connection if at all possible, otherwise there is no sane way to turn non-connection errors into exceptions in language bindings, and also error handling in threaded code won't work.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
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. 03798903
Index: docs/libvir.html
===================================================================
RCS file: /data/cvs/libvirt/docs/libvir.html,v
retrieving revision 1.90
diff -u -r1.90 libvir.html
--- docs/libvir.html	7 Nov 2007 13:40:19 -0000	1.90
+++ docs/libvir.html	14 Nov 2007 11:15:32 -0000
@@ -3260,12 +3260,20 @@
   <td> &ge; 0.3.0 </td>
 </tr>
 <tr>
+  <td> virNodeGetFreeMemory </td>
+  <td> 0.3.3 </td>
+  <td> &ge; 0.3.3 </td>
+  <td> x </td>
+  <td> x </td>
+  <td> x </td>
+</tr>
+<tr>
   <td> virNodeGetCellsFreeMemory </td>
   <td> 0.3.3 </td>
   <td> &ge; 0.3.3 </td>
-  <td></td>
-  <td></td>
-  <td></td>
+  <td> x </td>
+  <td> x </td>
+  <td> x </td>
 </tr>
 </table>
 
Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.104
diff -u -r1.104 libvirt.c
--- src/libvirt.c	27 Oct 2007 01:23:28 -0000	1.104
+++ src/libvirt.c	14 Nov 2007 11:15:34 -0000
@@ -1964,6 +1964,8 @@
 unsigned long long
 virNodeGetFreeMemory(virConnectPtr conn)
 {
+    DEBUG("conn=%p", conn);
+
     if (!VIR_IS_CONNECT (conn)) {
         virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return 0;
@@ -2682,6 +2684,9 @@
 virNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems,
                           int startCell, int maxCells)
 {
+    DEBUG("conn=%p, freeMems=%p, startCell=%d, maxCells=%d",
+          conn, freeMems, startCell, maxCells);
+
     if (!VIR_IS_CONNECT(conn)) {
         virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
Index: src/xen_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xen_internal.c,v
retrieving revision 1.99
diff -u -r1.99 xen_internal.c
--- src/xen_internal.c	12 Nov 2007 14:00:32 -0000	1.99
+++ src/xen_internal.c	14 Nov 2007 11:15:36 -0000
@@ -720,6 +720,7 @@
 
 /**
  * virXenError:
+ * @conn: connection, if known
  * @error: the error number
  * @info: extra information string
  * @value: extra information number
@@ -727,7 +728,8 @@
  * Handle an error at the xend daemon interface
  */
 static void
-virXenError(virErrorNumber error, const char *info, int value)
+virXenError(virConnectPtr conn,
+            virErrorNumber error, const char *info, int value)
 {
     const char *errmsg;
 
@@ -735,7 +737,7 @@
         return;
 
     errmsg = __virErrorMsg(error, info);
-    __virRaiseError(NULL, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
+    __virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
                     errmsg, info, NULL, value, 0, errmsg, info, value);
 }
 
@@ -743,6 +745,7 @@
 
 /**
  * virXenErrorFunc:
+ * @conn: connection, if known
  * @error: the error number
  * @func: the function failing
  * @info: extra information string
@@ -751,7 +754,8 @@
  * Handle an error at the xend daemon interface
  */
 static void
-virXenErrorFunc(virErrorNumber error, const char *func, const char *info,
+virXenErrorFunc(virConnectPtr conn,
+                virErrorNumber error, const char *func, const char *info,
                 int value)
 {
     char fullinfo[1000];
@@ -765,11 +769,11 @@
     if (func != NULL) {
         snprintf(fullinfo, 999, "%s: %s", func, info);
 	fullinfo[999] = 0;
-	__virRaiseError(NULL, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
+	__virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
 			errmsg, fullinfo, NULL, value, 0, errmsg, fullinfo,
 			value);
     } else {
-	__virRaiseError(NULL, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
+	__virRaiseError(conn, NULL, NULL, VIR_FROM_XEN, error, VIR_ERR_ERROR,
 			errmsg, info, NULL, value, 0, errmsg, info,
 			value);
     }
@@ -823,17 +827,17 @@
     hc.arg[0] = (unsigned long) op;
 
     if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking", sizeof(*op));
+        virXenError(NULL, VIR_ERR_XEN_CALL, " locking", sizeof(*op));
         return (-1);
     }
 
     ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
     if (ret < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " ioctl ", xen_ioctl_hypercall_cmd);
+        virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl ", xen_ioctl_hypercall_cmd);
     }
 
     if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " releasing", sizeof(*op));
+        virXenError(NULL, VIR_ERR_XEN_CALL, " releasing", sizeof(*op));
         ret = -1;
     }
 
@@ -864,17 +868,17 @@
     hc.arg[0] = (unsigned long) op;
 
     if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking", sizeof(*op));
+        virXenError(NULL, VIR_ERR_XEN_CALL, " locking", sizeof(*op));
         return (-1);
     }
 
     ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
     if (ret < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " ioctl ", xen_ioctl_hypercall_cmd);
+        virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl ", xen_ioctl_hypercall_cmd);
     }
 
     if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " releasing", sizeof(*op));
+        virXenError(NULL, VIR_ERR_XEN_CALL, " releasing", sizeof(*op));
         ret = -1;
     }
 
@@ -906,17 +910,17 @@
     hc.arg[0] = (unsigned long) op;
 
     if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking", sizeof(*op));
+        virXenError(NULL, VIR_ERR_XEN_CALL, " locking", sizeof(*op));
         return (-1);
     }
 
     ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
     if (ret < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " sys ioctl ", xen_ioctl_hypercall_cmd);
+        virXenError(NULL, VIR_ERR_XEN_CALL, " sys ioctl ", xen_ioctl_hypercall_cmd);
     }
 
     if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " releasing", sizeof(*op));
+        virXenError(NULL, VIR_ERR_XEN_CALL, " releasing", sizeof(*op));
         ret = -1;
     }
 
@@ -948,17 +952,17 @@
     hc.arg[0] = (unsigned long) op;
 
     if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking", sizeof(*op));
+        virXenError(NULL, VIR_ERR_XEN_CALL, " locking", sizeof(*op));
         return (-1);
     }
 
     ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
     if (ret < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " ioctl ", xen_ioctl_hypercall_cmd);
+        virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl ", xen_ioctl_hypercall_cmd);
     }
 
     if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " releasing", sizeof(*op));
+        virXenError(NULL, VIR_ERR_XEN_CALL, " releasing", sizeof(*op));
         ret = -1;
     }
 
@@ -987,7 +991,7 @@
 
     if (lock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
               XEN_GETDOMAININFO_SIZE * maxids) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking",
+        virXenError(NULL, VIR_ERR_XEN_CALL, " locking",
                     XEN_GETDOMAININFO_SIZE * maxids);
         return (-1);
     }
@@ -1043,7 +1047,7 @@
     }
     if (unlock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
                 XEN_GETDOMAININFO_SIZE * maxids) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " release",
+        virXenError(NULL, VIR_ERR_XEN_CALL, " release",
                     XEN_GETDOMAININFO_SIZE * maxids);
         ret = -1;
     }
@@ -1082,14 +1086,14 @@
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL)) {
-        virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+        virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
 			"domain or conn is NULL", 0);
         return NULL;
     }
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->handle < 0 || domain->id < 0) {
-        virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+        virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
 			"priv->handle or domain->id invalid", 0);
         return NULL;
     }
@@ -1100,7 +1104,7 @@
      * TODO: check on Xen 3.0.3
      */
     if (dom_interface_version < 5) {
-        virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
+        virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
 		        "unsupported in dom interface < 5", 0);
         return NULL;
     }
@@ -1157,14 +1161,14 @@
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL)) {
-        virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+        virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
 			"domain or conn is NULL", 0);
         return -1;
     }
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->handle < 0 || domain->id < 0) {
-        virXenErrorFunc(VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+        virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
 			"priv->handle or domain->id invalid", 0);
         return -1;
     }
@@ -1175,7 +1179,7 @@
      * TODO: check on Xen 3.0.3
      */
     if (dom_interface_version < 5) {
-        virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
+        virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
 			"unsupported in dom interface < 5", 0);
         return -1;
     }
@@ -1221,7 +1225,7 @@
 		*nparams = 2;
 		break;
 	    default:
-		virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
+        virXenErrorFunc(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
 			"Unknown scheduler", op_sys.u.getschedulerid.sched_id);
 		return -1;
         }
@@ -1249,20 +1253,20 @@
     char buf[256];
 
     if ((domain == NULL) || (domain->conn == NULL)) {
-        virXenErrorFunc (VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+        virXenErrorFunc (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
 	                 "domain or conn is NULL", 0);
         return -1;
     }
 
     if ((nparams == 0) || (params == NULL)) {
-	virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
+        virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
 			 "Noparameters given", 0);
 	return(-1);
     }
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->handle < 0 || domain->id < 0) {
-        virXenErrorFunc (VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+        virXenErrorFunc (domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
 	                 "priv->handle or domain->id invalid", 0);
         return -1;
     }
@@ -1273,7 +1277,7 @@
      * TODO: check on Xen 3.0.3
      */
     if (dom_interface_version < 5) {
-        virXenErrorFunc(VIR_ERR_NO_XEN, __FUNCTION__,
+        virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
 			"unsupported in dom interface < 5", 0);
         return -1;
     }
@@ -1317,7 +1321,7 @@
 		    val = params[i].value.ui;
 		    if ((val < 1) || (val > USHRT_MAX)) {
                         snprintf(buf, sizeof(buf), _("Credit scheduler weight parameter (%d) is out of range (1-65535)"), val);
-                        virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
+                        virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
 			return(-1);
 		    }
                     op_dom.u.getschedinfo.u.credit.weight = val;
@@ -1327,14 +1331,14 @@
 		    val = params[i].value.ui;
 		    if (val > USHRT_MAX) {
                         snprintf(buf, sizeof(buf), _("Credit scheduler cap parameter (%d) is out of range (0-65535)"), val);
-		        virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
+                        virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
 			return(-1);
 		    }
                     op_dom.u.getschedinfo.u.credit.cap = val;
 		    cap_set = 1;
 	        } else {
-		    virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
-	     "Credit scheduler accepts 'cap' and 'weight' integer parameters",
+                    virXenErrorFunc (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
+                                     "Credit scheduler accepts 'cap' and 'weight' integer parameters",
 				     0);
 		    return(-1);
 		}
@@ -1346,7 +1350,7 @@
             break;
 	}
         default:
-            virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__,
+            virXenErrorFunc(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
                         "Unknown scheduler", op_sys.u.getschedulerid.sched_id);
             return -1;
         }
@@ -1406,7 +1410,7 @@
         STRNEQLEN (path, "xvd", 3) ||
         (minor = path[3] - 'a') < 0 ||
         minor > 26) {
-        virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
+        virXenErrorFunc (dom->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
                          "invalid path, should be xvda, xvdb, etc.", 0);
         return -1;
     }
@@ -1417,7 +1421,7 @@
     stats->errs =   read_bd_stat (device, dom->id, "oo");
 
     if (stats->rd_req == -1 && stats->wr_req == -1 && stats->errs == -1) {
-        virXenErrorFunc (VIR_ERR_NO_SUPPORT, __FUNCTION__,
+        virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
                          "Failed to read any block statistics", dom->id);
         return -1;
     }
@@ -1445,19 +1449,19 @@
     char line[256];
 
     if (sscanf (path, "vif%d.%d", &rqdomid, &device) != 2) {
-        virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
+        virXenErrorFunc (dom->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
                          "invalid path, should be vif<domid>.<n>.", 0);
         return -1;
     }
     if (rqdomid != dom->id) {
-        virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
+        virXenErrorFunc (dom->conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
                          "invalid path, vif<domid> should match this domain ID", 0);
         return -1;
     }
 
     fp = fopen ("/proc/net/dev", "r");
     if (!fp) {
-        virXenErrorFunc (VIR_ERR_NO_SUPPORT, __FUNCTION__,
+        virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
                          "/proc/net/dev", errno);
         return -1;
     }
@@ -1502,7 +1506,7 @@
     }
     fclose (fp);
 
-    virXenErrorFunc (VIR_ERR_NO_SUPPORT, __FUNCTION__,
+    virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
                      "/proc/net/dev: Interface not found", 0);
     return -1;
 }
@@ -1735,7 +1739,7 @@
         xen_op_v2_dom op;
 
         if (lock_pages(cpumap, maplen) < 0) {
-            virXenError(VIR_ERR_XEN_CALL, " locking", maplen);
+            virXenError(NULL, VIR_ERR_XEN_CALL, " locking", maplen);
             return (-1);
         }
         memset(&op, 0, sizeof(op));
@@ -1753,7 +1757,7 @@
         ret = xenHypervisorDoV2Dom(handle, &op);
 
         if (unlock_pages(cpumap, maplen) < 0) {
-            virXenError(VIR_ERR_XEN_CALL, " release", maplen);
+            virXenError(NULL, VIR_ERR_XEN_CALL, " release", maplen);
             ret = -1;
         }
     } else {
@@ -1850,7 +1854,7 @@
         }
         if ((cpumap != NULL) && (maplen > 0)) {
             if (lock_pages(cpumap, maplen) < 0) {
-                virXenError(VIR_ERR_XEN_CALL, " locking", maplen);
+                virXenError(NULL, VIR_ERR_XEN_CALL, " locking", maplen);
                 return (-1);
             }
             memset(cpumap, 0, maplen);
@@ -1868,7 +1872,7 @@
             }
             ret = xenHypervisorDoV2Dom(handle, &op);
             if (unlock_pages(cpumap, maplen) < 0) {
-                virXenError(VIR_ERR_XEN_CALL, " release", maplen);
+                virXenError(NULL, VIR_ERR_XEN_CALL, " release", maplen);
                 ret = -1;
             }
         }
@@ -1964,7 +1968,7 @@
         char error[100];
         regerror (errcode, &flags_hvm_rec, error, sizeof error);
         regfree (&flags_hvm_rec);
-        virXenError (VIR_ERR_INTERNAL_ERROR, error, 0);
+        virXenError (NULL, VIR_ERR_INTERNAL_ERROR, error, 0);
         in_init = 0;
         return -1;
     }
@@ -1974,7 +1978,7 @@
         regerror (errcode, &flags_pae_rec, error, sizeof error);
         regfree (&flags_pae_rec);
         regfree (&flags_hvm_rec);
-        virXenError (VIR_ERR_INTERNAL_ERROR, error, 0);
+        virXenError (NULL, VIR_ERR_INTERNAL_ERROR, error, 0);
         in_init = 0;
         return -1;
     }
@@ -1985,7 +1989,7 @@
         regfree (&xen_cap_rec);
         regfree (&flags_pae_rec);
         regfree (&flags_hvm_rec);
-        virXenError (VIR_ERR_INTERNAL_ERROR, error, 0);
+        virXenError (NULL, VIR_ERR_INTERNAL_ERROR, error, 0);
         in_init = 0;
         return -1;
     }
@@ -2043,7 +2047,7 @@
      */
 
     hypervisor_version = -1;
-    virXenError(VIR_ERR_XEN_CALL, " ioctl ", IOCTL_PRIVCMD_HYPERCALL);
+    virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl ", IOCTL_PRIVCMD_HYPERCALL);
     close(fd);
     in_init = 0;
     return(-1);
@@ -2122,7 +2126,7 @@
      */
 
     hypervisor_version = -1;
-    virXenError(VIR_ERR_XEN_CALL, " ioctl ", IOCTL_PRIVCMD_HYPERCALL);
+    virXenError(NULL, VIR_ERR_XEN_CALL, " ioctl ", IOCTL_PRIVCMD_HYPERCALL);
     close(fd);
     in_init = 0;
     if (ipt)
@@ -2163,7 +2167,7 @@
 
     ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR);
     if (ret < 0) {
-        virXenError(VIR_ERR_NO_XEN, XEN_HYPERVISOR_SOCKET, 0);
+        virXenError(conn, VIR_ERR_NO_XEN, XEN_HYPERVISOR_SOCKET, 0);
         return (-1);
     }
 
@@ -2217,7 +2221,7 @@
 xenHypervisorGetType(virConnectPtr conn)
 {
     if (!VIR_IS_CONNECT(conn)) {
-        virXenError(VIR_ERR_INVALID_CONN, __FUNCTION__, 0);
+        virXenError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__, 0);
         return (NULL);
     }
     return("Xen");
@@ -2256,7 +2260,7 @@
  * Return the capabilities of this hypervisor.
  */
 char *
-xenHypervisorMakeCapabilitiesXML(virConnectPtr conn ATTRIBUTE_UNUSED,
+xenHypervisorMakeCapabilitiesXML(virConnectPtr conn,
                                  const char *hostmachine,
                                  FILE *cpuinfo, FILE *capabilities)
 {
@@ -2402,7 +2406,7 @@
     /* Construct the final XML. */
     xml = virBufferNew (1024);
     if (!xml) {
-        virXenError(VIR_ERR_NO_MEMORY, __FUNCTION__, 0);
+        virXenError(conn, VIR_ERR_NO_MEMORY, __FUNCTION__, 0);
         return NULL;
     }
     r = virBufferVSprintf (xml,
@@ -2519,7 +2523,7 @@
     return xml_str;
 
  vir_buffer_failed:
-    virXenError(VIR_ERR_NO_MEMORY, __FUNCTION__, 0);
+    virXenError(conn, VIR_ERR_NO_MEMORY, __FUNCTION__, 0);
  topology_failed:
     virBufferFree (xml);
     return NULL;
@@ -2593,7 +2597,7 @@
 
  retry:
     if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
-        virXenError(VIR_ERR_NO_MEMORY, _("allocating %d domain info"),
+        virXenError(conn, VIR_ERR_NO_MEMORY, _("allocating %d domain info"),
                     maxids);
         return(-1);
     }
@@ -2652,7 +2656,7 @@
         return (-1);
 
     if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
-        virXenError(VIR_ERR_NO_MEMORY, "allocating %d domain info",
+        virXenError(conn, VIR_ERR_NO_MEMORY, "allocating %d domain info",
                     maxids);
         return(-1);
     }
@@ -2760,7 +2764,7 @@
 
  retry:
     if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
-        virXenError(VIR_ERR_NO_MEMORY, "allocating %d domain info",
+        virXenError(conn, VIR_ERR_NO_MEMORY, "allocating %d domain info",
                     maxids);
         return(NULL);
     }
@@ -3036,20 +3040,20 @@
     int nbNodeCells;
     
     if (conn == NULL) {
-        virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
+        virXenErrorFunc (conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
                         "invalid argument", 0);
         return -1;
     }
 
     nbNodeCells = xenNbCells(conn);
     if (nbNodeCells < 0) {
-	virXenErrorFunc (VIR_ERR_XEN_CALL, __FUNCTION__,
+        virXenErrorFunc (conn, VIR_ERR_XEN_CALL, __FUNCTION__,
 			 "cannot determine actual number of cells",0);
 	return(-1);
     }
 
     if ((maxCells < 1) || (startCell >= nbNodeCells)) {
-        virXenErrorFunc (VIR_ERR_INVALID_ARG, __FUNCTION__,
+        virXenErrorFunc (conn, VIR_ERR_INVALID_ARG, __FUNCTION__,
                         "invalid argument", 0);
         return -1;
     }
@@ -3058,14 +3062,14 @@
      * Support only sys_interface_version >=4
      */
     if (sys_interface_version < 4) {
-        virXenErrorFunc (VIR_ERR_XEN_CALL, __FUNCTION__,
+        virXenErrorFunc (conn, VIR_ERR_XEN_CALL, __FUNCTION__,
                         "unsupported in sys interface < 4", 0);
         return -1;
     }
 
     priv = (xenUnifiedPrivatePtr) conn->privateData;
     if (priv->handle < 0) {
-        virXenErrorFunc (VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+        virXenErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
                         "priv->handle invalid", 0);
         return -1;
     }

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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]