Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.98
diff -u -p -r1.98 libvirt.c
--- src/libvirt.c	10 Sep 2007 09:37:10 -0000	1.98
+++ src/libvirt.c	12 Sep 2007 11:04:19 -0000
@@ -573,7 +573,7 @@ virConnectGetType(virConnectPtr conn)
     DEBUG("conn=%p", conn);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
 
@@ -603,7 +603,7 @@ virConnectGetVersion(virConnectPtr conn,
     DEBUG("conn=%p, hvVer=%p", conn, hvVer);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -637,7 +637,7 @@ virConnectGetHostname (virConnectPtr con
     DEBUG("conn=%p", conn);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return NULL;
     }
 
@@ -669,7 +669,7 @@ virConnectGetURI (virConnectPtr conn)
     DEBUG("conn=%p", conn);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return NULL;
     }
 
@@ -698,7 +698,7 @@ virConnectGetMaxVcpus(virConnectPtr conn
     DEBUG("conn=%p, type=%s", conn, type);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -725,7 +725,7 @@ virConnectListDomains(virConnectPtr conn
     DEBUG("conn=%p, ids=%p, maxids=%d", conn, ids, maxids);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -755,7 +755,7 @@ virConnectNumOfDomains(virConnectPtr con
     DEBUG("conn=%p", conn);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -786,7 +786,7 @@ virDomainGetConnect (virDomainPtr dom)
     DEBUG("dom=%p", dom);
 
     if (!VIR_IS_DOMAIN (dom)) {
-        virLibDomainError (dom, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return NULL;
     }
     return dom->conn;
@@ -811,7 +811,7 @@ virDomainCreateLinux(virConnectPtr conn,
     DEBUG("conn=%p, xmlDesc=%s, flags=%d", conn, xmlDesc, flags);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (xmlDesc == NULL) {
@@ -847,7 +847,7 @@ virDomainLookupByID(virConnectPtr conn, 
     DEBUG("conn=%p, id=%d", conn, id);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (id < 0) {
@@ -878,7 +878,7 @@ virDomainLookupByUUID(virConnectPtr conn
     DEBUG("conn=%p, uuid=%s", conn, uuid);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (uuid == NULL) {
@@ -913,7 +913,7 @@ virDomainLookupByUUIDString(virConnectPt
     DEBUG("conn=%p, uuidstr=%s", conn, uuidstr);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (uuidstr == NULL) {
@@ -961,7 +961,7 @@ virDomainLookupByName(virConnectPtr conn
     DEBUG("conn=%p, name=%s", conn, name);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (name == NULL) {
@@ -996,7 +996,7 @@ virDomainDestroy(virDomainPtr domain)
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
 
@@ -1028,7 +1028,7 @@ virDomainFree(virDomainPtr domain)
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (virFreeDomain(domain->conn, domain) < 0)
@@ -1055,7 +1055,7 @@ virDomainSuspend(virDomainPtr domain)
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -1089,7 +1089,7 @@ virDomainResume(virDomainPtr domain)
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -1126,7 +1126,7 @@ virDomainSave(virDomainPtr domain, const
     DEBUG("domain=%p, to=%s", domain, to);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -1182,7 +1182,7 @@ virDomainRestore(virConnectPtr conn, con
     DEBUG("conn=%p, from=%s", conn, from);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
     if (conn->flags & VIR_CONNECT_RO) {
@@ -1240,7 +1240,7 @@ virDomainCoreDump(virDomainPtr domain, c
     DEBUG("domain=%p, to=%s, flags=%d", domain, to, flags);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -1300,7 +1300,7 @@ virDomainShutdown(virDomainPtr domain)
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -1335,7 +1335,7 @@ virDomainReboot(virDomainPtr domain, uns
     DEBUG("domain=%p, flags=%u", domain, flags);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -1367,7 +1367,7 @@ virDomainGetName(virDomainPtr domain)
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (NULL);
     }
     return (domain->name);
@@ -1388,7 +1388,7 @@ virDomainGetUUID(virDomainPtr domain, un
     DEBUG("domain=%p, uuid=%p", domain, uuid);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (uuid == NULL) {
@@ -1421,7 +1421,7 @@ virDomainGetUUIDString(virDomainPtr doma
     DEBUG("domain=%p, buf=%p", domain, buf);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (buf == NULL) {
@@ -1450,7 +1450,7 @@ virDomainGetID(virDomainPtr domain)
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return ((unsigned int) -1);
     }
     return (domain->id);
@@ -1472,7 +1472,7 @@ virDomainGetOSType(virDomainPtr domain)
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (NULL);
     }
 
@@ -1502,7 +1502,7 @@ virDomainGetMaxMemory(virDomainPtr domai
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (0);
     }
 
@@ -1538,7 +1538,7 @@ virDomainSetMaxMemory(virDomainPtr domai
 	return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -1581,7 +1581,7 @@ virDomainSetMemory(virDomainPtr domain, 
 	return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -1620,7 +1620,7 @@ virDomainGetInfo(virDomainPtr domain, vi
     DEBUG("domain=%p, info=%p", domain, info);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (info == NULL) {
@@ -1657,7 +1657,7 @@ virDomainGetXMLDesc(virDomainPtr domain,
     DEBUG("domain=%p, flags=%d", domain, flags);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (NULL);
     }
     if (flags != 0) {
@@ -1739,7 +1739,7 @@ virDomainMigrate (virDomainPtr domain,
           domain, dconn, flags, dname, uri, bandwidth);
 
     if (!VIR_IS_DOMAIN (domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return NULL;
     }
     conn = domain->conn;        /* Source connection. */
@@ -1821,7 +1821,7 @@ __virDomainMigratePrepare (virConnectPtr
     DEBUG("dconn=%p, cookie=%p, cookielen=%p, uri_in=%s, uri_out=%p, flags=%lu, dname=%s, bandwidth=%lu", dconn, cookie, cookielen, uri_in, uri_out, flags, dname, bandwidth);
 
     if (!VIR_IS_CONNECT (dconn)) {
-        virLibConnError (dconn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return -1;
     }
 
@@ -1850,7 +1850,7 @@ __virDomainMigratePerform (virDomainPtr 
     DEBUG("domain=%p, cookie=%p, cookielen=%d, uri=%s, flags=%lu, dname=%s, bandwidth=%lu", domain, cookie, cookielen, uri, flags, dname, bandwidth);
 
     if (!VIR_IS_DOMAIN (domain)) {
-        virLibDomainError (domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return -1;
     }
     conn = domain->conn;
@@ -1878,7 +1878,7 @@ __virDomainMigrateFinish (virConnectPtr 
     DEBUG("dconn=%p, dname=%s, cookie=%p, cookielen=%d, uri=%s, flags=%lu", dconn, dname, cookie, cookielen, uri, flags);
 
     if (!VIR_IS_CONNECT (dconn)) {
-        virLibConnError (dconn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return NULL;
     }
 
@@ -1907,7 +1907,7 @@ virNodeGetInfo(virConnectPtr conn, virNo
     DEBUG("conn=%p, info=%p", conn, info);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
     if (info == NULL) {
@@ -1938,7 +1938,7 @@ virConnectGetCapabilities (virConnectPtr
     DEBUG("conn=%p", conn);
 
     if (!VIR_IS_CONNECT (conn)) {
-        virLibConnError (conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return NULL;
     }
 
@@ -1966,16 +1966,11 @@ virDomainGetSchedulerType(virDomainPtr d
     DEBUG("domain=%p, nparams=%p", domain, nparams);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return NULL;
     }
     conn = domain->conn;
 
-    if (!VIR_IS_CONNECT (conn)) {
-        virLibConnError (conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
-        return NULL;
-    }
-
     if (conn->driver->domainGetSchedulerType){
         schedtype = conn->driver->domainGetSchedulerType (domain, nparams);
         return schedtype;
@@ -2008,16 +2003,11 @@ virDomainGetSchedulerParameters(virDomai
     DEBUG("domain=%p, params=%p, nparams=%p", domain, params, nparams);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return -1;
     }
     conn = domain->conn;
 
-    if (!VIR_IS_CONNECT (conn)) {
-        virLibConnError (conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
-        return -1;
-    }
-
     if (conn->driver->domainGetSchedulerParameters)
         return conn->driver->domainGetSchedulerParameters (domain, params, nparams);
 
@@ -2045,16 +2035,11 @@ virDomainSetSchedulerParameters(virDomai
     DEBUG("domain=%p, params=%p, nparams=%d", domain, params, nparams);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return -1;
     }
     conn = domain->conn;
 
-    if (!VIR_IS_CONNECT (conn)) {
-        virLibConnError (conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
-        return -1;
-    }
-
     if (conn->driver->domainSetSchedulerParameters)
         return conn->driver->domainSetSchedulerParameters (domain, params, nparams);
 
@@ -2099,7 +2084,7 @@ virDomainBlockStats (virDomainPtr dom, c
         return -1;
     }
     if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
-        virLibDomainError (dom, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return -1;
     }
     conn = dom->conn;
@@ -2151,7 +2136,7 @@ virDomainInterfaceStats (virDomainPtr do
         return -1;
     }
     if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
-        virLibDomainError (dom, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return -1;
     }
     conn = dom->conn;
@@ -2191,7 +2176,7 @@ virDomainDefineXML(virConnectPtr conn, c
     DEBUG("conn=%p, xml=%s", conn, xml);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (conn->flags & VIR_CONNECT_RO) {
@@ -2224,7 +2209,7 @@ virDomainUndefine(virDomainPtr domain) {
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     conn = domain->conn;
@@ -2254,7 +2239,7 @@ virConnectNumOfDefinedDomains(virConnect
     DEBUG("conn=%p", conn);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -2281,7 +2266,7 @@ virConnectListDefinedDomains(virConnectP
     DEBUG("conn=%p, names=%p, maxnames=%d", conn, names, maxnames);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -2316,7 +2301,7 @@ virDomainCreate(virDomainPtr domain) {
 	return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     conn = domain->conn;
@@ -2351,7 +2336,7 @@ virDomainGetAutostart(virDomainPtr domai
     DEBUG("domain=%p, autostart=%p", domain, autostart);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (!autostart) {
@@ -2386,7 +2371,7 @@ virDomainSetAutostart(virDomainPtr domai
     DEBUG("domain=%p, autostart=%d", domain, autostart);
 
     if (!VIR_IS_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
 
@@ -2423,7 +2408,7 @@ virDomainSetVcpus(virDomainPtr domain, u
 	return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -2474,7 +2459,7 @@ virDomainPinVcpu(virDomainPtr domain, un
 	return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -2529,7 +2514,7 @@ virDomainGetVcpus(virDomainPtr domain, v
 	return (-1);
     }
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if ((info == NULL) || (maxinfo < 1)) {
@@ -2570,7 +2555,7 @@ virDomainGetMaxVcpus(virDomainPtr domain
     DEBUG("domain=%p", domain);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
 
@@ -2600,7 +2585,7 @@ virDomainAttachDevice(virDomainPtr domai
     DEBUG("domain=%p, xml=%s", domain, xml);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -2632,7 +2617,7 @@ virDomainDetachDevice(virDomainPtr domai
     DEBUG("domain=%p, xml=%s", domain, xml);
 
     if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
-        virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+        virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
         return (-1);
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
@@ -2668,7 +2653,7 @@ virNetworkGetConnect (virNetworkPtr net)
     DEBUG("net=%p", net);
 
     if (!VIR_IS_NETWORK (net)) {
-        virLibNetworkError (net, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError (NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return NULL;
     }
     return net->conn;
@@ -2688,7 +2673,7 @@ virConnectNumOfNetworks(virConnectPtr co
     DEBUG("conn=%p", conn);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -2715,7 +2700,7 @@ virConnectListNetworks(virConnectPtr con
     DEBUG("conn=%p, names=%p, maxnames=%d", conn, names, maxnames);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -2745,7 +2730,7 @@ virConnectNumOfDefinedNetworks(virConnec
     DEBUG("conn=%p", conn);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -2773,7 +2758,7 @@ virConnectListDefinedNetworks(virConnect
     DEBUG("conn=%p, names=%p, maxnames=%d", conn, names, maxnames);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (-1);
     }
 
@@ -2806,7 +2791,7 @@ virNetworkLookupByName(virConnectPtr con
     DEBUG("conn=%p, name=%s", conn, name);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (name == NULL) {
@@ -2837,7 +2822,7 @@ virNetworkLookupByUUID(virConnectPtr con
     DEBUG("conn=%p, uuid=%s", conn, uuid);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (uuid == NULL) {
@@ -2871,7 +2856,7 @@ virNetworkLookupByUUIDString(virConnectP
     DEBUG("conn=%p, uuidstr=%s", conn, uuidstr);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (uuidstr == NULL) {
@@ -2919,7 +2904,7 @@ virNetworkCreateXML(virConnectPtr conn, 
     DEBUG("conn=%p, xmlDesc=%s", conn, xmlDesc);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (xmlDesc == NULL) {
@@ -2953,7 +2938,7 @@ virNetworkDefineXML(virConnectPtr conn, 
     DEBUG("conn=%p, xml=%s", conn, xml);
 
     if (!VIR_IS_CONNECT(conn)) {
-        virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
         return (NULL);
     }
     if (conn->flags & VIR_CONNECT_RO) {
@@ -2986,7 +2971,7 @@ virNetworkUndefine(virNetworkPtr network
     DEBUG("network=%p", network);
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (-1);
     }
     conn = network->conn;
@@ -3022,7 +3007,7 @@ virNetworkCreate(virNetworkPtr network)
 	return (-1);
     }
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (-1);
     }
     conn = network->conn;
@@ -3057,7 +3042,7 @@ virNetworkDestroy(virNetworkPtr network)
     DEBUG("network=%p", network);
 
     if (!VIR_IS_CONNECTED_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (-1);
     }
 
@@ -3089,7 +3074,7 @@ virNetworkFree(virNetworkPtr network)
     DEBUG("network=%p", network);
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (-1);
     }
     if (virFreeNetwork(network->conn, network) < 0)
@@ -3112,7 +3097,7 @@ virNetworkGetName(virNetworkPtr network)
     DEBUG("network=%p", network);
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (NULL);
     }
     return (network->name);
@@ -3133,7 +3118,7 @@ virNetworkGetUUID(virNetworkPtr network,
     DEBUG("network=%p, uuid=%p", network, uuid);
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (-1);
     }
     if (uuid == NULL) {
@@ -3163,7 +3148,7 @@ virNetworkGetUUIDString(virNetworkPtr ne
     DEBUG("network=%p, buf=%p", network, buf);
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (-1);
     }
     if (buf == NULL) {
@@ -3196,7 +3181,7 @@ virNetworkGetXMLDesc(virNetworkPtr netwo
     DEBUG("network=%p, flags=%d", network, flags);
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (NULL);
     }
     if (flags != 0) {
@@ -3230,7 +3215,7 @@ virNetworkGetBridgeName(virNetworkPtr ne
     DEBUG("network=%p", network);
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (NULL);
     }
 
@@ -3262,7 +3247,7 @@ virNetworkGetAutostart(virNetworkPtr net
     DEBUG("network=%p, autostart=%p", network, autostart);
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (-1);
     }
     if (!autostart) {
@@ -3297,7 +3282,7 @@ virNetworkSetAutostart(virNetworkPtr net
     DEBUG("network=%p, autostart=%d", network, autostart);
 
     if (!VIR_IS_NETWORK(network)) {
-        virLibNetworkError(network, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+        virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
         return (-1);
     }
 
