[PATCH 2/2] virsh: Fix error resetting on fallback paths

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

 



On some fallback paths in virsh, error reported by the previously failed
API is cleared by virResetLastError() that doesn'd free error stored by
virsh. This patch changes this to clear it using vshResetLibvirtError().
---
 tools/virsh-domain-monitor.c |    4 ++--
 tools/virsh-domain.c         |    2 +-
 tools/virsh-snapshot.c       |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 65a9808..151a8d0 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -66,7 +66,7 @@ vshGetDomainDescription(vshControl *ctl, virDomainPtr dom, bool title,

         if (err && err->code == VIR_ERR_NO_DOMAIN_METADATA) {
             desc = vshStrdup(ctl, "");
-            virResetLastError();
+            vshResetLibvirtError();
             return desc;
         }

@@ -1362,7 +1362,7 @@ vshDomainListCollect(vshControl *ctl, unsigned int flags)

 fallback:
     /* fall back to old method (0.9.12 and older) */
-    virResetLastError();
+    vshResetLibvirtError();

     /* list active domains, if necessary */
     if (!MATCH(VIR_CONNECT_LIST_FILTERS_ACTIVE) ||
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 62d8c27..7a3c919 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2523,7 +2523,7 @@ out:
                 vshPrint(ctl,
                          _("Storage volume '%s'(%s) is not managed by libvirt. "
                            "Remove it manually.\n"), target, source);
-                virResetLastError();
+                vshResetLibvirtError();
                 continue;
             }

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 92f0d6c..d6de3da 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -704,7 +704,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd)
     if (current < 0) {
         virDomainSnapshotPtr other = virDomainSnapshotCurrent(dom, 0);

-        virResetLastError();
+        vshResetLibvirtError();
         current = 0;
         if (other) {
             if (STREQ(name, virDomainSnapshotGetName(other)))
@@ -759,7 +759,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd)
     if (metadata < 0) {
         metadata = virDomainSnapshotNum(dom,
                                         VIR_DOMAIN_SNAPSHOT_LIST_METADATA);
-        virResetLastError();
+        vshResetLibvirtError();
     }
     if (metadata >= 0)
         vshPrint(ctl, "%-15s %s\n", _("Metadata:"),
-- 
1.7.8.6

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