[PATCH 09/23] Replace use of libxlError with virReportError

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Update the libxl driver to use virReportError instead of
the libxlError custom macro

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 cfg.mk                   |    1 -
 src/libxl/libxl_conf.c   |   42 ++--
 src/libxl/libxl_conf.h   |    4 -
 src/libxl/libxl_driver.c |  614 +++++++++++++++++++++++-----------------------
 4 files changed, 328 insertions(+), 333 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index ffc9312..72321eb 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -513,7 +513,6 @@ msg_gen_function += PHYP_ERROR
 msg_gen_function += VIR_ERROR
 msg_gen_function += VMX_ERROR
 msg_gen_function += lxcError
-msg_gen_function += libxlError
 msg_gen_function += nodeReportError
 msg_gen_function += qemuReportError
 msg_gen_function += regerror
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 201df75..d3ce733 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -372,8 +372,8 @@ libxlMakeDomCreateInfo(virDomainDefPtr def, libxl_domain_create_info *c_info)
 
     virUUIDFormat(def->uuid, uuidstr);
     if (libxl_uuid_from_string(&c_info->uuid, uuidstr) ) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                 _("libxenlight failed to parse UUID '%s'"), uuidstr);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("libxenlight failed to parse UUID '%s'"), uuidstr);
         goto error;
     }
 
@@ -397,9 +397,9 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config)
      * only 32 can be represented.
      */
     if (def->maxvcpus > 32 || def->vcpus > 32) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("This version of libxenlight only supports 32 "
-                     "vcpus per domain"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("This version of libxenlight only supports 32 "
+                         "vcpus per domain"));
         return -1;
     }
 
@@ -532,9 +532,9 @@ libxlMakeDisk(virDomainDefPtr def, virDomainDiskDefPtr l_disk,
             x_disk->format = DISK_FORMAT_RAW;
             x_disk->backend = DISK_BACKEND_PHY;
         } else {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                        _("libxenlight does not support disk driver %s"),
-                        l_disk->driverName);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("libxenlight does not support disk driver %s"),
+                           l_disk->driverName);
             return -1;
         }
     } else {
@@ -548,8 +548,8 @@ libxlMakeDisk(virDomainDefPtr def, virDomainDiskDefPtr l_disk,
     x_disk->readwrite = !l_disk->readonly;
     x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
     if (l_disk->transient) {
-        libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
-                   _("libxenlight does not support transient disks"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("libxenlight does not support transient disks"));
         return -1;
     }
 
@@ -626,9 +626,9 @@ libxlMakeNic(virDomainDefPtr def, virDomainNetDefPtr l_nic,
         }
     } else {
         if (l_nic->script) {
-            libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("scripts are not supported on interfaces of type %s"),
-                       virDomainNetTypeToString(l_nic->type));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("scripts are not supported on interfaces of type %s"),
+                           virDomainNetTypeToString(l_nic->type));
             return -1;
         }
     }
@@ -697,8 +697,8 @@ libxlMakeVfb(libxlDriverPrivatePtr driver, virDomainDefPtr def,
             if (l_vfb->data.vnc.autoport) {
                 port = libxlNextFreeVncPort(driver, LIBXL_VNC_PORT_MIN);
                 if (port < 0) {
-                    libxlError(VIR_ERR_INTERNAL_ERROR,
-                                "%s", _("Unable to find an unused VNC port"));
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                                   "%s", _("Unable to find an unused VNC port"));
                     return -1;
                 }
                 l_vfb->data.vnc.port = port;
@@ -779,8 +779,8 @@ libxlMakeChrdevStr(virDomainChrDefPtr def, char **buf)
     const char *type = virDomainChrTypeToString(def->source.type);
 
     if (!type) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   "%s", _("unexpected chr device type"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("unexpected chr device type"));
         return -1;
     }
 
@@ -917,14 +917,14 @@ libxlMakeCapabilities(libxl_ctx *ctx)
     regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED);
 
     if (libxl_get_physinfo(ctx, &phy_info) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to get node physical info from libxenlight"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to get node physical info from libxenlight"));
         return NULL;
     }
 
     if ((ver_info = libxl_get_version_info(ctx)) == NULL) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to get version info from libxenlight"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to get version info from libxenlight"));
         return NULL;
     }
 
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 2820afb..3067c52 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -96,10 +96,6 @@ struct _libxlSavefileHeader {
     uint32_t unused[10];
 };
 
-# define libxlError(code, ...)                                     \
-    virReportErrorHelper(VIR_FROM_LIBXL, code, __FILE__,           \
-                         __FUNCTION__, __LINE__, __VA_ARGS__)
-
 virCapsPtr
 libxlMakeCapabilities(libxl_ctx *ctx);
 
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 4d1db3a..0e39484 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -168,14 +168,14 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
     struct utsname utsname;
 
     if (libxl_get_physinfo(&driver->ctx, &phy_info)) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("libxl_get_physinfo_info failed"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("libxl_get_physinfo_info failed"));
         return -1;
     }
 
     if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("libxl_get_version_info failed"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("libxl_get_version_info failed"));
         return -1;
     }
 
@@ -184,9 +184,9 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
                    utsname.machine,
                    strlen(utsname.machine),
                    sizeof(info->model)) == NULL) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("machine type %s too big for destination"),
-                   utsname.machine);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("machine type %s too big for destination"),
+                       utsname.machine);
         return -1;
     }
 
@@ -224,32 +224,32 @@ libxlSaveImageOpen(libxlDriverPrivatePtr driver, const char *from,
     char *xml = NULL;
 
     if ((fd = virFileOpenAs(from, O_RDONLY, 0, -1, -1, 0)) < 0) {
-        libxlError(VIR_ERR_OPERATION_FAILED,
-                   "%s", _("cannot read domain image"));
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       "%s", _("cannot read domain image"));
         goto error;
     }
 
     if (saferead(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) {
-        libxlError(VIR_ERR_OPERATION_FAILED,
-                   "%s", _("failed to read libxl header"));
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       "%s", _("failed to read libxl header"));
         goto error;
     }
 
     if (memcmp(hdr.magic, LIBXL_SAVE_MAGIC, sizeof(hdr.magic))) {
-        libxlError(VIR_ERR_INVALID_ARG, "%s", _("image magic is incorrect"));
+        virReportError(VIR_ERR_INVALID_ARG, "%s", _("image magic is incorrect"));
         goto error;
     }
 
     if (hdr.version > LIBXL_SAVE_VERSION) {
-        libxlError(VIR_ERR_OPERATION_FAILED,
-                   _("image version is not supported (%d > %d)"),
-                   hdr.version, LIBXL_SAVE_VERSION);
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       _("image version is not supported (%d > %d)"),
+                       hdr.version, LIBXL_SAVE_VERSION);
         goto error;
     }
 
     if (hdr.xmlLen <= 0) {
-        libxlError(VIR_ERR_OPERATION_FAILED,
-                   _("invalid XML length: %d"), hdr.xmlLen);
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       _("invalid XML length: %d"), hdr.xmlLen);
         goto error;
     }
 
@@ -259,7 +259,7 @@ libxlSaveImageOpen(libxlDriverPrivatePtr driver, const char *from,
     }
 
     if (saferead(fd, xml, hdr.xmlLen) != hdr.xmlLen) {
-        libxlError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to read XML"));
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to read XML"));
         goto error;
     }
 
@@ -362,8 +362,8 @@ libxlVmReap(libxlDriverPrivatePtr driver,
     libxlDomainObjPrivatePtr priv = vm->privateData;
 
     if (libxl_domain_destroy(&priv->ctx, vm->def->id, force) < 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Unable to cleanup domain %d"), vm->def->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Unable to cleanup domain %d"), vm->def->id);
         return -1;
     }
 
@@ -541,8 +541,8 @@ libxlDomainSetVcpuAffinites(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
         map.map = cpumap;
 
         if (libxl_set_vcpuaffinity(&priv->ctx, def->id, vcpu, &map) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to pin vcpu '%d' with libxenlight"), vcpu);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Failed to pin vcpu '%d' with libxenlight"), vcpu);
             goto cleanup;
         }
 
@@ -639,10 +639,10 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
                 char def_uuidstr[VIR_UUID_STRING_BUFLEN];
                 virUUIDFormat(vm->def->uuid, vm_uuidstr);
                 virUUIDFormat(def->uuid, def_uuidstr);
-                libxlError(VIR_ERR_OPERATION_FAILED,
-                           _("cannot restore domain '%s' uuid %s from a file"
-                             " which belongs to domain '%s' uuid %s"),
-                           vm->def->name, vm_uuidstr, def->name, def_uuidstr);
+                virReportError(VIR_ERR_OPERATION_FAILED,
+                               _("cannot restore domain '%s' uuid %s from a file"
+                                 " which belongs to domain '%s' uuid %s"),
+                               vm->def->name, vm_uuidstr, def->name, def_uuidstr);
                 goto error;
             }
 
@@ -664,9 +664,9 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
         return -1;
 
     if (libxlFreeMem(priv, &d_config) < 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("libxenlight failed to get free memory for domain '%s'"),
-                   d_config.c_info.name);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("libxenlight failed to get free memory for domain '%s'"),
+                       d_config.c_info.name);
         goto error;
     }
 
@@ -680,13 +680,13 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
 
     if (ret) {
         if (restore_fd < 0)
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("libxenlight failed to create new domain '%s'"),
-                       d_config.c_info.name);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("libxenlight failed to create new domain '%s'"),
+                           d_config.c_info.name);
         else
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("libxenlight failed to restore domain '%s'"),
-                       d_config.c_info.name);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("libxenlight failed to restore domain '%s'"),
+                           d_config.c_info.name);
         goto error;
     }
 
@@ -696,8 +696,8 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
 
     if (libxl_userdata_store(&priv->ctx, domid, "libvirt-xml",
                              (uint8_t *)dom_xml, strlen(dom_xml) + 1)) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("libxenlight failed to store userdata"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("libxenlight failed to store userdata"));
         goto error;
     }
 
@@ -1064,8 +1064,8 @@ libxlOpen(virConnectPtr conn,
 
         /* Error if xen or libxl scheme specified but driver not started. */
         if (libxl_driver == NULL) {
-            libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("libxenlight state driver is not active"));
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("libxenlight state driver is not active"));
             return VIR_DRV_OPEN_ERROR;
         }
 
@@ -1074,9 +1074,9 @@ libxlOpen(virConnectPtr conn,
             STRNEQ(conn->uri->path, "") &&
             STRNEQ(conn->uri->path, "/") &&
             STRNEQ(conn->uri->path, "/system")) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("unexpected Xen URI path '%s', try xen:///"),
-                       NULLSTR(conn->uri->path));
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("unexpected Xen URI path '%s', try xen:///"),
+                           NULLSTR(conn->uri->path));
             return VIR_DRV_OPEN_ERROR;
         }
     }
@@ -1227,7 +1227,7 @@ libxlDomainLookupByID(virConnectPtr conn, int id)
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN, NULL);
         goto cleanup;
     }
 
@@ -1253,7 +1253,7 @@ libxlDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN, NULL);
         goto cleanup;
     }
 
@@ -1279,7 +1279,7 @@ libxlDomainLookupByName(virConnectPtr conn, const char *name)
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN, NULL);
         goto cleanup;
     }
 
@@ -1309,12 +1309,12 @@ libxlDomainSuspend(virDomainPtr dom)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
 
@@ -1322,9 +1322,9 @@ libxlDomainSuspend(virDomainPtr dom)
 
     if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
         if (libxl_domain_pause(&priv->ctx, dom->id) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to suspend domain '%d' with libxenlight"),
-                       dom->id);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Failed to suspend domain '%d' with libxenlight"),
+                           dom->id);
             goto cleanup;
         }
 
@@ -1367,13 +1367,13 @@ libxlDomainResume(virDomainPtr dom)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
 
@@ -1381,9 +1381,9 @@ libxlDomainResume(virDomainPtr dom)
 
     if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
         if (libxl_domain_unpause(&priv->ctx, dom->id) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to resume domain '%d' with libxenlight"),
-                       dom->id);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Failed to resume domain '%d' with libxenlight"),
+                           dom->id);
             goto cleanup;
         }
 
@@ -1425,22 +1425,22 @@ libxlDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID,
-                   "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("Domain is not running"));
         goto cleanup;
     }
 
     priv = vm->privateData;
     if (libxl_domain_shutdown(&priv->ctx, dom->id, LIBXL_DOM_REQ_POWEROFF) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to shutdown domain '%d' with libxenlight"),
-                   dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to shutdown domain '%d' with libxenlight"),
+                       dom->id);
         goto cleanup;
     }
 
@@ -1478,22 +1478,22 @@ libxlDomainReboot(virDomainPtr dom, unsigned int flags)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID,
-                   "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("Domain is not running"));
         goto cleanup;
     }
 
     priv = vm->privateData;
     if (libxl_domain_shutdown(&priv->ctx, dom->id, LIBXL_DOM_REQ_REBOOT) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to reboot domain '%d' with libxenlight"),
-                   dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to reboot domain '%d' with libxenlight"),
+                       dom->id);
         goto cleanup;
     }
     ret = 0;
@@ -1521,14 +1521,14 @@ libxlDomainDestroyFlags(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID,
-                   "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("Domain is not running"));
         goto cleanup;
     }
 
@@ -1536,8 +1536,8 @@ libxlDomainDestroyFlags(virDomainPtr dom,
                                      VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
 
     if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_DESTROYED) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to destroy domain '%d'"), dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to destroy domain '%d'"), dom->id);
         goto cleanup;
     }
 
@@ -1576,8 +1576,8 @@ libxlDomainGetOSType(virDomainPtr dom)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -1602,7 +1602,7 @@ libxlDomainGetMaxMemory(virDomainPtr dom)
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
     ret = vm->def->mem.max_balloon;
@@ -1633,7 +1633,7 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
@@ -1653,15 +1653,15 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
     }
 
     if (!isActive && (flags & VIR_DOMAIN_MEM_LIVE)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("cannot set memory on an inactive domain"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("cannot set memory on an inactive domain"));
         goto cleanup;
     }
 
     if (flags & VIR_DOMAIN_MEM_CONFIG) {
         if (!vm->persistent) {
-            libxlError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("cannot change persistent config of a transient domain"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("cannot change persistent config of a transient domain"));
             goto cleanup;
         }
         if (!(persistentDef = virDomainObjGetPersistentDef(driver->caps, vm)))
@@ -1674,9 +1674,9 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
         if (flags & VIR_DOMAIN_MEM_LIVE) {
             priv = vm->privateData;
             if (libxl_domain_setmaxmem(&priv->ctx, dom->id, newmem) < 0) {
-                libxlError(VIR_ERR_INTERNAL_ERROR,
-                           _("Failed to set maximum memory for domain '%d'"
-                             " with libxenlight"), dom->id);
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("Failed to set maximum memory for domain '%d'"
+                                 " with libxenlight"), dom->id);
                 goto cleanup;
             }
         }
@@ -1695,8 +1695,8 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
         /* resize the current memory */
 
         if (newmem > vm->def->mem.max_balloon) {
-            libxlError(VIR_ERR_INVALID_ARG, "%s",
-                        _("cannot set memory higher than max memory"));
+            virReportError(VIR_ERR_INVALID_ARG, "%s",
+                           _("cannot set memory higher than max memory"));
             goto cleanup;
         }
 
@@ -1704,9 +1704,9 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long newmem,
             priv = vm->privateData;
             if (libxl_set_memory_target(&priv->ctx, dom->id, newmem, 0,
                                         /* force */ 1) < 0) {
-                libxlError(VIR_ERR_INTERNAL_ERROR,
-                           _("Failed to set memory for domain '%d'"
-                             " with libxenlight"), dom->id);
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("Failed to set memory for domain '%d'"
+                                 " with libxenlight"), dom->id);
                 goto cleanup;
             }
         }
@@ -1752,8 +1752,8 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s",
-                   _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s",
+                       _("no domain with matching uuid"));
         goto cleanup;
     }
 
@@ -1763,8 +1763,8 @@ libxlDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
         info->maxMem = vm->def->mem.max_balloon;
     } else {
         if (libxl_domain_info(&driver->ctx, &d_info, dom->id) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("libxl_domain_info failed for domain '%d'"), dom->id);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("libxl_domain_info failed for domain '%d'"), dom->id);
             goto cleanup;
         }
         info->cpuTime = d_info.cpu_time;
@@ -1799,8 +1799,8 @@ libxlDomainGetState(virDomainPtr dom,
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s",
-                   _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s",
+                       _("no domain with matching uuid"));
         goto cleanup;
     }
 
@@ -1828,9 +1828,9 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
     int ret = -1;
 
     if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
-        libxlError(VIR_ERR_OPERATION_INVALID,
-                   _("Domain '%d' has to be running because libxenlight will"
-                     " suspend it"), vm->def->id);
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       _("Domain '%d' has to be running because libxenlight will"
+                         " suspend it"), vm->def->id);
         goto cleanup;
     }
 
@@ -1851,21 +1851,21 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
     hdr.xmlLen = xml_len;
 
     if (safewrite(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) {
-        libxlError(VIR_ERR_OPERATION_FAILED,
-                    _("Failed to write save file header"));
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       _("Failed to write save file header"));
         goto cleanup;
     }
 
     if (safewrite(fd, xml, xml_len) != xml_len) {
-        libxlError(VIR_ERR_OPERATION_FAILED,
-                    _("Failed to write xml description"));
+        virReportError(VIR_ERR_OPERATION_FAILED,
+                       _("Failed to write xml description"));
         goto cleanup;
     }
 
     if (libxl_domain_suspend(&priv->ctx, NULL, vm->def->id, fd) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                    _("Failed to save domain '%d' with libxenlight"),
-                    vm->def->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to save domain '%d' with libxenlight"),
+                       vm->def->id);
         goto cleanup;
     }
 
@@ -1873,8 +1873,8 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
                                          VIR_DOMAIN_EVENT_STOPPED_SAVED);
 
     if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_SAVED) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                    _("Failed to destroy domain '%d'"), vm->def->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to destroy domain '%d'"), vm->def->id);
         goto cleanup;
     }
 
@@ -1906,8 +1906,8 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
 
     virCheckFlags(0, -1);
     if (dxml) {
-        libxlError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
-                   _("xml modification unsupported"));
+        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+                       _("xml modification unsupported"));
         return -1;
     }
 
@@ -1917,13 +1917,13 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
 
@@ -1955,8 +1955,8 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
 
     virCheckFlags(0, -1);
     if (dxml) {
-        libxlError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
-                   _("xml modification unsupported"));
+        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+                       _("xml modification unsupported"));
         return -1;
     }
 
@@ -2015,13 +2015,13 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
 
@@ -2030,10 +2030,10 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
     if (!(flags & VIR_DUMP_LIVE) &&
         virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
         if (libxl_domain_pause(&priv->ctx, dom->id) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("Before dumping core, failed to suspend domain '%d'"
-                         " with libxenlight"),
-                       dom->id);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Before dumping core, failed to suspend domain '%d'"
+                             " with libxenlight"),
+                           dom->id);
             goto cleanup;
         }
         virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_DUMP);
@@ -2041,17 +2041,17 @@ libxlDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags)
     }
 
     if (libxl_domain_core_dump(&priv->ctx, dom->id, to) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to dump core of domain '%d' with libxenlight"),
-                   dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to dump core of domain '%d' with libxenlight"),
+                       dom->id);
         goto cleanup_unpause;
     }
 
     libxlDriverLock(driver);
     if (flags & VIR_DUMP_CRASH) {
         if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_CRASHED) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to destroy domain '%d'"), dom->id);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Failed to destroy domain '%d'"), dom->id);
             goto cleanup_unlock;
         }
 
@@ -2071,9 +2071,9 @@ cleanup_unlock:
 cleanup_unpause:
     if (virDomainObjIsActive(vm) && paused) {
         if (libxl_domain_unpause(&priv->ctx, dom->id) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("After dumping core, failed to resume domain '%d' with"
-                         " libxenlight"), dom->id);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("After dumping core, failed to resume domain '%d' with"
+                             " libxenlight"), dom->id);
         } else {
             virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
                                  VIR_DOMAIN_RUNNING_UNPAUSED);
@@ -2105,18 +2105,18 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
     if (!vm->persistent) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("cannot do managed save for transient domain"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("cannot do managed save for transient domain"));
         goto cleanup;
     }
 
@@ -2171,8 +2171,8 @@ libxlDomainHasManagedSaveImage(virDomainPtr dom, unsigned int flags)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -2200,8 +2200,8 @@ libxlDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -2244,13 +2244,13 @@ libxlDomainSetVcpusFlags(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)) {
-        libxlError(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) {
-        libxlError(VIR_ERR_INVALID_ARG, _("nvcpus is zero"));
+        virReportError(VIR_ERR_INVALID_ARG, _("nvcpus is zero"));
         return -1;
     }
 
@@ -2259,25 +2259,25 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("cannot set vcpus on an inactive domain"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("cannot set vcpus on an inactive domain"));
         goto cleanup;
     }
 
     if (!vm->persistent && (flags & VIR_DOMAIN_VCPU_CONFIG)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("cannot change persistent config of a transient domain"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("cannot change persistent config of a transient domain"));
         goto cleanup;
     }
 
     if ((max = libxlGetMaxVcpus(dom->conn, NULL)) < 0) {
-        libxlError(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;
     }
 
@@ -2286,9 +2286,9 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
     }
 
     if (nvcpus > max) {
-        libxlError(VIR_ERR_INVALID_ARG,
-                   _("requested vcpus is greater than max allowable"
-                     " vcpus for the domain: %d > %d"), nvcpus, max);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("requested vcpus is greater than max allowable"
+                         " vcpus for the domain: %d > %d"), nvcpus, max);
         goto cleanup;
     }
 
@@ -2324,18 +2324,18 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
 
     case VIR_DOMAIN_VCPU_LIVE:
         if (libxl_set_vcpuonline(&priv->ctx, dom->id, &map) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to set vcpus for domain '%d'"
-                         " with libxenlight"), dom->id);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Failed to set vcpus for domain '%d'"
+                             " with libxenlight"), dom->id);
             goto cleanup;
         }
         break;
 
     case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
         if (libxl_set_vcpuonline(&priv->ctx, dom->id, &map) != 0) {
-            libxlError(VIR_ERR_INTERNAL_ERROR,
-                       _("Failed to set vcpus for domain '%d'"
-                         " with libxenlight"), dom->id);
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Failed to set vcpus for domain '%d'"
+                             " with libxenlight"), dom->id);
             goto cleanup;
         }
         def->vcpus = nvcpus;
@@ -2378,7 +2378,7 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
@@ -2391,22 +2391,22 @@ libxlDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
             flags |= VIR_DOMAIN_VCPU_CONFIG;
     }
     if ((flags & VIR_DOMAIN_VCPU_LIVE) && (flags & VIR_DOMAIN_VCPU_CONFIG)) {
-        libxlError(VIR_ERR_INVALID_ARG,
-                   _("invalid flag combination: (0x%x)"), flags);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("invalid flag combination: (0x%x)"), flags);
         return -1;
     }
 
     if (flags & VIR_DOMAIN_VCPU_LIVE) {
         if (!active) {
-            libxlError(VIR_ERR_OPERATION_INVALID,
-                       "%s", _("Domain is not running"));
+            virReportError(VIR_ERR_OPERATION_INVALID,
+                           "%s", _("Domain is not running"));
             goto cleanup;
         }
         def = vm->def;
     } else {
         if (!vm->persistent) {
-            libxlError(VIR_ERR_OPERATION_INVALID,
-                       "%s", _("domain is transient"));
+            virReportError(VIR_ERR_OPERATION_INVALID,
+                           "%s", _("domain is transient"));
             goto cleanup;
         }
         def = vm->newDef ? vm->newDef : vm->def;
@@ -2435,13 +2435,13 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap,
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("cannot pin vcpus on an inactive domain"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("cannot pin vcpus on an inactive domain"));
         goto cleanup;
     }
 
@@ -2450,14 +2450,14 @@ libxlDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, unsigned char *cpumap,
     map.size = maplen;
     map.map = cpumap;
     if (libxl_set_vcpuaffinity(&priv->ctx, dom->id, vcpu, &map) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to pin vcpu '%d' with libxenlight"), vcpu);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to pin vcpu '%d' with libxenlight"), vcpu);
         goto cleanup;
     }
 
     if (virDomainVcpuPinAdd(vm->def, cpumap, maplen, vcpu) < 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   "%s", _("failed to update or add vcpupin xml"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       "%s", _("failed to update or add vcpupin xml"));
         goto cleanup;
     }
 
@@ -2491,21 +2491,21 @@ libxlDomainGetVcpus(virDomainPtr dom, virVcpuInfoPtr info, int maxinfo,
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
 
     priv = vm->privateData;
     if ((vcpuinfo = libxl_list_vcpu(&priv->ctx, dom->id, &maxcpu,
                                     &hostcpus)) == NULL) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to list vcpus for domain '%d' with libxenlight"),
-                   dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to list vcpus for domain '%d' with libxenlight"),
+                       dom->id);
         goto cleanup;
     }
 
@@ -2554,8 +2554,8 @@ libxlDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s",
-                   _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s",
+                       _("no domain with matching uuid"));
         goto cleanup;
     }
 
@@ -2581,8 +2581,8 @@ libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
     virCheckFlags(0, NULL);
 
     if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
-        libxlError(VIR_ERR_INVALID_ARG,
-                   _("unsupported config type %s"), nativeFormat);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("unsupported config type %s"), nativeFormat);
         goto cleanup;
     }
 
@@ -2595,7 +2595,7 @@ libxlDomainXMLFromNative(virConnectPtr conn, const char * nativeFormat,
         goto cleanup;
 
     if (!(def = xenParseXM(conf, ver_info->xen_version_major, driver->caps))) {
-        libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("parsing xm config failed"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("parsing xm config failed"));
         goto cleanup;
     }
 
@@ -2624,8 +2624,8 @@ libxlDomainXMLToNative(virConnectPtr conn, const char * nativeFormat,
     virCheckFlags(0, NULL);
 
     if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
-        libxlError(VIR_ERR_INVALID_ARG,
-                   _("unsupported config type %s"), nativeFormat);
+        virReportError(VIR_ERR_INVALID_ARG,
+                       _("unsupported config type %s"), nativeFormat);
         goto cleanup;
     }
 
@@ -2699,14 +2699,14 @@ libxlDomainCreateWithFlags(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID,
-                   "%s", _("Domain is already running"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("Domain is already running"));
         goto cleanup;
     }
 
@@ -2795,14 +2795,14 @@ libxlDomainUndefineFlags(virDomainPtr dom,
         char uuidstr[VIR_UUID_STRING_BUFLEN];
 
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("no domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!vm->persistent) {
-        libxlError(VIR_ERR_OPERATION_INVALID,
-                   "%s", _("cannot undefine transient domain"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("cannot undefine transient domain"));
         goto cleanup;
     }
 
@@ -2813,14 +2813,14 @@ libxlDomainUndefineFlags(virDomainPtr dom,
     if (virFileExists(name)) {
         if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) {
             if (unlink(name) < 0) {
-                libxlError(VIR_ERR_INTERNAL_ERROR,
-                           _("Failed to remove domain managed save image"));
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("Failed to remove domain managed save image"));
                 goto cleanup;
             }
         } else {
-            libxlError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("Refusing to undefine while domain managed "
-                         "save image exists"));
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("Refusing to undefine while domain managed "
+                             "save image exists"));
             goto cleanup;
         }
     }
@@ -2876,16 +2876,16 @@ libxlDomainChangeEjectableMedia(libxlDomainObjPrivatePtr priv,
     }
 
     if (!origdisk) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("No device with bus '%s' and target '%s'"),
-                   virDomainDiskBusTypeToString(disk->bus), disk->dst);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("No device with bus '%s' and target '%s'"),
+                       virDomainDiskBusTypeToString(disk->bus), disk->dst);
         goto cleanup;
     }
 
     if (origdisk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Removable media not supported for %s device"),
-                   virDomainDiskDeviceTypeToString(disk->device));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Removable media not supported for %s device"),
+                       virDomainDiskDeviceTypeToString(disk->device));
         return -1;
     }
 
@@ -2893,9 +2893,9 @@ libxlDomainChangeEjectableMedia(libxlDomainObjPrivatePtr priv,
         goto cleanup;
 
     if ((ret = libxl_cdrom_insert(&priv->ctx, vm->def->id, &x_disk)) < 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("libxenlight failed to change media for disk '%s'"),
-                   disk->dst);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("libxenlight failed to change media for disk '%s'"),
+                       disk->dst);
         goto cleanup;
     }
 
@@ -2928,14 +2928,14 @@ libxlDomainAttachDeviceDiskLive(libxlDomainObjPrivatePtr priv,
         case VIR_DOMAIN_DISK_DEVICE_DISK:
             if (l_disk->bus == VIR_DOMAIN_DISK_BUS_XEN) {
                 if (virDomainDiskIndexByName(vm->def, l_disk->dst, true) >= 0) {
-                    libxlError(VIR_ERR_OPERATION_FAILED,
-                            _("target %s already exists"), l_disk->dst);
+                    virReportError(VIR_ERR_OPERATION_FAILED,
+                                   _("target %s already exists"), l_disk->dst);
                     goto cleanup;
                 }
 
                 if (!l_disk->src) {
-                    libxlError(VIR_ERR_INTERNAL_ERROR,
-                            "%s", _("disk source path is missing"));
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                                   "%s", _("disk source path is missing"));
                     goto cleanup;
                 }
 
@@ -2949,24 +2949,24 @@ libxlDomainAttachDeviceDiskLive(libxlDomainObjPrivatePtr priv,
 
                 if ((ret = libxl_device_disk_add(&priv->ctx, vm->def->id,
                                                 &x_disk)) < 0) {
-                    libxlError(VIR_ERR_INTERNAL_ERROR,
-                            _("libxenlight failed to attach disk '%s'"),
-                            l_disk->dst);
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                                   _("libxenlight failed to attach disk '%s'"),
+                                   l_disk->dst);
                     goto cleanup;
                 }
 
                 virDomainDiskInsertPreAlloced(vm->def, l_disk);
 
             } else {
-                libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
-                        _("disk bus '%s' cannot be hotplugged."),
-                        virDomainDiskBusTypeToString(l_disk->bus));
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("disk bus '%s' cannot be hotplugged."),
+                               virDomainDiskBusTypeToString(l_disk->bus));
             }
             break;
         default:
-            libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
-                    _("disk device type '%s' cannot be hotplugged"),
-                    virDomainDiskDeviceTypeToString(l_disk->device));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("disk device type '%s' cannot be hotplugged"),
+                           virDomainDiskDeviceTypeToString(l_disk->device));
             break;
     }
 
@@ -2991,8 +2991,8 @@ libxlDomainDetachDeviceDiskLive(libxlDomainObjPrivatePtr priv,
                 if ((i = virDomainDiskIndexByName(vm->def,
                                                   dev->data.disk->dst,
                                                   false)) < 0) {
-                    libxlError(VIR_ERR_OPERATION_FAILED,
-                               _("disk %s not found"), dev->data.disk->dst);
+                    virReportError(VIR_ERR_OPERATION_FAILED,
+                                   _("disk %s not found"), dev->data.disk->dst);
                     goto cleanup;
                 }
 
@@ -3003,9 +3003,9 @@ libxlDomainDetachDeviceDiskLive(libxlDomainObjPrivatePtr priv,
 
                 if ((ret = libxl_device_disk_del(&priv->ctx, &x_disk,
                                                  wait_secs)) < 0) {
-                    libxlError(VIR_ERR_INTERNAL_ERROR,
-                               _("libxenlight failed to detach disk '%s'"),
-                               l_disk->dst);
+                    virReportError(VIR_ERR_INTERNAL_ERROR,
+                                   _("libxenlight failed to detach disk '%s'"),
+                                   l_disk->dst);
                     goto cleanup;
                 }
 
@@ -3013,15 +3013,15 @@ libxlDomainDetachDeviceDiskLive(libxlDomainObjPrivatePtr priv,
                 virDomainDiskDefFree(l_disk);
 
             } else {
-                libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
-                        _("disk bus '%s' cannot be hot unplugged."),
-                        virDomainDiskBusTypeToString(dev->data.disk->bus));
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("disk bus '%s' cannot be hot unplugged."),
+                               virDomainDiskBusTypeToString(dev->data.disk->bus));
             }
             break;
         default:
-            libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("device type '%s' cannot hot unplugged"),
-                       virDomainDiskDeviceTypeToString(dev->data.disk->device));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("device type '%s' cannot hot unplugged"),
+                           virDomainDiskDeviceTypeToString(dev->data.disk->device));
             break;
     }
 
@@ -3043,9 +3043,9 @@ libxlDomainAttachDeviceLive(libxlDomainObjPrivatePtr priv, virDomainObjPtr vm,
             break;
 
         default:
-            libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("device type '%s' cannot be attached"),
-                       virDomainDeviceTypeToString(dev->type));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("device type '%s' cannot be attached"),
+                           virDomainDeviceTypeToString(dev->type));
             break;
     }
 
@@ -3061,8 +3061,8 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
         case VIR_DOMAIN_DEVICE_DISK:
             disk = dev->data.disk;
             if (virDomainDiskIndexByName(vmdef, disk->dst, true) >= 0) {
-                libxlError(VIR_ERR_INVALID_ARG,
-                        _("target %s already exists."), disk->dst);
+                virReportError(VIR_ERR_INVALID_ARG,
+                               _("target %s already exists."), disk->dst);
                 return -1;
             }
             if (virDomainDiskInsert(vmdef, disk)) {
@@ -3074,8 +3074,8 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
             break;
 
         default:
-            libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("persistent attach of device is not supported"));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("persistent attach of device is not supported"));
             return -1;
     }
     return 0;
@@ -3093,9 +3093,9 @@ libxlDomainDetachDeviceLive(libxlDomainObjPrivatePtr priv, virDomainObjPtr vm,
             break;
 
         default:
-            libxlError(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));
             break;
     }
 
@@ -3112,16 +3112,16 @@ libxlDomainDetachDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
         case VIR_DOMAIN_DEVICE_DISK:
             disk = dev->data.disk;
             if (!(detach = virDomainDiskRemoveByName(vmdef, disk->dst))) {
-                libxlError(VIR_ERR_INVALID_ARG,
-                            _("no target device %s"), disk->dst);
+                virReportError(VIR_ERR_INVALID_ARG,
+                               _("no target device %s"), disk->dst);
                 break;
             }
             virDomainDiskDefFree(detach);
             ret = 0;
             break;
         default:
-            libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("persistent detach of device is not supported"));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("persistent detach of device is not supported"));
             break;
     }
 
@@ -3145,16 +3145,16 @@ libxlDomainUpdateDeviceLive(libxlDomainObjPrivatePtr priv,
                         dev->data.disk = NULL;
                     break;
                 default:
-                    libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               _("disk bus '%s' cannot be updated."),
-                               virDomainDiskBusTypeToString(disk->bus));
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                                   _("disk bus '%s' cannot be updated."),
+                                   virDomainDiskBusTypeToString(disk->bus));
                     break;
             }
             break;
         default:
-            libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("device type '%s' cannot be updated"),
-                       virDomainDeviceTypeToString(dev->type));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("device type '%s' cannot be updated"),
+                           virDomainDeviceTypeToString(dev->type));
             break;
     }
 
@@ -3173,14 +3173,14 @@ libxlDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
         case VIR_DOMAIN_DEVICE_DISK:
             disk = dev->data.disk;
             if ((i = virDomainDiskIndexByName(vmdef, disk->dst, false)) < 0) {
-                libxlError(VIR_ERR_INVALID_ARG,
-                           _("target %s doesn't exist."), disk->dst);
+                virReportError(VIR_ERR_INVALID_ARG,
+                               _("target %s doesn't exist."), disk->dst);
                 goto cleanup;
             }
             orig = vmdef->disks[i];
             if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) {
-                libxlError(VIR_ERR_INVALID_ARG,
-                           _("this disk doesn't support update"));
+                virReportError(VIR_ERR_INVALID_ARG,
+                               _("this disk doesn't support update"));
                 goto cleanup;
             }
 
@@ -3200,8 +3200,8 @@ libxlDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
             disk->src = NULL;
             break;
         default:
-            libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("persistent update of device is not supported"));
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("persistent update of device is not supported"));
             goto cleanup;
     }
 
@@ -3236,7 +3236,7 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
@@ -3248,15 +3248,15 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
             flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
         /* check consistency between flags and the vm state */
         if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
-            libxlError(VIR_ERR_OPERATION_INVALID,
-                       "%s", _("Domain is not running"));
+            virReportError(VIR_ERR_OPERATION_INVALID,
+                           "%s", _("Domain is not running"));
             goto cleanup;
         }
     }
 
     if ((flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) && !vm->persistent) {
-         libxlError(VIR_ERR_OPERATION_INVALID,
-                    "%s", _("cannot modify device on transient domain"));
+         virReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("cannot modify device on transient domain"));
          goto cleanup;
     }
 
@@ -3281,8 +3281,8 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
             case LIBXL_DEVICE_UPDATE:
                 ret = libxlDomainUpdateDeviceConfig(vmdef, dev);
             default:
-                libxlError(VIR_ERR_INTERNAL_ERROR,
-                           _("unknown domain modify action %d"), action);
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("unknown domain modify action %d"), action);
                 break;
         }
     } else
@@ -3305,8 +3305,8 @@ libxlDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
             case LIBXL_DEVICE_UPDATE:
                 ret = libxlDomainUpdateDeviceLive(priv, vm, dev);
             default:
-                libxlError(VIR_ERR_INTERNAL_ERROR,
-                           _("unknown domain modify action %d"), action);
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("unknown domain modify action %d"), action);
                 break;
         }
         /*
@@ -3378,12 +3378,12 @@ libxlNodeGetFreeMemory(virConnectPtr conn)
     libxlDriverPrivatePtr driver = conn->privateData;
 
     if (libxl_get_physinfo(&driver->ctx, &phy_info)) {
-        libxlError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_physinfo_info failed"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_physinfo_info failed"));
         return 0;
     }
 
     if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) {
-        libxlError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_version_info failed"));
+        virReportError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_version_info failed"));
         return 0;
     }
 
@@ -3438,8 +3438,8 @@ libxlDomainGetAutostart(virDomainPtr dom, int *autostart)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3466,14 +3466,14 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart)
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        libxlError(VIR_ERR_NO_DOMAIN,
-                   _("No domain with matching uuid '%s'"), uuidstr);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("No domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!vm->persistent) {
-        libxlError(VIR_ERR_OPERATION_INVALID,
-                   "%s", _("cannot set autostart for transient domain"));
+        virReportError(VIR_ERR_OPERATION_INVALID,
+                       "%s", _("cannot set autostart for transient domain"));
         goto cleanup;
     }
 
@@ -3535,20 +3535,20 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
 
     priv = vm->privateData;
     if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to get scheduler id for domain '%d'"
-                     " with libxenlight"), dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to get scheduler id for domain '%d'"
+                         " with libxenlight"), dom->id);
         goto cleanup;
     }
 
@@ -3602,34 +3602,34 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom,
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
 
     priv = vm->privateData;
 
     if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to get scheduler id for domain '%d'"
-                     " with libxenlight"), dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to get scheduler id for domain '%d'"
+                         " with libxenlight"), dom->id);
         goto cleanup;
     }
 
     if (sched_id != XEN_SCHEDULER_CREDIT) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Only 'credit' scheduler is supported"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Only 'credit' scheduler is supported"));
         goto cleanup;
     }
 
     if (libxl_sched_credit_domain_get(&priv->ctx, dom->id, &sc_info) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to get scheduler parameters for domain '%d'"
-                     " with libxenlight"), dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to get scheduler parameters for domain '%d'"
+                         " with libxenlight"), dom->id);
         goto cleanup;
     }
 
@@ -3688,34 +3688,34 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
     libxlDriverUnlock(driver);
 
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+        virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
         goto cleanup;
     }
 
     priv = vm->privateData;
 
     if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to get scheduler id for domain '%d'"
-                     " with libxenlight"), dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to get scheduler id for domain '%d'"
+                         " with libxenlight"), dom->id);
         goto cleanup;
     }
 
     if (sched_id != XEN_SCHEDULER_CREDIT) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Only 'credit' scheduler is supported"));
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Only 'credit' scheduler is supported"));
         goto cleanup;
     }
 
     if (libxl_sched_credit_domain_get(&priv->ctx, dom->id, &sc_info) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to get scheduler parameters for domain '%d'"
-                     " with libxenlight"), dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to get scheduler parameters for domain '%d'"
+                         " with libxenlight"), dom->id);
         goto cleanup;
     }
 
@@ -3730,9 +3730,9 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
     }
 
     if (libxl_sched_credit_domain_set(&priv->ctx, dom->id, &sc_info) != 0) {
-        libxlError(VIR_ERR_INTERNAL_ERROR,
-                   _("Failed to set scheduler parameters for domain '%d'"
-                     " with libxenlight"), dom->id);
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("Failed to set scheduler parameters for domain '%d'"
+                         " with libxenlight"), dom->id);
         goto cleanup;
     }
 
@@ -3762,7 +3762,7 @@ libxlDomainIsActive(virDomainPtr dom)
     obj = virDomainFindByUUID(&driver->domains, dom->uuid);
     libxlDriverUnlock(driver);
     if (!obj) {
-        libxlError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN, NULL);
         goto cleanup;
     }
     ret = virDomainObjIsActive(obj);
@@ -3784,7 +3784,7 @@ libxlDomainIsPersistent(virDomainPtr dom)
     obj = virDomainFindByUUID(&driver->domains, dom->uuid);
     libxlDriverUnlock(driver);
     if (!obj) {
-        libxlError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN, NULL);
         goto cleanup;
     }
     ret = obj->persistent;
@@ -3806,7 +3806,7 @@ libxlDomainIsUpdated(virDomainPtr dom)
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
     libxlDriverUnlock(driver);
     if (!vm) {
-        libxlError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN, NULL);
         goto cleanup;
     }
     ret = vm->updated;
-- 
1.7.10.4

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


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