[PATCH v2] qemu: Don't duplicate virGetLastErrorMessage

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

 



These uses of virGetLastError message are just duplicating
virGetLastErrorMessage.
---
 src/qemu/qemu_capabilities.c | 14 ++++----------
 src/qemu/qemu_driver.c       |  9 ++-------
 2 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b223837..2823843 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3089,10 +3089,8 @@ virQEMUCapsInitCached(virQEMUCapsPtr qemuCaps, const char *cacheDir)
 
     if (virQEMUCapsLoadCache(qemuCaps, capsfile, &qemuctime, &selfctime,
                              &selfvers) < 0) {
-        virErrorPtr err = virGetLastError();
         VIR_WARN("Failed to load cached caps from '%s' for '%s': %s",
-                 capsfile, qemuCaps->binary, err ? NULLSTR(err->message) :
-                 _("unknown error"));
+                 capsfile, qemuCaps->binary, virGetLastErrorMessage());
         virResetLastError();
         ret = 0;
         virQEMUCapsReset(qemuCaps);
@@ -3320,9 +3318,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
     /* @mon is supposed to be locked by callee */
 
     if (qemuMonitorSetCapabilities(mon) < 0) {
-        virErrorPtr err = virGetLastError();
         VIR_DEBUG("Failed to set monitor capabilities %s",
-                  err ? err->message : "<unknown problem>");
+                  virGetLastErrorMessage());
         ret = 0;
         goto cleanup;
     }
@@ -3330,9 +3327,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
     if (qemuMonitorGetVersion(mon,
                               &major, &minor, &micro,
                               &package) < 0) {
-        virErrorPtr err = virGetLastError();
         VIR_DEBUG("Failed to query monitor version %s",
-                  err ? err->message : "<unknown problem>");
+                  virGetLastErrorMessage());
         ret = 0;
         goto cleanup;
     }
@@ -3561,15 +3557,13 @@ virQEMUCapsLogProbeFailure(const char *binary)
         { .key = "LIBVIRT_QEMU_BINARY", .s = binary, .iv = 0 },
         { .key = NULL },
     };
-    virErrorPtr err = virGetLastError();
 
     virLogMessage(&virLogSelf,
                   VIR_LOG_WARN,
                   __FILE__, __LINE__, __func__,
                   meta,
                   _("Failed to probe capabilities for %s: %s"),
-                  binary, err && err->message ? err->message :
-                  _("unknown failure"));
+                  binary, virGetLastErrorMessage());
 }
 
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 29c3bc8..6e0e19e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -277,7 +277,6 @@ qemuAutostartDomain(virDomainObjPtr vm,
                     void *opaque)
 {
     struct qemuAutostartData *data = opaque;
-    virErrorPtr err;
     int flags = 0;
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(data->driver);
     int ret = -1;
@@ -291,19 +290,15 @@ qemuAutostartDomain(virDomainObjPtr vm,
     if (vm->autostart &&
         !virDomainObjIsActive(vm)) {
         if (qemuProcessBeginJob(data->driver, vm) < 0) {
-            err = virGetLastError();
             VIR_ERROR(_("Failed to start job on VM '%s': %s"),
-                      vm->def->name,
-                      err ? err->message : _("unknown error"));
+                      vm->def->name, virGetLastErrorMessage());
             goto cleanup;
         }
 
         if (qemuDomainObjStart(data->conn, data->driver, vm, flags,
                                QEMU_ASYNC_JOB_START) < 0) {
-            err = virGetLastError();
             VIR_ERROR(_("Failed to autostart VM '%s': %s"),
-                      vm->def->name,
-                      err ? err->message : _("unknown error"));
+                      vm->def->name, virGetLastErrorMessage());
         }
 
         qemuProcessEndJob(data->driver, vm);
-- 
2.5.0

--
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]