[libvirt] [PATCH] Replace VIR_ERROR with standard vir*Error in state driver init

Jovanka Gulicoska jovanka.gulicoska at gmail.com
Fri May 20 13:46:33 UTC 2016


Replace VIR_ERROR logging macros for error reporting with standard
vir*Error function, in driver startup routines.
---
 src/bhyve/bhyve_driver.c           |  5 +++--
 src/libxl/libxl_driver.c           |  6 ++---
 src/lxc/lxc_driver.c               |  2 +-
 src/node_device/node_device_hal.c  | 19 ++++++++--------
 src/node_device/node_device_udev.c | 32 +++++++++++++-------------
 src/nwfilter/nwfilter_driver.c     |  4 ++--
 src/qemu/qemu_driver.c             | 43 ++++++++++++++++++-----------------
 src/storage/storage_driver.c       | 46 +++++++++++++++++++-------------------
 src/uml/uml_driver.c               | 21 ++++++++---------
 src/xen/xen_driver.c               |  5 +++--
 10 files changed, 95 insertions(+), 88 deletions(-)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index c58286f..a31b0e6 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -88,8 +88,9 @@ bhyveAutostartDomain(virDomainObjPtr vm, void *opaque)
         ret = virBhyveProcessStart(data->conn, data->driver, vm,
                                    VIR_DOMAIN_RUNNING_BOOTED, 0);
         if (ret < 0) {
-            VIR_ERROR(_("Failed to autostart VM '%s': %s"),
-                      vm->def->name, virGetLastErrorMessage());
+            virReportSystemError(errno, _("Failed to autostart VM '%s': %s"),
+                                 vm->def->name,
+                                 virGetLastErrorMessage());
         }
     }
     virObjectUnlock(vm);
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index b8b4c24..2ec24b4 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -319,9 +319,9 @@ libxlAutostartDomain(virDomainObjPtr vm,
 
     if (vm->autostart && !virDomainObjIsActive(vm) &&
         libxlDomainStartNew(driver, vm, false) < 0) {
-        VIR_ERROR(_("Failed to autostart VM '%s': %s"),
-                  vm->def->name,
-                  virGetLastErrorMessage());
+        virReportSystemError(errno, _("Failed to autostart VM '%s': %s"),
+                             vm->def->name,
+                             virGetLastErrorMessage());
         goto endjob;
     }
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 7cdea2c..9efa8ca 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1628,7 +1628,7 @@ lxcSecurityInit(virLXCDriverConfigPtr cfg)
     return mgr;
 
  error:
-    VIR_ERROR(_("Failed to initialize security drivers"));
+    virReportSystemError(errno, "%s", _("Failed to initialize security drivers"));
     virObjectUnref(mgr);
     return NULL;
 }
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 6ddfad0..908ed92 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -641,24 +641,25 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
 
     dbus_error_init(&err);
     if (!(sysbus = virDBusGetSystemBus())) {
-        VIR_ERROR(_("DBus not available, disabling HAL driver: %s"),
-                    virGetLastErrorMessage());
+        virReportSystemError(errno, _("DBus not available, disabling HAL driver: %s"),
+                             virGetLastErrorMessage());
         ret = 0;
         goto failure;
     }
 
     hal_ctx = libhal_ctx_new();
     if (hal_ctx == NULL) {
-        VIR_ERROR(_("libhal_ctx_new returned NULL"));
+        virReportSystemError(errno, "%s", _("libhal_ctx_new returned NULL"));
         goto failure;
     }
 
     if (!libhal_ctx_set_dbus_connection(hal_ctx, sysbus)) {
-        VIR_ERROR(_("libhal_ctx_set_dbus_connection failed"));
+        virReportSystemError(errno, "%s", _("libhal_ctx_set_dbus_connection failed"));
         goto failure;
     }
     if (!libhal_ctx_init(hal_ctx, &err)) {
-        VIR_ERROR(_("libhal_ctx_init failed, haldaemon is probably not running"));
+        virReportSystemError(errno, "%s",
+                             _("libhal_ctx_init failed, haldaemon is probably not running"));
         /* We don't want to show a fatal error here,
            otherwise entire libvirtd shuts down when
            hald isn't running */
@@ -683,13 +684,13 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
         !libhal_ctx_set_device_lost_capability(hal_ctx, device_cap_lost) ||
         !libhal_ctx_set_device_property_modified(hal_ctx, device_prop_modified) ||
         !libhal_device_property_watch_all(hal_ctx, &err)) {
-        VIR_ERROR(_("setting up HAL callbacks failed"));
+        virReportSystemError(errno, "%s", _("setting up HAL callbacks failed"));
         goto failure;
     }
 
     udi = libhal_get_all_devices(hal_ctx, &num_devs, &err);
     if (udi == NULL) {
-        VIR_ERROR(_("libhal_get_all_devices failed"));
+        virReportSystemError(errno, "%s", _("libhal_get_all_devices failed"));
         goto failure;
     }
     for (i = 0; i < num_devs; i++) {
@@ -702,7 +703,7 @@ nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED,
 
  failure:
     if (dbus_error_is_set(&err)) {
-        VIR_ERROR(_("%s: %s"), err.name, err.message);
+        virReportSystemError(errno, _("%s: %s"), err.name, err.message);
         dbus_error_free(&err);
     }
     virNodeDeviceObjListFree(&driver->devs);
@@ -753,7 +754,7 @@ nodeStateReload(void)
     dbus_error_init(&err);
     udi = libhal_get_all_devices(hal_ctx, &num_devs, &err);
     if (udi == NULL) {
-        VIR_ERROR(_("libhal_get_all_devices failed"));
+        virReportSystemError(errno, "%s", _("libhal_get_all_devices failed"));
         return -1;
     }
     for (i = 0; i < num_devs; i++) {
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 6bff5ba..65c8278 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -66,7 +66,7 @@ static int udevStrToLong_ull(char const *s,
 
     ret = virStrToLong_ull(s, end_ptr, base, result);
     if (ret != 0) {
-        VIR_ERROR(_("Failed to convert '%s' to unsigned long long"), s);
+        virReportSystemError(errno, _("Failed to convert '%s' to unsigned long long"), s);
     } else {
         VIR_DEBUG("Converted '%s' to unsigned long %llu", s, *result);
     }
@@ -84,7 +84,7 @@ static int udevStrToLong_ui(char const *s,
 
     ret = virStrToLong_ui(s, end_ptr, base, result);
     if (ret != 0) {
-        VIR_ERROR(_("Failed to convert '%s' to unsigned int"), s);
+        virReportSystemError(errno, _("Failed to convert '%s' to unsigned int"), s);
     } else {
         VIR_DEBUG("Converted '%s' to unsigned int %u", s, *result);
     }
@@ -101,7 +101,7 @@ static int udevStrToLong_i(char const *s,
 
     ret = virStrToLong_i(s, end_ptr, base, result);
     if (ret != 0) {
-        VIR_ERROR(_("Failed to convert '%s' to int"), s);
+        virReportSystemError(errno, _("Failed to convert '%s' to int"), s);
     } else {
         VIR_DEBUG("Converted '%s' to int %u", s, *result);
     }
@@ -716,7 +716,7 @@ static int udevProcessSCSIHost(struct udev_device *device ATTRIBUTE_UNUSED,
     filename = last_component(def->sysfs_path);
 
     if (!STRPREFIX(filename, "host")) {
-        VIR_ERROR(_("SCSI host found, but its udev name '%s' does "
+        virReportSystemError(errno, _("SCSI host found, but its udev name '%s' does "
                     "not begin with 'host'"), filename);
         goto out;
     }
@@ -874,8 +874,8 @@ static int udevProcessSCSIDevice(struct udev_device *device ATTRIBUTE_UNUSED,
 
  out:
     if (ret != 0) {
-        VIR_ERROR(_("Failed to process SCSI device with sysfs path '%s'"),
-                  def->sysfs_path);
+        virReportSystemError(errno, _("Failed to process SCSI device with sysfs path '%s'"),
+                             def->sysfs_path);
     }
     return ret;
 }
@@ -1292,7 +1292,7 @@ static int udevGetDeviceDetails(struct udev_device *device,
         ret = udevProcessSCSIGeneric(device, def);
         break;
     default:
-        VIR_ERROR(_("Unknown device type %d"), def->caps->data.type);
+        virReportSystemError(errno, _("Unknown device type %d"), def->caps->data.type);
         ret = -1;
         break;
     }
@@ -1458,7 +1458,7 @@ static int udevEnumerateDevices(struct udev *udev)
 
     ret = udev_enumerate_scan_devices(udev_enumerate);
     if (0 != ret) {
-        VIR_ERROR(_("udev scan devices returned %d"), ret);
+        virReportSystemError(errno, _("udev scan devices returned %d"), ret);
         goto out;
     }
 
@@ -1533,14 +1533,14 @@ static void udevEventHandleCallback(int watch ATTRIBUTE_UNUSED,
     nodeDeviceLock();
     udev_fd = udev_monitor_get_fd(udev_monitor);
     if (fd != udev_fd) {
-        VIR_ERROR(_("File descriptor returned by udev %d does not "
-                    "match node device file descriptor %d"), fd, udev_fd);
+        virReportSystemError(errno, _("File descriptor returned by udev %d does not "
+                             "match node device file descriptor %d"), fd, udev_fd);
         goto out;
     }
 
     device = udev_monitor_receive_device(udev_monitor);
     if (device == NULL) {
-        VIR_ERROR(_("udev_monitor_receive_device returned NULL"));
+        virReportSystemError(errno, "%s", _("udev_monitor_receive_device returned NULL"));
         goto out;
     }
 
@@ -1579,7 +1579,7 @@ udevGetDMIData(virNodeDevCapDataPtr data)
     if (device == NULL) {
         device = udev_device_new_from_syspath(udev, DMI_DEVPATH_FALLBACK);
         if (device == NULL) {
-            VIR_ERROR(_("Failed to get udev device for syspath '%s' or '%s'"),
+            virReportSystemError(errno, _("Failed to get udev device for syspath '%s' or '%s'"),
                       DMI_DEVPATH, DMI_DEVPATH_FALLBACK);
             goto out;
         }
@@ -1694,8 +1694,8 @@ static int nodeStateInitialize(bool privileged,
          * from udev in the first place.  */
         if (errno != ENOENT && (privileged  || errno != EACCES)) {
             char ebuf[256];
-            VIR_ERROR(_("Failed to initialize libpciaccess: %s"),
-                      virStrerror(pciret, ebuf, sizeof(ebuf)));
+            virReportSystemError(errno, _("Failed to initialize libpciaccess: %s"),
+                                 virStrerror(pciret, ebuf, sizeof(ebuf)));
             ret = -1;
             goto out;
         }
@@ -1717,7 +1717,7 @@ static int nodeStateInitialize(bool privileged,
     }
 
     if (virMutexInit(&driver->lock) < 0) {
-        VIR_ERROR(_("Failed to initialize mutex for driver"));
+        virReportSystemError(errno, "%s", _("Failed to initialize mutex for driver"));
         VIR_FREE(priv);
         VIR_FREE(driver);
         ret = -1;
@@ -1741,7 +1741,7 @@ static int nodeStateInitialize(bool privileged,
     priv->udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
     if (priv->udev_monitor == NULL) {
         VIR_FREE(priv);
-        VIR_ERROR(_("udev_monitor_new_from_netlink returned NULL"));
+        virReportSystemError(errno, "%s", _("udev_monitor_new_from_netlink returned NULL"));
         ret = -1;
         goto out_unlock;
     }
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 2828b28..c09d7ef 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -215,8 +215,8 @@ nwfilterStateInitialize(bool privileged,
      */
     if (sysbus &&
         nwfilterDriverInstallDBusMatches(sysbus) < 0) {
-        VIR_ERROR(_("DBus matches could not be installed. Disabling nwfilter "
-                  "driver"));
+        virReportSystemError(errno, "%s", _("DBus matches could not be installed. "
+                             "Disabling nwfilter driver"));
         /*
          * unfortunately this is fatal since virNWFilterTechDriversInit
          * may have caused the ebiptables driver to use the firewall tool
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 249393a..e8c17dc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -290,15 +290,15 @@ qemuAutostartDomain(virDomainObjPtr vm,
     if (vm->autostart &&
         !virDomainObjIsActive(vm)) {
         if (qemuProcessBeginJob(data->driver, vm) < 0) {
-            VIR_ERROR(_("Failed to start job on VM '%s': %s"),
-                      vm->def->name, virGetLastErrorMessage());
+            virReportSystemError(errno, _("Failed to start job on VM '%s': %s"),
+                                 vm->def->name, virGetLastErrorMessage());
             goto cleanup;
         }
 
         if (qemuDomainObjStart(data->conn, data->driver, vm, flags,
                                QEMU_ASYNC_JOB_START) < 0) {
-            VIR_ERROR(_("Failed to autostart VM '%s': %s"),
-                      vm->def->name, virGetLastErrorMessage());
+            virReportSystemError(errno, _("Failed to autostart VM '%s': %s"),
+                                 vm->def->name, virGetLastErrorMessage());
         }
 
         qemuProcessEndJob(data->driver, vm);
@@ -450,7 +450,7 @@ qemuSecurityInit(virQEMUDriverPtr driver)
     return 0;
 
  error:
-    VIR_ERROR(_("Failed to initialize security drivers"));
+    virReportSystemError(errno, "%s", _("Failed to initialize security drivers"));
     virObjectUnref(stack);
     virObjectUnref(mgr);
     virObjectUnref(cfg);
@@ -481,8 +481,9 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
 
     virObjectLock(vm);
     if (virAsprintf(&snapDir, "%s/%s", baseDir, vm->def->name) < 0) {
-        VIR_ERROR(_("Failed to allocate memory for snapshot directory for domain %s"),
-                   vm->def->name);
+        virReportSystemError(errno, _("Failed to allocate memory for snapshot directory "
+                             "for domain %s"),
+                             vm->def->name);
         goto cleanup;
     }
 
@@ -494,9 +495,10 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
 
     if (!(dir = opendir(snapDir))) {
         if (errno != ENOENT)
-            VIR_ERROR(_("Failed to open snapshot directory %s for domain %s: %s"),
-                      snapDir, vm->def->name,
-                      virStrerror(errno, ebuf, sizeof(ebuf)));
+            virReportSystemError(errno, _("Failed to open snapshot directory %s "
+                                 "for domain %s: %s"),
+                                 snapDir, vm->def->name,
+                                 virStrerror(errno, ebuf, sizeof(ebuf)));
         goto cleanup;
     }
 
@@ -509,14 +511,15 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
         VIR_INFO("Loading snapshot file '%s'", entry->d_name);
 
         if (virAsprintf(&fullpath, "%s/%s", snapDir, entry->d_name) < 0) {
-            VIR_ERROR(_("Failed to allocate memory for path"));
+            virReportSystemError(errno, "%s", _("Failed to allocate memory for path"));
             continue;
         }
 
         if (virFileReadAll(fullpath, 1024*1024*1, &xmlStr) < 0) {
             /* Nothing we can do here, skip this one */
-            VIR_ERROR(_("Failed to read snapshot file %s: %s"), fullpath,
-                      virStrerror(errno, ebuf, sizeof(ebuf)));
+            virReportSystemError(errno, _("Failed to read snapshot file %s: %s"),
+                                 fullpath,
+                                 virStrerror(errno, ebuf, sizeof(ebuf)));
             VIR_FREE(fullpath);
             continue;
         }
@@ -526,8 +529,8 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
                                               flags);
         if (def == NULL) {
             /* Nothing we can do here, skip this one */
-            VIR_ERROR(_("Failed to parse snapshot XML from file '%s'"),
-                      fullpath);
+            virReportSystemError(errno, _("Failed to parse snapshot XML from file '%s'"),
+                                 fullpath);
             VIR_FREE(fullpath);
             VIR_FREE(xmlStr);
             continue;
@@ -546,17 +549,17 @@ qemuDomainSnapshotLoad(virDomainObjPtr vm,
         VIR_FREE(xmlStr);
     }
     if (direrr < 0)
-        VIR_ERROR(_("Failed to fully read directory %s"), snapDir);
+        virReportSystemError(errno, _("Failed to fully read directory %s"), snapDir);
 
     if (vm->current_snapshot != current) {
-        VIR_ERROR(_("Too many snapshots claiming to be current for domain %s"),
-                  vm->def->name);
+        virReportSystemError(errno, _("Too many snapshots claiming to be current for domain %s"),
+                             vm->def->name);
         vm->current_snapshot = NULL;
     }
 
     if (virDomainSnapshotUpdateRelations(vm->snapshots) < 0)
-        VIR_ERROR(_("Snapshots have inconsistent relations for domain %s"),
-                  vm->def->name);
+        virReportSystemError(errno, _("Snapshots have inconsistent relations for domain %s"),
+                             vm->def->name);
 
     /* FIXME: qemu keeps internal track of snapshots.  We can get access
      * to this info via the "info snapshots" monitor command for running
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index ce31e38..f717e27 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -88,7 +88,8 @@ storagePoolUpdateState(virStoragePoolObjPtr pool)
         goto error;
 
     if ((backend = virStorageBackendForType(pool->def->type)) == NULL) {
-        VIR_ERROR(_("Missing backend %d"), pool->def->type);
+        virReportSystemError(errno, _("Missing backend %d"),
+                             pool->def->type);
         goto error;
     }
 
@@ -98,8 +99,10 @@ storagePoolUpdateState(virStoragePoolObjPtr pool)
     active = false;
     if (backend->checkPool &&
         backend->checkPool(pool, &active) < 0) {
-        VIR_ERROR(_("Failed to initialize storage pool '%s': %s"),
-                  pool->def->name, virGetLastErrorMessage());
+
+        virReportSystemError(errno, _("Failed to initialize storage pool '%s': %s"),
+                             pool->def->name,
+                             virGetLastErrorMessage());
         goto error;
     }
 
@@ -112,8 +115,10 @@ storagePoolUpdateState(virStoragePoolObjPtr pool)
         if (backend->refreshPool(NULL, pool) < 0) {
             if (backend->stopPool)
                 backend->stopPool(NULL, pool);
-            VIR_ERROR(_("Failed to restart storage pool '%s': %s"),
-                      pool->def->name, virGetLastErrorMessage());
+
+            virReportSystemError(errno, _("Failed to restart storage pool '%s': %s"),
+                                 pool->def->name,
+                                 virGetLastErrorMessage());
             goto error;
         }
     }
@@ -172,8 +177,9 @@ storageDriverAutostart(void)
             !virStoragePoolObjIsActive(pool)) {
             if (backend->startPool &&
                 backend->startPool(conn, pool) < 0) {
-                VIR_ERROR(_("Failed to autostart storage pool '%s': %s"),
-                          pool->def->name, virGetLastErrorMessage());
+                virReportSystemError(errno, _("Failed to autostart storage pool '%s': %s"),
+                                     pool->def->name,
+                                     virGetLastErrorMessage());
                 virStoragePoolObjUnlock(pool);
                 continue;
             }
@@ -193,8 +199,10 @@ storageDriverAutostart(void)
                     unlink(stateFile);
                 if (backend->stopPool)
                     backend->stopPool(conn, pool);
-                VIR_ERROR(_("Failed to autostart storage pool '%s': %s"),
-                          pool->def->name, virGetLastErrorMessage());
+
+                virReportSystemError(errno, _("Failed to autostart storage pool '%s': %s"),
+                                     pool->def->name,
+                                     virGetLastErrorMessage());
             } else {
                 pool->active = true;
             }
@@ -719,7 +727,6 @@ storagePoolCreateXML(virConnectPtr conn,
     stateFile = virFileBuildPath(driver->stateDir,
                                  pool->def->name, ".xml");
 
-    virStoragePoolObjClearVols(pool);
     if (!stateFile || virStoragePoolSaveState(stateFile, pool->def) < 0 ||
         backend->refreshPool(conn, pool) < 0) {
         if (stateFile)
@@ -835,8 +842,9 @@ storagePoolUndefine(virStoragePoolPtr obj)
         errno != ENOENT &&
         errno != ENOTDIR) {
         char ebuf[1024];
-        VIR_ERROR(_("Failed to delete autostart link '%s': %s"),
-                  pool->autostartLink, virStrerror(errno, ebuf, sizeof(ebuf)));
+        virReportSystemError(errno, _("Failed to delete autostart link '%s': %s"),
+                             pool->autostartLink,
+                             virStrerror(errno, ebuf, sizeof(ebuf)));
     }
 
     VIR_FREE(pool->configFile);
@@ -911,7 +919,6 @@ storagePoolCreate(virStoragePoolPtr obj,
     stateFile = virFileBuildPath(driver->stateDir,
                                  pool->def->name, ".xml");
 
-    virStoragePoolObjClearVols(pool);
     if (!stateFile || virStoragePoolSaveState(stateFile, pool->def) < 0 ||
         backend->refreshPool(obj->conn, pool) < 0) {
         if (stateFile)
@@ -2033,13 +2040,6 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
     if (newvol->target.capacity < origvol->target.capacity)
         newvol->target.capacity = origvol->target.capacity;
 
-    /* If the allocation was not provided in the XML, then use capacity
-     * as it's specifically documented "If omitted when creating a volume,
-     * the  volume will be fully allocated at time of creation.". This
-     * is especially important for logical volume creation. */
-    if (!newvol->target.has_allocation)
-        newvol->target.allocation = newvol->target.capacity;
-
     if (!backend->buildVolFrom) {
         virReportError(VIR_ERR_NO_SUPPORT,
                        "%s", _("storage pool does not support"
@@ -2220,7 +2220,7 @@ virStorageBackendPloopRestoreDesc(char *path)
     if (virFileRemove(desc, 0, 0) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                        _("refresh ploop failed:"
-                         " unable to delete DiskDescriptor.xml"));
+                         " unuble to delete DiskDescriptor.xml"));
         goto cleanup;
     }
 
@@ -2301,7 +2301,8 @@ virStorageVolFDStreamCloseCb(virStreamPtr st ATTRIBUTE_UNUSED,
     if (virThreadCreate(&thread, false, virStorageVolPoolRefreshThread,
                         opaque) < 0) {
         /* Not much else can be done */
-        VIR_ERROR(_("Failed to create thread to handle pool refresh"));
+        virReportSystemError(errno, "%s",
+                             _("Failed to create thread to handle pool refresh"));
         goto error;
     }
     return; /* Thread will free opaque data */
@@ -2357,7 +2358,6 @@ storageVolUpload(virStorageVolPtr obj,
      * interaction and we can just lookup the backend in the callback
      * routine in order to call the refresh API.
      */
-    virStoragePoolObjClearVols(pool);
     if (backend->refreshPool) {
         if (VIR_ALLOC(cbdata) < 0 ||
             VIR_STRDUP(cbdata->pool_name, pool->def->name) < 0)
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 923c3f6..2822e88 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -188,8 +188,9 @@ umlAutostartDomain(virDomainObjPtr vm,
         ret = umlStartVMDaemon(data->conn, data->driver, vm, false);
         virDomainAuditStart(vm, "booted", ret >= 0);
         if (ret < 0) {
-            VIR_ERROR(_("Failed to autostart VM '%s': %s"),
-                      vm->def->name, virGetLastErrorMessage());
+            virReportSystemError(errno, _("Failed to autostart VM '%s': %s"),
+                                 vm->def->name,
+                                 virGetLastErrorMessage());
         } else {
             virObjectEventPtr event =
                 virDomainEventLifecycleNewFromObj(vm,
@@ -535,15 +536,15 @@ umlStateInitialize(bool privileged,
         goto error;
 
     if ((uml_driver->inotifyFD = inotify_init()) < 0) {
-        VIR_ERROR(_("cannot initialize inotify"));
+        virReportSystemError(errno, "%s", _("cannot initialize inotify"));
         goto error;
     }
 
     if (virFileMakePath(uml_driver->monitorDir) < 0) {
         char ebuf[1024];
-        VIR_ERROR(_("Failed to create monitor directory %s: %s"),
-                  uml_driver->monitorDir,
-                  virStrerror(errno, ebuf, sizeof(ebuf)));
+        virReportSystemError(errno, _("Failed to create monitor directory %s: %s"),
+                             uml_driver->monitorDir,
+                             virStrerror(errno, ebuf, sizeof(ebuf)));
         goto error;
     }
 
@@ -552,9 +553,9 @@ umlStateInitialize(bool privileged,
                           uml_driver->monitorDir,
                           IN_CREATE | IN_MODIFY | IN_DELETE) < 0) {
         char ebuf[1024];
-        VIR_ERROR(_("Failed to create inotify watch on %s: %s"),
-                  uml_driver->monitorDir,
-                  virStrerror(errno, ebuf, sizeof(ebuf)));
+        virReportSystemError(errno, _("Failed to create inotify watch on %s: %s"),
+                             uml_driver->monitorDir,
+                             virStrerror(errno, ebuf, sizeof(ebuf)));
         goto error;
     }
 
@@ -582,7 +583,7 @@ umlStateInitialize(bool privileged,
     return 0;
 
  out_of_memory:
-    VIR_ERROR(_("umlStartup: out of memory"));
+    virReportSystemError(errno, "%s", _("umlStartup: out of memory"));
 
  error:
     VIR_FREE(userdir);
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 3f5d80d..cc5c92d 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -532,8 +532,9 @@ xenUnifiedConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int f
         goto error;
 
     if (virFileMakePath(priv->saveDir) < 0) {
-        VIR_ERROR(_("Errored to create save dir '%s': %s"), priv->saveDir,
-                  virStrerror(errno, ebuf, sizeof(ebuf)));
+        virReportSystemError(errno, _("Errored to create save dir '%s': %s"),
+                             priv->saveDir,
+                             virStrerror(errno, ebuf, sizeof(ebuf)));
         goto error;
     }
 
-- 
2.5.5




More information about the libvir-list mailing list