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

[libvirt] [PATCH 12/23] Replace use of custom macros with virReportError in the Xen drivers



From: "Daniel P. Berrange" <berrange redhat com>

Update the legacy Xen drivers to use virReportError instead of
the statsError, virXenInotifyError, virXenStoreError,
virXendError, xenUnifiedError, xenXMError custom macros

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 cfg.mk                   |    6 -
 src/xen/block_stats.c    |   54 +++---
 src/xen/xen_driver.c     |  114 ++++++------
 src/xen/xen_hypervisor.c |  211 +++++++++++----------
 src/xen/xen_inotify.c    |   48 +++--
 src/xen/xend_internal.c  |  461 +++++++++++++++++++++++-----------------------
 src/xen/xm_internal.c    |  134 +++++++-------
 src/xen/xs_internal.c    |   40 ++--
 8 files changed, 514 insertions(+), 554 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 3de6a66..d813f34 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -516,7 +516,6 @@ msg_gen_function += lxcError
 msg_gen_function += nodeReportError
 msg_gen_function += qemuReportError
 msg_gen_function += regerror
-msg_gen_function += statsError
 msg_gen_function += streamsReportError
 msg_gen_function += vah_error
 msg_gen_function += vah_warning
@@ -537,12 +536,7 @@ msg_gen_function += virReportError
 msg_gen_function += virReportErrorHelper
 msg_gen_function += virReportSystemError
 msg_gen_function += virSecurityReportError
-msg_gen_function += virXenInotifyError
-msg_gen_function += virXenStoreError
-msg_gen_function += virXendError
 msg_gen_function += xenapiSessionErrorHandler
-msg_gen_function += xenUnifiedError
-msg_gen_function += xenXMError
 
 # Uncomment the following and run "make syntax-check" to see diagnostics
 # that are not yet marked for translation, but that need to be rewritten
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
index 50ace86..3d77720 100644
--- a/src/xen/block_stats.c
+++ b/src/xen/block_stats.c
@@ -32,12 +32,6 @@
 # define VIR_FROM_THIS VIR_FROM_STATS_LINUX
 
 
-
-# define statsError(code, ...)                                                 \
-    virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, __FUNCTION__,         \
-                         __LINE__, __VA_ARGS__)
-
-
 /*-------------------- Xen: block stats --------------------*/
 
 # include <linux/major.h>
@@ -172,9 +166,9 @@ read_bd_stats(xenUnifiedPrivatePtr priv,
     if (stats->rd_req == -1 && stats->rd_bytes == -1 &&
         stats->wr_req == -1 && stats->wr_bytes == -1 &&
         stats->errs == -1) {
-        statsError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to read any block statistics for domain %d"),
-                   domid);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to read any block statistics for domain %d"),
+                       domid);
         return -1;
     }
 
@@ -186,9 +180,9 @@ read_bd_stats(xenUnifiedPrivatePtr priv,
         stats->wr_req == 0 && stats->wr_bytes == 0 &&
         stats->errs == 0 &&
         !check_bd_connected (priv, device, domid)) {
-        statsError(VIR_ERR_INTERNAL_ERROR,
-                   _("Frontend block device not connected for domain %d"),
-                   domid);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Frontend block device not connected for domain %d"),
+                       domid);
         return -1;
     }
 
@@ -197,18 +191,18 @@ read_bd_stats(xenUnifiedPrivatePtr priv,
      */
     if (stats->rd_bytes > 0) {
         if (stats->rd_bytes >= ((unsigned long long)1)<<(63-9)) {
-            statsError(VIR_ERR_INTERNAL_ERROR,
-                       _("stats->rd_bytes would overflow 64 bit counter for domain %d"),
-                       domid);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("stats->rd_bytes would overflow 64 bit counter for domain %d"),
+                           domid);
             return -1;
         }
         stats->rd_bytes *= 512;
     }
     if (stats->wr_bytes > 0) {
         if (stats->wr_bytes >= ((unsigned long long)1)<<(63-9)) {
-            statsError(VIR_ERR_INTERNAL_ERROR,
-                       _("stats->wr_bytes would overflow 64 bit counter for domain %d"),
-                       domid);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("stats->wr_bytes would overflow 64 bit counter for domain %d"),
+                           domid);
             return -1;
         }
         stats->wr_bytes *= 512;
@@ -326,21 +320,21 @@ xenLinuxDomainDeviceID(int domid, const char *path)
      * beginning of the strings for better error messages
      */
     else if (strlen(mod_path) >= 7 && STRPREFIX(mod_path, "/dev/sd"))
-        statsError(VIR_ERR_INVALID_ARG,
-                   _("invalid path, device names must be in the range "
-                     "sda[1-15] - sdiv[1-15] for domain %d"), domid);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("invalid path, device names must be in the range "
+                         "sda[1-15] - sdiv[1-15] for domain %d"), domid);
     else if (strlen(mod_path) >= 7 && STRPREFIX(mod_path, "/dev/hd"))
-        statsError(VIR_ERR_INVALID_ARG,
-                   _("invalid path, device names must be in the range "
-                     "hda[1-63] - hdt[1-63] for domain %d"), domid);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("invalid path, device names must be in the range "
+                         "hda[1-63] - hdt[1-63] for domain %d"), domid);
     else if (strlen(mod_path) >= 8 && STRPREFIX(mod_path, "/dev/xvd"))
-        statsError(VIR_ERR_INVALID_ARG,
-                   _("invalid path, device names must be in the range "
-                     "xvda[1-15] - xvdiz[1-15] for domain %d"), domid);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("invalid path, device names must be in the range "
+                         "xvda[1-15] - xvdiz[1-15] for domain %d"), domid);
     else
-        statsError(VIR_ERR_INVALID_ARG,
-                   _("unsupported path, use xvdN, hdN, or sdN for domain %d"),
-                   domid);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("unsupported path, use xvdN, hdN, or sdN for domain %d"),
+                       domid);
 
     VIR_FREE(mod_path);
 
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 9ff3d29..cbde673 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -80,10 +80,6 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = {
 static int inside_daemon;
 #endif
 
-#define xenUnifiedError(code, ...)                                         \
-        virReportErrorHelper(VIR_FROM_XEN, code, __FILE__,                 \
-                             __FUNCTION__, __LINE__, __VA_ARGS__)
-
 /**
  * xenNumaInit:
  * @conn: pointer to the hypervisor connection
@@ -284,9 +280,9 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
             if (conn->uri->path &&
                 STRNEQ(conn->uri->path, "") &&
                 STRNEQ(conn->uri->path, "/")) {
-                xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
-                                _("unexpected Xen URI path '%s', try xen:///"),
-                                conn->uri->path);
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("unexpected Xen URI path '%s', try xen:///"),
+                               conn->uri->path);
                 return VIR_DRV_OPEN_ERROR;
             }
 
@@ -316,8 +312,8 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags)
         return VIR_DRV_OPEN_ERROR;
     }
     if (virMutexInit(&priv->lock) < 0) {
-        xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("cannot initialize mutex"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("cannot initialize mutex"));
         VIR_FREE(priv);
         return VIR_DRV_OPEN_ERROR;
     }
@@ -515,14 +511,14 @@ xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
     GET_PRIVATE(conn);
 
     if (type && STRCASENEQ (type, "Xen")) {
-        xenUnifiedError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
         return xenHypervisorGetMaxVcpus (conn, type);
     else {
-        xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+        virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
         return -1;
     }
 }
@@ -646,7 +642,7 @@ xenUnifiedDomainLookupByID (virConnectPtr conn, int id)
     }
 
     /* Not found. */
-    xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
+    virReportError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
     return NULL;
 }
 
@@ -684,7 +680,7 @@ xenUnifiedDomainLookupByUUID (virConnectPtr conn,
     }
 
     /* Not found. */
-    xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
+    virReportError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
     return NULL;
 }
 
@@ -722,7 +718,7 @@ xenUnifiedDomainLookupByName (virConnectPtr conn,
     }
 
     /* Not found. */
-    xenUnifiedError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
+    virReportError(VIR_ERR_NO_DOMAIN, __FUNCTION__);
     return NULL;
 }
 
@@ -1051,8 +1047,8 @@ xenUnifiedDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
 
     virCheckFlags(0, -1);
     if (dxml) {
-        xenUnifiedError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
-                        _("xml modification unsupported"));
+        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+                       _("xml modification unsupported"));
         return -1;
     }
 
@@ -1075,8 +1071,8 @@ xenUnifiedDomainRestoreFlags(virConnectPtr conn, const char *from,
 
     virCheckFlags(0, -1);
     if (dxml) {
-        xenUnifiedError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
-                        _("xml modification unsupported"));
+        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+                       _("xml modification unsupported"));
         return -1;
     }
 
@@ -1117,13 +1113,13 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
     if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
         (flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
          (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
-        xenUnifiedError(VIR_ERR_INVALID_ARG,
-                        _("invalid flag combination: (0x%x)"), flags);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("invalid flag combination: (0x%x)"), flags);
         return -1;
     }
     if (!nvcpus || (unsigned short) nvcpus != nvcpus) {
-        xenUnifiedError(VIR_ERR_INVALID_ARG,
-                        _("argument out of range: %d"), nvcpus);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("argument out of range: %d"), nvcpus);
         return -1;
     }
 
@@ -1143,7 +1139,7 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
     if (flags == VIR_DOMAIN_VCPU_LIVE)
         return xenHypervisorSetVcpus(dom, nvcpus);
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1220,7 +1216,7 @@ xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
     if (flags == (VIR_DOMAIN_VCPU_CONFIG | VIR_DOMAIN_VCPU_MAXIMUM))
         return xenHypervisorGetVcpuMax(dom);
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1251,7 +1247,7 @@ xenUnifiedDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
         }
     }
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return NULL;
 }
 
@@ -1274,8 +1270,8 @@ xenUnifiedDomainXMLFromNative(virConnectPtr conn,
 
     if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) &&
         STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
-        xenUnifiedError(VIR_ERR_INVALID_ARG,
-                        _("unsupported config type %s"), format);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("unsupported config type %s"), format);
         return NULL;
     }
 
@@ -1323,8 +1319,8 @@ xenUnifiedDomainXMLToNative(virConnectPtr conn,
 
     if (STRNEQ(format, XEN_CONFIG_FORMAT_XM) &&
         STRNEQ(format, XEN_CONFIG_FORMAT_SEXPR)) {
-        xenUnifiedError(VIR_ERR_INVALID_ARG,
-                        _("unsupported config type %s"), format);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("unsupported config type %s"), format);
         goto cleanup;
     }
 
@@ -1378,7 +1374,7 @@ xenUnifiedDomainMigratePrepare (virConnectPtr dconn,
                                               uri_in, uri_out,
                                               flags, dname, resource);
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1399,7 +1395,7 @@ xenUnifiedDomainMigratePerform (virDomainPtr dom,
         return xenDaemonDomainMigratePerform (dom, cookie, cookielen, uri,
                                               flags, dname, resource);
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1425,15 +1421,15 @@ xenUnifiedDomainMigrateFinish (virConnectPtr dconn,
     if (flags & VIR_MIGRATE_PERSIST_DEST) {
         domain_xml = xenDaemonDomainGetXMLDesc(dom, 0, NULL);
         if (! domain_xml) {
-            xenUnifiedError(VIR_ERR_MIGRATE_PERSIST_FAILED,
-                            "%s", _("failed to get XML representation of migrated domain"));
+            virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED,
+                           "%s", _("failed to get XML representation of migrated domain"));
             goto failure;
         }
 
         dom_new = xenDaemonDomainDefineXML (dconn, domain_xml);
         if (! dom_new) {
-            xenUnifiedError(VIR_ERR_MIGRATE_PERSIST_FAILED,
-                            "%s", _("failed to define domain on destination host"));
+            virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED,
+                           "%s", _("failed to define domain on destination host"));
             goto failure;
         }
 
@@ -1647,7 +1643,7 @@ xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart)
             return xenDaemonDomainGetAutostart(dom, autostart);
     }
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1664,7 +1660,7 @@ xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart)
             return xenDaemonDomainSetAutostart(dom, autostart);
     }
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1756,7 +1752,7 @@ xenUnifiedDomainBlockStats (virDomainPtr dom, const char *path,
     if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
         return xenHypervisorDomainBlockStats (dom, path, stats);
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1769,7 +1765,7 @@ xenUnifiedDomainInterfaceStats (virDomainPtr dom, const char *path,
     if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
         return xenHypervisorDomainInterfaceStats (dom, path, stats);
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1794,7 +1790,7 @@ xenUnifiedDomainBlockPeek (virDomainPtr dom, const char *path,
             return 0;
     }
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1808,7 +1804,7 @@ xenUnifiedNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMe
         return xenHypervisorNodeGetCellsFreeMemory (conn, freeMems,
                                                     startCell, maxCells);
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
 }
 
@@ -1827,7 +1823,7 @@ xenUnifiedNodeGetFreeMemory (virConnectPtr conn)
         return freeMem;
     }
 
-    xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+    virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return 0;
 }
 
@@ -1844,7 +1840,7 @@ xenUnifiedDomainEventRegister(virConnectPtr conn,
     xenUnifiedLock(priv);
 
     if (priv->xsWatch == -1) {
-        xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+        virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
         xenUnifiedUnlock(priv);
         return -1;
     }
@@ -1866,7 +1862,7 @@ xenUnifiedDomainEventDeregister(virConnectPtr conn,
     xenUnifiedLock(priv);
 
     if (priv->xsWatch == -1) {
-        xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+        virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
         xenUnifiedUnlock(priv);
         return -1;
     }
@@ -1894,7 +1890,7 @@ xenUnifiedDomainEventRegisterAny(virConnectPtr conn,
     xenUnifiedLock(priv);
 
     if (priv->xsWatch == -1) {
-        xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+        virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
         xenUnifiedUnlock(priv);
         return -1;
     }
@@ -1917,7 +1913,7 @@ xenUnifiedDomainEventDeregisterAny(virConnectPtr conn,
     xenUnifiedLock(priv);
 
     if (priv->xsWatch == -1) {
-        xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+        virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
         xenUnifiedUnlock(priv);
         return -1;
     }
@@ -1965,8 +1961,8 @@ xenUnifiedNodeDeviceGetPciInfo (virNodeDevicePtr dev,
     }
 
     if (!cap) {
-        xenUnifiedError(VIR_ERR_INVALID_ARG,
-                        _("device %s is not a PCI device"), dev->name);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("device %s is not a PCI device"), dev->name);
         goto out;
     }
 
@@ -2075,9 +2071,9 @@ xenUnifiedNodeDeviceReAttach (virNodeDevicePtr dev)
 
     /* Check if device is assigned to an active guest */
     if ((domid = xenUnifiedNodeDeviceAssignedDomainId(dev)) >= 0) {
-        xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
-                        _("Device %s has been assigned to guest %d"),
-                        dev->name, domid);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Device %s has been assigned to guest %d"),
+                       dev->name, domid);
         goto out;
     }
 
@@ -2127,15 +2123,15 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom,
     virCheckFlags(0, -1);
 
     if (dom->id == -1) {
-        xenUnifiedError(VIR_ERR_OPERATION_INVALID,
-                        "%s", _("domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("domain is not running"));
         goto cleanup;
     }
 
     if (dev_name) {
         /* XXX support device aliases in future */
-        xenUnifiedError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                        _("Named device aliases are not supported"));
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Named device aliases are not supported"));
         goto cleanup;
     }
 
@@ -2149,14 +2145,14 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom,
         chr = def->serials[0];
 
     if (!chr) {
-        xenUnifiedError(VIR_ERR_INTERNAL_ERROR, "%s",
-                        _("cannot find default console device"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("cannot find default console device"));
         goto cleanup;
     }
 
     if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
-        xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
-                        _("character device %s is not using a PTY"), dev_name);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("character device %s is not using a PTY"), dev_name);
         goto cleanup;
     }
 
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index b4ec579..21ea07d 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -874,11 +874,6 @@ struct xenUnifiedDriver xenHypervisorDriver = {
     .xenDomainSetSchedulerParameters = xenHypervisorSetSchedulerParameters,
 };
 
-#define virXenError(code, ...)                                             \
-        if (in_init == 0)                                                  \
-            virReportErrorHelper(VIR_FROM_XEN, code, __FILE__,             \
-                                 __FUNCTION__, __LINE__, __VA_ARGS__)
-
 /**
  * xenHypervisorDoV0Op:
  * @handle: the handle to the Xen hypervisor
@@ -901,18 +896,18 @@ xenHypervisorDoV0Op(int handle, xen_op_v0 * op)
     hc.arg[0] = (unsigned long) op;
 
     if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking");
+        virReportError(VIR_ERR_XEN_CALL, " locking");
         return -1;
     }
 
     ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
     if (ret < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
-                    xen_ioctl_hypercall_cmd);
+        virReportError(VIR_ERR_XEN_CALL, " ioctl %d",
+                       xen_ioctl_hypercall_cmd);
     }
 
     if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " releasing");
+        virReportError(VIR_ERR_XEN_CALL, " releasing");
         ret = -1;
     }
 
@@ -943,18 +938,18 @@ xenHypervisorDoV1Op(int handle, xen_op_v1* op)
     hc.arg[0] = (unsigned long) op;
 
     if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking");
+        virReportError(VIR_ERR_XEN_CALL, " locking");
         return -1;
     }
 
     ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
     if (ret < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
-                    xen_ioctl_hypercall_cmd);
+        virReportError(VIR_ERR_XEN_CALL, " ioctl %d",
+                       xen_ioctl_hypercall_cmd);
     }
 
     if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " releasing");
+        virReportError(VIR_ERR_XEN_CALL, " releasing");
         ret = -1;
     }
 
@@ -986,18 +981,18 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op)
     hc.arg[0] = (unsigned long) op;
 
     if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking");
+        virReportError(VIR_ERR_XEN_CALL, " locking");
         return -1;
     }
 
     ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
     if (ret < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " sys ioctl %d",
-                                            xen_ioctl_hypercall_cmd);
+        virReportError(VIR_ERR_XEN_CALL, " sys ioctl %d",
+                       xen_ioctl_hypercall_cmd);
     }
 
     if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " releasing");
+        virReportError(VIR_ERR_XEN_CALL, " releasing");
         ret = -1;
     }
 
@@ -1029,18 +1024,18 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op)
     hc.arg[0] = (unsigned long) op;
 
     if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking");
+        virReportError(VIR_ERR_XEN_CALL, " locking");
         return -1;
     }
 
     ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
     if (ret < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " ioctl %d",
-                    xen_ioctl_hypercall_cmd);
+        virReportError(VIR_ERR_XEN_CALL, " ioctl %d",
+                       xen_ioctl_hypercall_cmd);
     }
 
     if (unlock_pages(op, sizeof(dom0_op_t)) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " releasing");
+        virReportError(VIR_ERR_XEN_CALL, " releasing");
         ret = -1;
     }
 
@@ -1069,7 +1064,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
 
     if (lock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
               XEN_GETDOMAININFO_SIZE * maxids) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " locking");
+        virReportError(VIR_ERR_XEN_CALL, " locking");
         return -1;
     }
     if (hv_versions.hypervisor > 1) {
@@ -1124,7 +1119,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
     }
     if (unlock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
                 XEN_GETDOMAININFO_SIZE * maxids) < 0) {
-        virXenError(VIR_ERR_XEN_CALL, " release");
+        virReportError(VIR_ERR_XEN_CALL, " release");
         ret = -1;
     }
     return ret;
@@ -1161,20 +1156,20 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
     xenUnifiedPrivatePtr priv;
 
     if (domain->conn == NULL) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("domain or conn is NULL"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("domain or conn is NULL"));
         return NULL;
     }
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->handle < 0) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("priv->handle invalid"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("priv->handle invalid"));
         return NULL;
     }
     if (domain->id < 0) {
-        virXenError(VIR_ERR_OPERATION_INVALID,
-                    "%s", _("domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("domain is not running"));
         return NULL;
     }
 
@@ -1184,8 +1179,8 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
      * TODO: check on Xen 3.0.3
      */
     if (hv_versions.dom_interface < 5) {
-        virXenError(VIR_ERR_NO_XEN, "%s",
-                    _("unsupported in dom interface < 5"));
+        virReportError(VIR_ERR_NO_XEN, "%s",
+                       _("unsupported in dom interface < 5"));
         return NULL;
     }
 
@@ -1242,20 +1237,20 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
     xenUnifiedPrivatePtr priv;
 
     if (domain->conn == NULL) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("domain or conn is NULL"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("domain or conn is NULL"));
         return -1;
     }
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->handle < 0) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("priv->handle invalid"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("priv->handle invalid"));
         return -1;
     }
     if (domain->id < 0) {
-        virXenError(VIR_ERR_OPERATION_INVALID,
-                    "%s", _("domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("domain is not running"));
         return -1;
     }
 
@@ -1265,8 +1260,8 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
      * TODO: check on Xen 3.0.3
      */
     if (hv_versions.dom_interface < 5) {
-        virXenError(VIR_ERR_NO_XEN, "%s",
-                    _("unsupported in dom interface < 5"));
+        virReportError(VIR_ERR_NO_XEN, "%s",
+                       _("unsupported in dom interface < 5"));
         return -1;
     }
 
@@ -1284,8 +1279,8 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
         switch (op_sys.u.getschedulerid.sched_id){
             case XEN_SCHEDULER_SEDF:
                 if (*nparams < XEN_SCHED_SEDF_NPARAM) {
-                    virXenError(VIR_ERR_INVALID_ARG,
-                                "%s", _("Invalid parameter count"));
+                    virReportError(VIR_ERR_INVALID_ARG,
+                                   "%s", _("Invalid parameter count"));
                     return -1;
                 }
 
@@ -1319,9 +1314,9 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
                     *nparams = XEN_SCHED_CRED_NPARAM;
                 break;
             default:
-                virXenError(VIR_ERR_INVALID_ARG,
-                            _("Unknown scheduler %d"),
-                            op_sys.u.getschedulerid.sched_id);
+                virReportError(VIR_ERR_INVALID_ARG,
+                               _("Unknown scheduler %d"),
+                               op_sys.u.getschedulerid.sched_id);
                 return -1;
         }
     }
@@ -1348,8 +1343,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
     char buf[256];
 
     if (domain->conn == NULL) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("domain or conn is NULL"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("domain or conn is NULL"));
         return -1;
     }
 
@@ -1368,13 +1363,13 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
 
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->handle < 0) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("priv->handle invalid"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("priv->handle invalid"));
         return -1;
     }
     if (domain->id < 0) {
-        virXenError(VIR_ERR_OPERATION_INVALID,
-                    "%s", _("domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("domain is not running"));
         return -1;
     }
 
@@ -1384,8 +1379,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
      * TODO: check on Xen 3.0.3
      */
     if (hv_versions.dom_interface < 5) {
-        virXenError(VIR_ERR_NO_XEN, "%s",
-                    _("unsupported in dom interface < 5"));
+        virReportError(VIR_ERR_NO_XEN, "%s",
+                       _("unsupported in dom interface < 5"));
         return -1;
     }
 
@@ -1423,18 +1418,18 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
                 if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_WEIGHT)) {
                     val = params[i].value.ui;
                     if ((val < 1) || (val > USHRT_MAX)) {
-                        virXenError(VIR_ERR_INVALID_ARG,
-                                    _("Credit scheduler weight parameter (%d) "
-                                      "is out of range (1-65535)"), val);
+                        virReportError(VIR_ERR_INVALID_ARG,
+                                       _("Credit scheduler weight parameter (%d) "
+                                         "is out of range (1-65535)"), val);
                         return -1;
                     }
                     op_dom.u.getschedinfo.u.credit.weight = val;
                 } else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_CAP)) {
                     val = params[i].value.ui;
                     if (val >= USHRT_MAX) {
-                        virXenError(VIR_ERR_INVALID_ARG,
-                                    _("Credit scheduler cap parameter (%d) is "
-                                      "out of range (0-65534)"), val);
+                        virReportError(VIR_ERR_INVALID_ARG,
+                                       _("Credit scheduler cap parameter (%d) is "
+                                         "out of range (0-65534)"), val);
                         return -1;
                     }
                     op_dom.u.getschedinfo.u.credit.cap = val;
@@ -1447,9 +1442,9 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
             break;
         }
         default:
-            virXenError(VIR_ERR_INVALID_ARG,
-                        _("Unknown scheduler %d"),
-                        op_sys.u.getschedulerid.sched_id);
+            virReportError(VIR_ERR_INVALID_ARG,
+                           _("Unknown scheduler %d"),
+                           op_sys.u.getschedulerid.sched_id);
             return -1;
         }
     }
@@ -1474,8 +1469,8 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
     xenUnifiedUnlock(priv);
     return ret;
 #else
-    virXenError(VIR_ERR_OPERATION_INVALID, "%s",
-                _("block statistics not supported on this platform"));
+    virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                   _("block statistics not supported on this platform"));
     return -1;
 #endif
 }
@@ -1499,20 +1494,20 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom,
      * domain.
      */
     if (sscanf(path, "vif%d.%d", &rqdomid, &device) != 2) {
-        virXenError(VIR_ERR_INVALID_ARG, "%s",
-                    _("invalid path, should be vif<domid>.<n>."));
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("invalid path, should be vif<domid>.<n>."));
         return -1;
     }
     if (rqdomid != dom->id) {
-        virXenError(VIR_ERR_INVALID_ARG, "%s",
-                    _("invalid path, vif<domid> should match this domain ID"));
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("invalid path, vif<domid> should match this domain ID"));
         return -1;
     }
 
     return linuxDomainInterfaceStats(path, stats);
 #else
-    virXenError(VIR_ERR_OPERATION_INVALID, "%s",
-                _("/proc/net/dev: Interface not found"));
+    virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                   _("/proc/net/dev: Interface not found"));
     return -1;
 #endif
 }
@@ -1748,7 +1743,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
         xen_op_v2_dom op;
 
         if (lock_pages(cpumap, maplen) < 0) {
-            virXenError(VIR_ERR_XEN_CALL, " locking");
+            virReportError(VIR_ERR_XEN_CALL, " locking");
             return -1;
         }
         memset(&op, 0, sizeof(op));
@@ -1783,7 +1778,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
         VIR_FREE(new);
 
         if (unlock_pages(cpumap, maplen) < 0) {
-            virXenError(VIR_ERR_XEN_CALL, " release");
+            virReportError(VIR_ERR_XEN_CALL, " release");
             ret = -1;
         }
     } else {
@@ -1880,7 +1875,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
         }
         if ((cpumap != NULL) && (maplen > 0)) {
             if (lock_pages(cpumap, maplen) < 0) {
-                virXenError(VIR_ERR_XEN_CALL, " locking");
+                virReportError(VIR_ERR_XEN_CALL, " locking");
                 return -1;
             }
             memset(cpumap, 0, maplen);
@@ -1898,7 +1893,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
             }
             ret = xenHypervisorDoV2Dom(handle, &op);
             if (unlock_pages(cpumap, maplen) < 0) {
-                virXenError(VIR_ERR_XEN_CALL, " release");
+                virReportError(VIR_ERR_XEN_CALL, " release");
                 ret = -1;
             }
         }
@@ -1998,7 +1993,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
         char error[100];
         regerror (errcode, &flags_hvm_rec, error, sizeof(error));
         regfree (&flags_hvm_rec);
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
         in_init = 0;
         return -1;
     }
@@ -2008,7 +2003,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
         regerror (errcode, &flags_pae_rec, error, sizeof(error));
         regfree (&flags_pae_rec);
         regfree (&flags_hvm_rec);
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
         in_init = 0;
         return -1;
     }
@@ -2019,7 +2014,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
         regfree (&xen_cap_rec);
         regfree (&flags_pae_rec);
         regfree (&flags_hvm_rec);
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s", error);
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
         in_init = 0;
         return -1;
     }
@@ -2079,8 +2074,8 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
      */
 
     hv_versions.hypervisor = -1;
-    virXenError(VIR_ERR_XEN_CALL, " ioctl %lu",
-                (unsigned long) IOCTL_PRIVCMD_HYPERCALL);
+    virReportError(VIR_ERR_XEN_CALL, " ioctl %lu",
+                   (unsigned long) IOCTL_PRIVCMD_HYPERCALL);
     VIR_FORCE_CLOSE(fd);
     in_init = 0;
     return -1;
@@ -2184,8 +2179,8 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
 
     VIR_DEBUG("Failed to find any Xen hypervisor method");
     hv_versions.hypervisor = -1;
-    virXenError(VIR_ERR_XEN_CALL, " ioctl %lu",
-                (unsigned long)IOCTL_PRIVCMD_HYPERCALL);
+    virReportError(VIR_ERR_XEN_CALL, " ioctl %lu",
+                   (unsigned long)IOCTL_PRIVCMD_HYPERCALL);
     VIR_FORCE_CLOSE(fd);
     in_init = 0;
     VIR_FREE(ipt);
@@ -2226,7 +2221,7 @@ xenHypervisorOpen(virConnectPtr conn,
 
     ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR);
     if (ret < 0) {
-        virXenError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET);
+        virReportError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET);
         return -1;
     }
 
@@ -2925,30 +2920,30 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
 
     priv = (xenUnifiedPrivatePtr) dom->conn->privateData;
     if (priv->handle < 0) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("domain shut off or invalid"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("domain shut off or invalid"));
         return NULL;
     }
 
     /* HV's earlier than 3.1.0 don't include the HVM flags in guests status*/
     if (hv_versions.hypervisor < 2 ||
         hv_versions.dom_interface < 4) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("unsupported in dom interface < 4"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("unsupported in dom interface < 4"));
         return NULL;
     }
 
     XEN_GETDOMAININFO_CLEAR(dominfo);
 
     if (virXen_getdomaininfo(priv->handle, dom->id, &dominfo) < 0) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("cannot get domain details"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("cannot get domain details"));
         return NULL;
     }
 
     if (XEN_GETDOMAININFO_DOMAIN(dominfo) != dom->id) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("cannot get domain details"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("cannot get domain details"));
         return NULL;
     }
 
@@ -3347,21 +3342,21 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
     xenUnifiedPrivatePtr priv;
 
     if (conn == NULL) {
-        virXenError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument"));
+        virReportError(VIR_ERR_INVALID_ARG, "%s", _("invalid argument"));
         return -1;
     }
 
     priv = conn->privateData;
 
     if (priv->nbNodeCells < 0) {
-        virXenError(VIR_ERR_XEN_CALL, "%s",
-                    _("cannot determine actual number of cells"));
+        virReportError(VIR_ERR_XEN_CALL, "%s",
+                       _("cannot determine actual number of cells"));
         return -1;
     }
 
     if ((maxCells < 1) || (startCell >= priv->nbNodeCells)) {
-        virXenError(VIR_ERR_INVALID_ARG, "%s",
-                    _("invalid argument"));
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("invalid argument"));
         return -1;
     }
 
@@ -3369,14 +3364,14 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
      * Support only hv_versions.sys_interface >=4
      */
     if (hv_versions.sys_interface < SYS_IFACE_MIN_VERS_NUMA) {
-        virXenError(VIR_ERR_XEN_CALL, "%s",
-                    _("unsupported in sys interface < 4"));
+        virReportError(VIR_ERR_XEN_CALL, "%s",
+                       _("unsupported in sys interface < 4"));
         return -1;
     }
 
     if (priv->handle < 0) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("priv->handle invalid"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("priv->handle invalid"));
         return -1;
     }
 
@@ -3617,13 +3612,13 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
     if (priv->handle < 0 || (domain->id < 0) ||
         (info == NULL) || (maxinfo < 1) ||
         (sizeof(cpumap_t) & 7)) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("domain shut off or invalid"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("domain shut off or invalid"));
         return -1;
     }
     if ((cpumaps != NULL) && (maplen < 1)) {
-        virXenError(VIR_ERR_INVALID_ARG, "%s",
-                    _("invalid argument"));
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("invalid argument"));
         return -1;
     }
     /* first get the number of virtual CPUs in this domain */
@@ -3632,8 +3627,8 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
                                &dominfo);
 
     if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id)) {
-        virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                    _("cannot get domain details"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("cannot get domain details"));
         return -1;
     }
     nbinfo = XEN_GETDOMAININFO_CPUCOUNT(dominfo) + 1;
@@ -3649,16 +3644,16 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
                                       (unsigned char *)VIR_GET_CPUMAP(cpumaps, maplen, i),
                                       maplen);
             if (ret < 0) {
-                virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                            _("cannot get VCPUs info"));
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                               _("cannot get VCPUs info"));
                 return -1;
             }
         } else {
             ret = virXen_getvcpusinfo(priv->handle, domain->id, i,
                                       ipt, NULL, 0);
             if (ret < 0) {
-                virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
-                            _("cannot get VCPUs info"));
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                               _("cannot get VCPUs info"));
                 return -1;
             }
         }
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index f7495b5..7185366 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -44,10 +44,6 @@
 
 #define VIR_FROM_THIS VIR_FROM_XEN_INOTIFY
 
-#define virXenInotifyError(code, ...)                                   \
-        virReportErrorHelper(VIR_FROM_XEN_INOTIFY, code, __FILE__,      \
-                             __FUNCTION__, __LINE__, __VA_ARGS__)
-
 struct xenUnifiedDriver xenInotifyDriver = {
     .xenClose = xenInotifyClose,
 };
@@ -91,8 +87,8 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
     uuid_str = filename + strlen(XEND_DOMAINS_DIR) + 1;
 
     if (virUUIDParse(uuid_str, rawuuid) < 0) {
-        virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                           _("parsing uuid %s"), uuid_str);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("parsing uuid %s"), uuid_str);
         return -1;
     }
     /* call directly into xend here, as driver may not yet
@@ -116,8 +112,8 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
                 return 0;
             }
         }
-        virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("finding dom on config list"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("finding dom on config list"));
         return -1;
     }
 
@@ -168,8 +164,8 @@ xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn,
     int i;
 
     if (virUUIDParse(uuidstr, uuid) < 0) {
-        virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                           _("parsing uuid %s"), uuidstr);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("parsing uuid %s"), uuidstr);
         return -1;
     }
 
@@ -204,15 +200,15 @@ xenInotifyXendDomainsDirAddEntry(virConnectPtr conn,
     xenUnifiedPrivatePtr priv = conn->privateData;
 
     if (xenInotifyDomainLookup(conn, fname, &name, uuid) < 0) {
-        virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("Error looking up domain"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("Error looking up domain"));
         return -1;
     }
 
     if (xenUnifiedAddDomainInfo(priv->configInfoList,
                                 -1, name, uuid) < 0) {
-        virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("Error adding file to config cache"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("Error adding file to config cache"));
         VIR_FREE(name);
         return -1;
     }
@@ -257,8 +253,8 @@ xenInotifyEvent(int watch ATTRIBUTE_UNUSED,
     if( conn && conn->privateData ) {
         priv = conn->privateData;
     } else {
-        virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                           "%s", _("conn, or private data is NULL"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("conn, or private data is NULL"));
         return;
     }
 
@@ -300,19 +296,19 @@ reread:
             if (event)
                 xenUnifiedDomainEventDispatch(conn->privateData, event);
             else
-                virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                                   "%s", _("looking up dom"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("looking up dom"));
 
             if (xenInotifyRemoveDomainConfigInfo(conn, fname) < 0 ) {
-                virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                                   "%s", _("Error adding file to config cache"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("Error adding file to config cache"));
                 goto cleanup;
             }
         } else if (e->mask & ( IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO) ) {
             virDomainEventPtr event;
             if (xenInotifyAddDomainConfigInfo(conn, fname) < 0 ) {
-                virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                                   "%s", _("Error adding file to config cache"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("Error adding file to config cache"));
                 goto cleanup;
             }
 
@@ -323,8 +319,8 @@ reread:
             if (event)
                 xenUnifiedDomainEventDispatch(conn->privateData, event);
             else
-                virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                                   "%s", _("looking up dom"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("looking up dom"));
 
         }
 
@@ -386,8 +382,8 @@ xenInotifyOpen(virConnectPtr conn,
             }
 
             if (xenInotifyAddDomainConfigInfo(conn, path) < 0 ) {
-                virXenInotifyError(VIR_ERR_INTERNAL_ERROR,
-                                   "%s", _("Error adding file to config list"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("Error adding file to config list"));
                 closedir(dh);
                 VIR_FREE(path);
                 return -1;
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index f965129..191f1bf 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -65,13 +65,6 @@ virDomainXMLDevID(virDomainPtr domain,
                   char *ref,
                   int ref_len);
 
-#define virXendError(code, ...)                                            \
-        virReportErrorHelper(VIR_FROM_XEND, code, __FILE__,                \
-                             __FUNCTION__, __LINE__, __VA_ARGS__)
-
-#define virXendErrorInt(code, ival)                                        \
-        virXendError(code, "%d", ival)
-
 /**
  * do_connect:
  * @xend: pointer to the Xen Daemon structure
@@ -89,8 +82,8 @@ do_connect(virConnectPtr xend)
 
     s = socket(priv->addrfamily, SOCK_STREAM, priv->addrprotocol);
     if (s == -1) {
-        virXendError(VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("failed to create a socket"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("failed to create a socket"));
         return -1;
     }
 
@@ -109,8 +102,8 @@ do_connect(virConnectPtr xend)
          * error
          */
         if (xenHavePrivilege()) {
-            virXendError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("failed to connect to xend"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("failed to connect to xend"));
         }
     }
 
@@ -156,11 +149,11 @@ wr_sync(int fd, void *buffer, size_t size, int do_read)
         /* unrecoverable error */
         if (len == -1) {
             if (do_read)
-                virXendError(VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("failed to read from Xen Daemon"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("failed to read from Xen Daemon"));
             else
-                virXendError(VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("failed to write to Xen Daemon"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("failed to write to Xen Daemon"));
 
             return -1;
         }
@@ -303,11 +296,11 @@ xend_req(int fd, char **content)
         ssize_t ret;
 
         if (content_length > XEND_RCV_BUF_MAX_LEN) {
-            virXendError(VIR_ERR_INTERNAL_ERROR,
-                         _("Xend returned HTTP Content-Length of %d, "
-                           "which exceeds maximum of %d"),
-                         content_length,
-                         XEND_RCV_BUF_MAX_LEN);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Xend returned HTTP Content-Length of %d, "
+                             "which exceeds maximum of %d"),
+                           content_length,
+                           XEND_RCV_BUF_MAX_LEN);
             return -1;
         }
 
@@ -363,9 +356,9 @@ xend_get(virConnectPtr xend, const char *path,
         return ret;
 
     if ((ret >= 300) && ((ret != 404) || (!STRPREFIX(path, "/xend/domain/")))) {
-        virXendError(VIR_ERR_GET_FAILED,
-                     _("%d status from xen daemon: %s:%s"),
-                     ret, path, NULLSTR(*content));
+        virReportError(VIR_ERR_GET_FAILED,
+                       _("%d status from xen daemon: %s:%s"),
+                       ret, path, NULLSTR(*content));
     }
 
     return ret;
@@ -411,11 +404,11 @@ xend_post(virConnectPtr xend, const char *path, const char *ops)
     VIR_FORCE_CLOSE(s);
 
     if ((ret < 0) || (ret >= 300)) {
-        virXendError(VIR_ERR_POST_FAILED,
-                     _("xend_post: error from xen daemon: %s"), err_buf);
+        virReportError(VIR_ERR_POST_FAILED,
+                       _("xend_post: error from xen daemon: %s"), err_buf);
     } else if ((ret == 202) && err_buf && (strstr(err_buf, "failed") != NULL)) {
-        virXendError(VIR_ERR_POST_FAILED,
-                     _("xend_post: error from xen daemon: %s"), err_buf);
+        virReportError(VIR_ERR_POST_FAILED,
+                       _("xend_post: error from xen daemon: %s"), err_buf);
         ret = -1;
     } else if (((ret >= 200) && (ret <= 202)) && err_buf &&
                (strstr(err_buf, "xend.err") != NULL)) {
@@ -423,8 +416,8 @@ xend_post(virConnectPtr xend, const char *path, const char *ops)
          * which returns a success code, but the word 'xend.err'
          * in body to indicate error :-(
          */
-        virXendError(VIR_ERR_POST_FAILED,
-                     _("xend_post: error from xen daemon: %s"), err_buf);
+        virReportError(VIR_ERR_POST_FAILED,
+                       _("xend_post: error from xen daemon: %s"), err_buf);
         ret = -1;
     }
 
@@ -458,7 +451,7 @@ http2unix(int ret)
             errno = EIO;
             break;
         default:
-            virXendErrorInt(VIR_ERR_HTTP_ERROR, ret);
+            virReportError(VIR_ERR_HTTP_ERROR, "%d", ret);
             errno = EINVAL;
             break;
     }
@@ -677,9 +670,9 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)
 
     ret = getaddrinfo (host, port, &hints, &res);
     if (ret != 0) {
-        virXendError(VIR_ERR_UNKNOWN_HOST,
-                     _("unable to resolve hostname '%s': %s"),
-                     host, gai_strerror (ret));
+        virReportError(VIR_ERR_UNKNOWN_HOST,
+                       _("unable to resolve hostname '%s': %s"),
+                       host, gai_strerror (ret));
         return -1;
     }
 
@@ -851,19 +844,19 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend, const char *domname,
 
     value = sexpr_node(root, "domain/domid");
     if (value == NULL) {
-        virXendError(VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("domain information incomplete, missing domid"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("domain information incomplete, missing domid"));
         goto error;
     }
     ret = strtol(value, NULL, 0);
     if ((ret == 0) && (value[0] != '0')) {
-        virXendError(VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("domain information incorrect domid not numeric"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("domain information incorrect domid not numeric"));
         ret = -1;
     } else if (uuid != NULL) {
         if (sexpr_uuid(uuid, root, "domain/uuid") < 0) {
-            virXendError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("domain information incomplete, missing uuid"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("domain information incomplete, missing uuid"));
         }
     }
 
@@ -901,8 +894,8 @@ xenDaemonDomainLookupByID(virConnectPtr xend,
 
     name = sexpr_node(root, "domain/name");
     if (name == NULL) {
-      virXendError(VIR_ERR_INTERNAL_ERROR,
-                   "%s", _("domain information incomplete, missing name"));
+      virReportError(VIR_ERR_INTERNAL_ERROR,
+                     "%s", _("domain information incomplete, missing name"));
       goto error;
     }
     if (domname) {
@@ -914,8 +907,8 @@ xenDaemonDomainLookupByID(virConnectPtr xend,
     }
 
     if (sexpr_uuid(uuid, root, "domain/uuid") < 0) {
-      virXendError(VIR_ERR_INTERNAL_ERROR,
-                   "%s", _("domain information incomplete, missing uuid"));
+      virReportError(VIR_ERR_INTERNAL_ERROR,
+                     "%s", _("domain information incomplete, missing uuid"));
       goto error;
     }
 
@@ -937,7 +930,7 @@ xend_detect_config_version(virConnectPtr conn) {
     xenUnifiedPrivatePtr priv;
 
     if (!VIR_IS_CONNECT(conn)) {
-        virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return -1;
     }
 
@@ -1178,7 +1171,7 @@ sexpr_to_xend_topology(const struct sexpr *root,
     return 0;
 
   parse_error:
-    virXendError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
+    virReportError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
   error:
     VIR_FREE(cpuNums);
     VIR_FREE(cpuset);
@@ -1240,8 +1233,8 @@ sexpr_to_domain(virConnectPtr conn, const struct sexpr *root)
     return ret;
 
 error:
-    virXendError(VIR_ERR_INTERNAL_ERROR,
-                 "%s", _("failed to parse Xend domain information"));
+    virReportError(VIR_ERR_INTERNAL_ERROR,
+                   "%s", _("failed to parse Xend domain information"));
     if (ret != NULL)
         virUnrefDomain(ret);
     return NULL;
@@ -1285,7 +1278,7 @@ xenDaemonOpen(virConnectPtr conn,
     if (conn->uri->scheme == NULL) {
         /* It should be a file access */
         if (conn->uri->path == NULL) {
-            virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__);
+            virReportError(VIR_ERR_NO_CONNECT, __FUNCTION__);
             goto failed;
         }
         if (xenDaemonOpen_unix(conn, conn->uri->path) < 0 ||
@@ -1319,7 +1312,7 @@ xenDaemonOpen(virConnectPtr conn,
             xend_detect_config_version(conn) == -1)
             goto failed;
     } else {
-        virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__);
+        virReportError(VIR_ERR_NO_CONNECT, __FUNCTION__);
         goto failed;
     }
 
@@ -1361,13 +1354,13 @@ int
 xenDaemonDomainSuspend(virDomainPtr domain)
 {
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (domain->id < 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                     _("Domain %s isn't running."), domain->name);
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("Domain %s isn't running."), domain->name);
         return -1;
     }
 
@@ -1387,13 +1380,13 @@ int
 xenDaemonDomainResume(virDomainPtr domain)
 {
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (domain->id < 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                     _("Domain %s isn't running."), domain->name);
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("Domain %s isn't running."), domain->name);
         return -1;
     }
 
@@ -1414,13 +1407,13 @@ int
 xenDaemonDomainShutdown(virDomainPtr domain)
 {
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (domain->id < 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                     _("Domain %s isn't running."), domain->name);
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("Domain %s isn't running."), domain->name);
         return -1;
     }
 
@@ -1444,13 +1437,13 @@ xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags)
     virCheckFlags(0, -1);
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (domain->id < 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                     _("Domain %s isn't running."), domain->name);
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("Domain %s isn't running."), domain->name);
         return -1;
     }
 
@@ -1481,13 +1474,13 @@ xenDaemonDomainDestroyFlags(virDomainPtr domain,
     virCheckFlags(0, -1);
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (domain->id < 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                     _("Domain %s isn't running."), domain->name);
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("Domain %s isn't running."), domain->name);
         return -1;
     }
 
@@ -1511,7 +1504,7 @@ xenDaemonDomainGetOSType(virDomainPtr domain)
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
 
@@ -1557,13 +1550,13 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename)
 {
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
         (filename == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (domain->id < 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                     _("Domain %s isn't running."), domain->name);
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("Domain %s isn't running."), domain->name);
         return -1;
     }
 
@@ -1595,13 +1588,13 @@ xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename,
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
         (filename == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (domain->id < 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                     _("Domain %s isn't running."), domain->name);
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("Domain %s isn't running."), domain->name);
         return -1;
     }
 
@@ -1628,7 +1621,7 @@ xenDaemonDomainRestore(virConnectPtr conn, const char *filename)
 {
     if ((conn == NULL) || (filename == NULL)) {
         /* this should be caught at the interface but ... */
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     return xend_op(conn, "", "op", "restore", "file", filename, NULL);
@@ -1651,7 +1644,7 @@ xenDaemonDomainGetMaxMemory(virDomainPtr domain)
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return 0;
     }
 
@@ -1690,7 +1683,7 @@ xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -1727,7 +1720,7 @@ xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory)
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -1808,7 +1801,7 @@ xenDaemonDomainGetXMLDesc(virDomainPtr domain, unsigned int flags,
     /* Flags checked by virDomainDefFormat */
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
@@ -1851,7 +1844,7 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
         (info == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -1926,7 +1919,7 @@ xenDaemonLookupByName(virConnectPtr conn, const char *domname)
     virDomainPtr ret = NULL;
 
     if ((conn == NULL) || (domname == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
 
@@ -1957,11 +1950,11 @@ xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
     struct sexpr *root;
 
     if (!VIR_IS_CONNECT(conn)) {
-        virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return -1;
     }
     if (info == NULL) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -1990,12 +1983,12 @@ xenDaemonNodeGetTopology(virConnectPtr conn,
     struct sexpr *root;
 
     if (!VIR_IS_CONNECT(conn)) {
-        virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return -1;
     }
 
     if (caps == NULL) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -2028,11 +2021,11 @@ xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer)
     unsigned long version;
 
     if (!VIR_IS_CONNECT(conn)) {
-        virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return -1;
     }
     if (hvVer == NULL) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     root = sexpr_get(conn, "/xend/node/");
@@ -2185,7 +2178,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
         || (vcpus < 1)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -2200,23 +2193,23 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
      * running domains, or _CONFIG for inactive domains.  */
     if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
         if (flags & VIR_DOMAIN_VCPU_CONFIG) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend version does not support modifying "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend version does not support modifying "
+                             "persistent config"));
             return -1;
         }
     } else if (domain->id < 0) {
         if (flags & VIR_DOMAIN_VCPU_LIVE) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("domain not running"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("domain not running"));
             return -1;
         }
     } else {
         if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) !=
             (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend only supports modifying both live and "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend only supports modifying both live and "
+                             "persistent config"));
         }
     }
 
@@ -2224,14 +2217,14 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
      * the maximum.  */
     flags |= VIR_DOMAIN_VCPU_MAXIMUM;
     if ((max = xenDaemonDomainGetVcpusFlags(domain, flags)) < 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                     _("could not determine max vcpus for the domain"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("could not determine max vcpus for the domain"));
         return -1;
     }
     if (vcpus > max) {
-        virXendError(VIR_ERR_INVALID_ARG,
-                     _("requested vcpus is greater than max allowable"
-                       " vcpus for the domain: %d > %d"), vcpus, max);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("requested vcpus is greater than max allowable"
+                         " vcpus for the domain: %d > %d"), vcpus, max);
         return -1;
     }
 
@@ -2267,7 +2260,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
      || (cpumap == NULL) || (maplen < 1) || (maplen > (int)sizeof(cpumap_t))) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -2303,8 +2296,8 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
 
     if (ret == 0) {
         if (virDomainVcpuPinAdd(def, cpumap, maplen, vcpu) < 0) {
-            virXendError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("failed to add vcpupin xml entry"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("failed to add vcpupin xml entry"));
             return -1;
         }
     }
@@ -2339,7 +2332,7 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
                   VIR_DOMAIN_VCPU_MAXIMUM, -1);
 
     if (domain == NULL || domain->conn == NULL || domain->name == NULL) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -2351,8 +2344,8 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
     if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
         return -2;
     if (domain->id < 0 && (flags & VIR_DOMAIN_VCPU_LIVE)) {
-        virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                     _("domain not active"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("domain not active"));
         return -1;
     }
 
@@ -2403,11 +2396,11 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
         || (info == NULL) || (maxinfo < 1)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     if (cpumaps != NULL && maplen < 1) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -2639,7 +2632,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -2648,14 +2641,14 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
     if (domain->id < 0) {
         /* Cannot modify live config if domain is inactive */
         if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Cannot modify live config if domain is inactive"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Cannot modify live config if domain is inactive"));
             return -1;
         }
         /* If xendConfigVersion < 3 only live config can be changed */
         if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend version does not support modifying "
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend version does not support modifying "
                            "persistent config"));
             return -1;
         }
@@ -2664,9 +2657,9 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
         if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4 &&
             (flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT &&
              flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend version does not support modifying "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend version does not support modifying "
+                             "persistent config"));
             return -1;
         }
         /* Xen only supports modifying both live and persistent config if
@@ -2675,9 +2668,9 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
         if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4 &&
             (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
                        VIR_DOMAIN_DEVICE_MODIFY_CONFIG))) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend only supports modifying both live and "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend only supports modifying both live and "
+                             "persistent config"));
             return -1;
         }
     }
@@ -2743,15 +2736,15 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
                 goto cleanup;
             }
         } else {
-            virXendError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                         _("unsupported device type"));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("unsupported device type"));
             goto cleanup;
         }
         break;
 
     default:
-        virXendError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                     _("unsupported device type"));
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("unsupported device type"));
         goto cleanup;
     }
 
@@ -2763,8 +2756,8 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
                       "config", sexpr, NULL);
     } else {
         if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
-            virXendError(VIR_ERR_OPERATION_INVALID,
-                         _("target '%s' already exists"), target);
+            virReportError(VIR_ERR_OPERATION_INVALID,
+                           _("target '%s' already exists"), target);
         } else {
             /* device exists, attempt to modify it */
             ret = xend_op(domain->conn, domain->name, "op", "device_configure",
@@ -2807,7 +2800,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
                   VIR_DOMAIN_DEVICE_MODIFY_CONFIG, -1);
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -2816,14 +2809,14 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
     if (domain->id < 0) {
         /* Cannot modify live config if domain is inactive */
         if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Cannot modify live config if domain is inactive"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Cannot modify live config if domain is inactive"));
             return -1;
         }
         /* If xendConfigVersion < 3 only live config can be changed */
         if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend version does not support modifying "
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend version does not support modifying "
                            "persistent config"));
             return -1;
         }
@@ -2832,9 +2825,9 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
         if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4 &&
             (flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT &&
              flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend version does not support modifying "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend version does not support modifying "
+                             "persistent config"));
             return -1;
         }
         /* Xen only supports modifying both live and persistent config if
@@ -2843,9 +2836,9 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
         if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4 &&
             (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
                        VIR_DOMAIN_DEVICE_MODIFY_CONFIG))) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend only supports modifying both live and "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend only supports modifying both live and "
+                             "persistent config"));
             return -1;
         }
     }
@@ -2871,16 +2864,16 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
         break;
 
     default:
-        virXendError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                     _("unsupported device type"));
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("unsupported device type"));
         goto cleanup;
     }
 
     sexpr = virBufferContentAndReset(&buf);
 
     if (virDomainXMLDevID(domain, dev, class, ref, sizeof(ref))) {
-        virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                     _("requested device does not exist"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("requested device does not exist"));
         goto cleanup;
     } else {
         /* device exists, attempt to modify it */
@@ -2920,7 +2913,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -2929,15 +2922,15 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
     if (domain->id < 0) {
         /* Cannot modify live config if domain is inactive */
         if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Cannot modify live config if domain is inactive"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Cannot modify live config if domain is inactive"));
             return -1;
         }
         /* If xendConfigVersion < 3 only live config can be changed */
         if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend version does not support modifying "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend version does not support modifying "
+                             "persistent config"));
             return -1;
         }
     } else {
@@ -2945,9 +2938,9 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
         if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4 &&
             (flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT &&
              flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend version does not support modifying "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend version does not support modifying "
+                             "persistent config"));
             return -1;
         }
         /* Xen only supports modifying both live and persistent config if
@@ -2956,9 +2949,9 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
         if (priv->xendConfigVersion >= XEND_CONFIG_VERSION_3_0_4 &&
             (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
                        VIR_DOMAIN_DEVICE_MODIFY_CONFIG))) {
-            virXendError(VIR_ERR_OPERATION_INVALID, "%s",
-                         _("Xend only supports modifying both live and "
-                           "persistent config"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Xend only supports modifying both live and "
+                             "persistent config"));
             return -1;
         }
     }
@@ -2982,8 +2975,8 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
             if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 1) < 0)
                 goto cleanup;
         } else {
-            virXendError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                         _("unsupported device type"));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("unsupported device type"));
             goto cleanup;
         }
         xendev = virBufferContentAndReset(&buf);
@@ -3013,7 +3006,7 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -3026,8 +3019,8 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
 
     root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
     if (root == NULL) {
-        virXendError(VIR_ERR_XEN_CALL,
-                      "%s", _("xenDaemonGetAutostart failed to find this domain"));
+        virReportError(VIR_ERR_XEN_CALL,
+                       "%s", _("xenDaemonGetAutostart failed to find this domain"));
         return -1;
     }
 
@@ -3053,7 +3046,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
+        virReportError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
         return -1;
     }
 
@@ -3066,8 +3059,8 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
 
     root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
     if (root == NULL) {
-        virXendError(VIR_ERR_XEN_CALL,
-                      "%s", _("xenDaemonSetAutostart failed to find this domain"));
+        virReportError(VIR_ERR_XEN_CALL,
+                       "%s", _("xenDaemonSetAutostart failed to find this domain"));
         return -1;
     }
 
@@ -3076,8 +3069,8 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
         const char *val = (autonode->u.s.car->kind == SEXPR_VALUE
                            ? autonode->u.s.car->u.value : NULL);
         if (!val || (!STREQ(val, "ignore") && !STREQ(val, "start"))) {
-            virXendError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("unexpected value from on_xend_start"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("unexpected value from on_xend_start"));
             goto error;
         }
 
@@ -3091,8 +3084,8 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
         }
 
         if (sexpr2string(root, &buffer) < 0) {
-            virXendError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("sexpr2string failed"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("sexpr2string failed"));
             goto error;
         }
 
@@ -3104,13 +3097,13 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
         content = virBufferContentAndReset(&buffer);
 
         if (xend_op(domain->conn, "", "op", "new", "config", content, NULL) != 0) {
-            virXendError(VIR_ERR_XEN_CALL,
-                         "%s", _("Failed to redefine sexpr"));
+            virReportError(VIR_ERR_XEN_CALL,
+                           "%s", _("Failed to redefine sexpr"));
             goto error;
         }
     } else {
-        virXendError(VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("on_xend_start not present in sexpr"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("on_xend_start not present in sexpr"));
         goto error;
     }
 
@@ -3172,9 +3165,9 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
 
     /* Xen doesn't support renaming domains during migration. */
     if (dname) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                      "%s", _("xenDaemonDomainMigrate: Xen does not support"
-                        " renaming domains during migration"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("xenDaemonDomainMigrate: Xen does not support"
+                               " renaming domains during migration"));
         return -1;
     }
 
@@ -3182,9 +3175,9 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
      * ignores it.
      */
     if (bandwidth) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                      "%s", _("xenDaemonDomainMigrate: Xen does not support"
-                        " bandwidth limits during migration"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("xenDaemonDomainMigrate: Xen does not support"
+                               " bandwidth limits during migration"));
         return -1;
     }
 
@@ -3210,16 +3203,16 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
      * a nice error message.
      */
     if (flags & VIR_MIGRATE_PAUSED) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                      "%s", _("xenDaemonDomainMigrate: xend cannot migrate paused domains"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("xenDaemonDomainMigrate: xend cannot migrate paused domains"));
         return -1;
     }
 
     /* XXX we could easily do tunnelled & peer2peer migration too
        if we want to. support these... */
     if (flags != 0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                      "%s", _("xenDaemonDomainMigrate: unsupported flag"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("xenDaemonDomainMigrate: unsupported flag"));
         return -1;
     }
 
@@ -3234,16 +3227,16 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
             return -1;
 
         if (uriptr->scheme && STRCASENEQ (uriptr->scheme, "xenmigr")) {
-            virXendError(VIR_ERR_INVALID_ARG,
-                          "%s", _("xenDaemonDomainMigrate: only xenmigr://"
-                            " migrations are supported by Xen"));
+            virReportError(VIR_ERR_INVALID_ARG,
+                           "%s", _("xenDaemonDomainMigrate: only xenmigr://"
+                                   " migrations are supported by Xen"));
             virURIFree (uriptr);
             return -1;
         }
         if (!uriptr->server) {
-            virXendError(VIR_ERR_INVALID_ARG,
-                          "%s", _("xenDaemonDomainMigrate: a hostname must be"
-                            " specified in the URI"));
+            virReportError(VIR_ERR_INVALID_ARG,
+                           "%s", _("xenDaemonDomainMigrate: a hostname must be"
+                                   " specified in the URI"));
             virURIFree (uriptr);
             return -1;
         }
@@ -3261,8 +3254,8 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
         int port_nr, n;
 
         if (virStrToLong_i(p+1, NULL, 10, &port_nr) < 0) {
-            virXendError(VIR_ERR_INVALID_ARG,
-                          "%s", _("xenDaemonDomainMigrate: invalid port number"));
+            virReportError(VIR_ERR_INVALID_ARG,
+                           "%s", _("xenDaemonDomainMigrate: invalid port number"));
             return -1;
         }
         snprintf (port, sizeof(port), "%d", port_nr);
@@ -3327,22 +3320,22 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
     if (!(def = virDomainDefParseString(priv->caps, xmlDesc,
                                         1 << VIR_DOMAIN_VIRT_XEN,
                                         VIR_DOMAIN_XML_INACTIVE))) {
-        virXendError(VIR_ERR_XML_ERROR,
-                     "%s", _("failed to parse domain description"));
+        virReportError(VIR_ERR_XML_ERROR,
+                       "%s", _("failed to parse domain description"));
         return NULL;
     }
 
     if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) {
-        virXendError(VIR_ERR_XML_ERROR,
-                     "%s", _("failed to build sexpr"));
+        virReportError(VIR_ERR_XML_ERROR,
+                       "%s", _("failed to build sexpr"));
         goto error;
     }
 
     ret = xend_op(conn, "", "op", "new", "config", sexpr, NULL);
     VIR_FREE(sexpr);
     if (ret != 0) {
-        virXendError(VIR_ERR_XEN_CALL,
-                     _("Failed to create inactive domain %s"), def->name);
+        virReportError(VIR_ERR_XEN_CALL,
+                       _("Failed to create inactive domain %s"), def->name);
         goto error;
     }
 
@@ -3364,7 +3357,7 @@ int xenDaemonDomainCreate(virDomainPtr domain)
     virDomainPtr tmp;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -3391,7 +3384,7 @@ int xenDaemonDomainUndefine(virDomainPtr domain)
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -3510,15 +3503,15 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
     char *schedulertype = NULL;
 
     if (domain->conn == NULL || domain->name == NULL) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
 
     /* Support only xendConfigVersion >=4 */
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_1_0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                      "%s", _("unsupported in xendConfigVersion < 4"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("unsupported in xendConfigVersion < 4"));
         return NULL;
     }
 
@@ -3529,8 +3522,8 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
     /* get xen_scheduler from xend/node */
     ret = sexpr_node(root, "node/xen_scheduler");
     if (ret == NULL){
-        virXendError(VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("node information incomplete, missing scheduler name"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("node information incomplete, missing scheduler name"));
         goto error;
     }
     if (STREQ (ret, "credit")) {
@@ -3550,7 +3543,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
         if (nparams)
             *nparams = XEN_SCHED_SEDF_NPARAM;
     } else {
-        virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
         goto error;
     }
 
@@ -3583,15 +3576,15 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
     int ret = -1;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     /* Support only xendConfigVersion >=4 */
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_1_0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                      "%s", _("unsupported in xendConfigVersion < 4"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("unsupported in xendConfigVersion < 4"));
         return -1;
     }
 
@@ -3603,16 +3596,16 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
     /* get the scheduler type */
     sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
     if (sched_type == NULL) {
-        virXendError(VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("Failed to get a scheduler name"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("Failed to get a scheduler name"));
         goto error;
     }
 
     switch (sched_nparam){
         case XEN_SCHED_SEDF_NPARAM:
             if (*nparams < XEN_SCHED_SEDF_NPARAM) {
-                virXendError(VIR_ERR_INVALID_ARG,
-                             "%s", _("Invalid parameter count"));
+                virReportError(VIR_ERR_INVALID_ARG,
+                               "%s", _("Invalid parameter count"));
                 goto error;
             }
 
@@ -3622,21 +3615,21 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
         case XEN_SCHED_CRED_NPARAM:
             /* get cpu_weight/cpu_cap from xend/domain */
             if (sexpr_node(root, "domain/cpu_weight") == NULL) {
-                virXendError(VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("domain information incomplete, missing cpu_weight"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("domain information incomplete, missing cpu_weight"));
                 goto error;
             }
             if (sexpr_node(root, "domain/cpu_cap") == NULL) {
-                virXendError(VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("domain information incomplete, missing cpu_cap"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               "%s", _("domain information incomplete, missing cpu_cap"));
                 goto error;
             }
 
             if (virStrcpyStatic(params[0].field,
                                 VIR_DOMAIN_SCHEDULER_WEIGHT) == NULL) {
-                virXendError(VIR_ERR_INTERNAL_ERROR,
-                             _("Weight %s too big for destination"),
-                             VIR_DOMAIN_SCHEDULER_WEIGHT);
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("Weight %s too big for destination"),
+                               VIR_DOMAIN_SCHEDULER_WEIGHT);
                 goto error;
             }
             params[0].type = VIR_TYPED_PARAM_UINT;
@@ -3645,9 +3638,9 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
             if (*nparams > 1) {
                 if (virStrcpyStatic(params[1].field,
                                     VIR_DOMAIN_SCHEDULER_CAP) == NULL) {
-                    virXendError(VIR_ERR_INTERNAL_ERROR,
-                                 _("Cap %s too big for destination"),
-                                 VIR_DOMAIN_SCHEDULER_CAP);
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                                   _("Cap %s too big for destination"),
+                                   VIR_DOMAIN_SCHEDULER_CAP);
                     goto error;
                 }
                 params[1].type = VIR_TYPED_PARAM_UINT;
@@ -3659,7 +3652,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
             ret = 0;
             break;
         default:
-            virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
             goto error;
     }
 
@@ -3691,15 +3684,15 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
     int ret = -1;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     /* Support only xendConfigVersion >=4 and active domains */
     priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
     if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_1_0) {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                      "%s", _("unsupported in xendConfigVersion < 4"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("unsupported in xendConfigVersion < 4"));
         return -1;
     }
 
@@ -3711,8 +3704,8 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
     /* get the scheduler type */
     sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
     if (sched_type == NULL) {
-        virXendError(VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("Failed to get a scheduler name"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("Failed to get a scheduler name"));
         goto error;
     }
 
@@ -3738,7 +3731,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
                     params[i].type == VIR_TYPED_PARAM_UINT) {
                     snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui);
                 } else {
-                    virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+                    virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
                     goto error;
                 }
             }
@@ -3747,8 +3740,8 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
             if (strlen(buf_weight) == 0) {
                 weight = sexpr_node(root, "domain/cpu_weight");
                 if (weight == NULL) {
-                    virXendError(VIR_ERR_INTERNAL_ERROR,
-                                "%s", _("domain information incomplete, missing cpu_weight"));
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                                   "%s", _("domain information incomplete, missing cpu_weight"));
                     goto error;
                 }
                 snprintf(buf_weight, sizeof(buf_weight), "%s", weight);
@@ -3756,8 +3749,8 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
             if (strlen(buf_cap) == 0) {
                 cap = sexpr_node(root, "domain/cpu_cap");
                 if (cap == NULL) {
-                    virXendError(VIR_ERR_INTERNAL_ERROR,
-                                "%s", _("domain information incomplete, missing cpu_cap"));
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                                   "%s", _("domain information incomplete, missing cpu_cap"));
                     goto error;
                 }
                 snprintf(buf_cap, sizeof(buf_cap), "%s", cap);
@@ -3769,7 +3762,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
             break;
         }
         default:
-            virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
             goto error;
     }
 
@@ -3817,13 +3810,13 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
                           domain->name);
     else {
         /* This call always fails for dom0. */
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                      "%s", _("domainBlockPeek is not supported for dom0"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("domainBlockPeek is not supported for dom0"));
         return -1;
     }
 
     if (!root) {
-        virXendError(VIR_ERR_XEN_CALL, __FUNCTION__);
+        virReportError(VIR_ERR_XEN_CALL, __FUNCTION__);
         return -1;
     }
 
@@ -3838,8 +3831,8 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
         goto cleanup;
 
     if (!(actual = virDomainDiskPathByName(def, path))) {
-        virXendError(VIR_ERR_INVALID_ARG,
-                      _("%s: invalid path"), path);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("%s: invalid path"), path);
         goto cleanup;
     }
     path = actual;
@@ -4000,8 +3993,8 @@ virDomainXMLDevID(virDomainPtr domain,
         if (tmp == NULL)
             return -1;
     } else {
-        virXendError(VIR_ERR_OPERATION_INVALID,
-                     "%s", _("hotplug of device type not supported"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("hotplug of device type not supported"));
         return -1;
     }
 
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index cde0abb..c073f25 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -96,10 +96,6 @@ struct xenUnifiedDriver xenXMDriver = {
     .xenDomainDetachDeviceFlags = xenXMDomainDetachDeviceFlags,
 };
 
-#define xenXMError(code, ...)                                              \
-        virReportErrorHelper(VIR_FROM_XENXM, code, __FILE__,               \
-                             __FUNCTION__, __LINE__, __VA_ARGS__)
-
 #ifndef WITH_XEN_INOTIFY
 static int xenInotifyActive(virConnectPtr conn ATTRIBUTE_UNUSED)
 {
@@ -281,8 +277,8 @@ xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename)
             virDomainDefFree(entry->def);
             VIR_FREE(entry->filename);
             VIR_FREE(entry);
-            xenXMError(VIR_ERR_INTERNAL_ERROR,
-                        "%s", _("xenXMConfigCacheRefresh: virHashAddEntry"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("xenXMConfigCacheRefresh: virHashAddEntry"));
             return -1;
         }
     }
@@ -486,7 +482,7 @@ int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) {
     const char *filename;
     xenXMConfCachePtr entry;
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -532,7 +528,7 @@ char *xenXMDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
     /* Flags checked by virDomainDefFormat */
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
     if (domain->id != -1)
@@ -565,7 +561,7 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory) {
     int ret = -1;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     if (domain->conn->flags & VIR_CONNECT_RO)
@@ -610,7 +606,7 @@ int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) {
     int ret = -1;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     if (domain->conn->flags & VIR_CONNECT_RO)
@@ -653,7 +649,7 @@ unsigned long long xenXMDomainGetMaxMemory(virDomainPtr domain) {
     unsigned long long ret = 0;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return 0;
     }
     if (domain->id != -1)
@@ -701,18 +697,18 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
                   VIR_DOMAIN_VCPU_MAXIMUM, -1);
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        xenXMError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+        virReportError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
         return -1;
     }
     if (domain->id != -1)
         return -2;
     if (flags & VIR_DOMAIN_VCPU_LIVE) {
-        xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("domain is not running"));
         return -1;
     }
 
@@ -727,8 +723,8 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
 
     /* Hypervisor maximum. */
     if ((max = xenUnifiedGetMaxVcpus(domain->conn, NULL)) < 0) {
-        xenXMError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("could not determine max vcpus for the domain"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("could not determine max vcpus for the domain"));
         goto cleanup;
     }
     /* Can't specify a current larger than stored maximum; but
@@ -736,9 +732,9 @@ xenXMDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
     if (!(flags & VIR_DOMAIN_VCPU_MAXIMUM))
         max = entry->def->maxvcpus;
     if (vcpus > max) {
-        xenXMError(VIR_ERR_INVALID_ARG,
-                   _("requested vcpus is greater than max allowable"
-                     " vcpus for the domain: %d > %d"), vcpus, max);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("requested vcpus is greater than max allowable"
+                         " vcpus for the domain: %d > %d"), vcpus, max);
         goto cleanup;
     }
 
@@ -785,14 +781,14 @@ xenXMDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
                   VIR_DOMAIN_VCPU_MAXIMUM, -1);
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     if (domain->id != -1)
         return -2;
     if (flags & VIR_DOMAIN_VCPU_LIVE) {
-        xenXMError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active"));
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("domain not active"));
         return -1;
     }
 
@@ -840,17 +836,17 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
 
     if (domain == NULL || domain->conn == NULL || domain->name == NULL
         || cpumap == NULL || maplen < 1 || maplen > (int)sizeof(cpumap_t)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     if (domain->conn->flags & VIR_CONNECT_RO) {
-        xenXMError(VIR_ERR_INVALID_ARG,
-                    "%s", _("read only connection"));
+        virReportError(VIR_ERR_INVALID_ARG,
+                       "%s", _("read only connection"));
         return -1;
     }
     if (domain->id != -1) {
-        xenXMError(VIR_ERR_INVALID_ARG,
-                    "%s", _("not inactive domain"));
+        virReportError(VIR_ERR_INVALID_ARG,
+                       "%s", _("not inactive domain"));
         return -1;
     }
 
@@ -858,12 +854,12 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
     xenUnifiedLock(priv);
 
     if (!(filename = virHashLookup(priv->nameConfigMap, domain->name))) {
-        xenXMError(VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("virHashLookup"));
         goto cleanup;
     }
     if (!(entry = virHashLookup(priv->configCache, filename))) {
-        xenXMError(VIR_ERR_INTERNAL_ERROR,
-                    "%s", _("can't retrieve config file for domain"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("can't retrieve config file for domain"));
         goto cleanup;
     }
 
@@ -923,11 +919,11 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) {
     virDomainPtr ret = NULL;
 
     if (!VIR_IS_CONNECT(conn)) {
-        xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return NULL;
     }
     if (domname == NULL) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
 
@@ -979,11 +975,11 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
     virDomainPtr ret = NULL;
 
     if (!VIR_IS_CONNECT(conn)) {
-        xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return NULL;
     }
     if (uuid == NULL) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
 
@@ -1078,11 +1074,11 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
     xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
 
     if (!VIR_IS_CONNECT(conn)) {
-        xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return NULL;
     }
     if (xml == NULL) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
     if (conn->flags & VIR_CONNECT_RO)
@@ -1116,9 +1112,9 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
             char uuidstr[VIR_UUID_STRING_BUFLEN];
 
             virUUIDFormat(entry->def->uuid, uuidstr);
-            xenXMError(VIR_ERR_OPERATION_FAILED,
-                       _("domain '%s' is already defined with uuid %s"),
-                       entry->def->name, uuidstr);
+            virReportError(VIR_ERR_OPERATION_FAILED,
+                           _("domain '%s' is already defined with uuid %s"),
+                           entry->def->name, uuidstr);
             entry = NULL;
             goto error;
         }
@@ -1129,28 +1125,28 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
         /* domain exists, we will overwrite it */
 
         if (!(oldfilename = (char *)virHashLookup(priv->nameConfigMap, def->name))) {
-            xenXMError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("can't retrieve config filename for domain to overwrite"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("can't retrieve config filename for domain to overwrite"));
             goto error;
         }
 
         if (!(entry = virHashLookup(priv->configCache, oldfilename))) {
-            xenXMError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("can't retrieve config entry for domain to overwrite"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("can't retrieve config entry for domain to overwrite"));
             goto error;
         }
 
         /* Remove the name -> filename mapping */
         if (virHashRemoveEntry(priv->nameConfigMap, def->name) < 0) {
-            xenXMError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("failed to remove old domain from config map"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("failed to remove old domain from config map"));
             goto error;
         }
 
         /* Remove the config record itself */
         if (virHashRemoveEntry(priv->configCache, oldfilename) < 0) {
-            xenXMError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("failed to remove old domain from config map"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("failed to remove old domain from config map"));
             goto error;
         }
 
@@ -1169,8 +1165,8 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
     }
 
     if ((entry->refreshedAt = time(NULL)) == ((time_t)-1)) {
-        xenXMError(VIR_ERR_INTERNAL_ERROR,
-                   "%s", _("unable to get current time"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("unable to get current time"));
         goto error;
     }
 
@@ -1181,15 +1177,15 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
     entry->def = def;
 
     if (virHashAddEntry(priv->configCache, filename, entry) < 0) {
-        xenXMError(VIR_ERR_INTERNAL_ERROR,
-                   "%s", _("unable to store config file handle"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("unable to store config file handle"));
         goto error;
     }
 
     if (virHashAddEntry(priv->nameConfigMap, def->name, entry->filename) < 0) {
         virHashSteal(priv->configCache, filename);
-        xenXMError(VIR_ERR_INTERNAL_ERROR,
-                   "%s", _("unable to store config file handle"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("unable to store config file handle"));
         goto error;
     }
 
@@ -1219,7 +1215,7 @@ int xenXMDomainUndefine(virDomainPtr domain) {
     int ret = -1;
 
     if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -1295,7 +1291,7 @@ int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
     int i, ret = -1;
 
     if (!VIR_IS_CONNECT(conn)) {
-        xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return -1;
     }
 
@@ -1340,7 +1336,7 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) {
     int ret = -1;
 
     if (!VIR_IS_CONNECT(conn)) {
-        xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_CONN, __FUNCTION__);
         return -1;
     }
 
@@ -1385,7 +1381,7 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
 
     if ((!domain) || (!domain->conn) || (!domain->name) || (!xml)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -1394,8 +1390,8 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,
 
     if ((flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) ||
         (domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) {
-        xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("Xm driver only supports modifying persistent config"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("Xm driver only supports modifying persistent config"));
         return -1;
     }
 
@@ -1436,8 +1432,8 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,
     }
 
     default:
-        xenXMError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                   _("Xm driver only supports adding disk or network devices"));
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Xm driver only supports adding disk or network devices"));
         goto cleanup;
     }
 
@@ -1482,7 +1478,7 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
 
     if ((!domain) || (!domain->conn) || (!domain->name) || (!xml)) {
-        xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -1491,8 +1487,8 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
 
     if ((flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) ||
         (domain->id != -1 && flags == VIR_DOMAIN_DEVICE_MODIFY_CURRENT)) {
-        xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("Xm driver only supports modifying persistent config"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("Xm driver only supports modifying persistent config"));
         return -1;
     }
 
@@ -1547,9 +1543,9 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
         break;
     }
     default:
-        xenXMError(VIR_ERR_CONFIG_UNSUPPORTED,
-                   _("device type '%s' cannot be detached"),
-                   virDomainDeviceTypeToString(dev->type));
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("device type '%s' cannot be detached"),
+                       virDomainDeviceTypeToString(dev->type));
         goto cleanup;
     }
 
@@ -1574,8 +1570,8 @@ xenXMDomainBlockPeek (virDomainPtr dom ATTRIBUTE_UNUSED,
                       size_t size ATTRIBUTE_UNUSED,
                       void *buffer ATTRIBUTE_UNUSED)
 {
-    xenXMError(VIR_ERR_OPERATION_INVALID, "%s",
-               _("block peeking not implemented"));
+    virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                   _("block peeking not implemented"));
     return -1;
 }
 
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index d1bcb27..8f52e8f 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -51,10 +51,6 @@ struct xenUnifiedDriver xenStoreDriver = {
     .xenDomainGetInfo = xenStoreGetDomainInfo,
 };
 
-#define virXenStoreError(code, ...)                                  \
-        virReportErrorHelper(VIR_FROM_XENSTORE, code, __FILE__,      \
-                             __FUNCTION__, __LINE__, __VA_ARGS__)
-
 /************************************************************************
  *									*
  *		Helper internal APIs					*
@@ -254,8 +250,8 @@ xenStoreOpen(virConnectPtr conn,
          * remote) mechanism.
          */
         if (xenHavePrivilege()) {
-            virXenStoreError(VIR_ERR_NO_XEN,
-                             "%s", _("failed to connect to Xen Store"));
+            virReportError(VIR_ERR_NO_XEN,
+                           "%s", _("failed to connect to Xen Store"));
         }
         return -1;
     }
@@ -278,8 +274,8 @@ xenStoreOpen(virConnectPtr conn,
     if ( xenStoreAddWatch(conn, "@releaseDomain",
                      "releaseDomain", xenStoreDomainReleased, priv) < 0 )
     {
-        virXenStoreError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("adding watch @releaseDomain"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("adding watch @releaseDomain"));
         return -1;
     }
 
@@ -287,8 +283,8 @@ xenStoreOpen(virConnectPtr conn,
     if( xenStoreAddWatch(conn, "@introduceDomain",
                      "introduceDomain", xenStoreDomainIntroduced, priv) < 0 )
     {
-        virXenStoreError(VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("adding watch @introduceDomain"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("adding watch @introduceDomain"));
         return -1;
     }
 
@@ -317,7 +313,7 @@ xenStoreClose(virConnectPtr conn)
     xenUnifiedPrivatePtr priv;
 
     if (conn == NULL) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -371,7 +367,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
         return -1;
 
     if ((domain == NULL) || (domain->conn == NULL) || (info == NULL)) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -472,7 +468,7 @@ xenStoreDomainSetMemory(virDomainPtr domain, unsigned long memory)
 
     if ((domain == NULL) || (domain->conn == NULL) ||
         (memory < 1024 * MIN_XEN_GUEST_SIZE)) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     if (domain->id == -1)
@@ -536,13 +532,13 @@ xenStoreNumOfDomains(virConnectPtr conn)
     xenUnifiedPrivatePtr priv;
 
     if (conn == NULL) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
     priv = (xenUnifiedPrivatePtr) conn->privateData;
     if (priv->xshandle == NULL) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -624,7 +620,7 @@ xenStoreListDomains(virConnectPtr conn, int *ids, int maxids)
     int ret;
 
     if ((conn == NULL) || (ids == NULL)) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
 
@@ -659,7 +655,7 @@ xenStoreLookupByName(virConnectPtr conn, const char *name)
     xenUnifiedPrivatePtr priv;
 
     if ((conn == NULL) || (name == NULL)) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
 
@@ -723,7 +719,7 @@ xenStoreDomainShutdown(virDomainPtr domain)
     xenUnifiedPrivatePtr priv;
 
     if ((domain == NULL) || (domain->conn == NULL)) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     if (domain->id == -1 || domain->id == 0)
@@ -759,7 +755,7 @@ xenStoreDomainReboot(virDomainPtr domain, unsigned int flags)
     virCheckFlags(0, -1);
 
     if ((domain == NULL) || (domain->conn == NULL)) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
     if (domain->id == -1 || domain->id == 0)
@@ -789,7 +785,7 @@ xenStoreDomainGetOSType(virDomainPtr domain) {
     char *vm, *str = NULL;
 
     if ((domain == NULL) || (domain->conn == NULL)) {
-        virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+        virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return NULL;
     }
 
@@ -1156,8 +1152,8 @@ int xenStoreAddWatch(virConnectPtr conn,
     for (n=0; n < list->count; n++) {
         if( STREQ(list->watches[n]->path, path) &&
             STREQ(list->watches[n]->token, token)) {
-            virXenStoreError(VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("watch already tracked"));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("watch already tracked"));
             return -1;
         }
     }
-- 
1.7.10.4


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