[PATCH] virsh: fix output the incorrect error after try failed

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

 



https://bugzilla.redhat.com/show_bug.cgi?id=1254152

When we use some virsh cmd which need specify domain
name/id/uuid, if the command get failure we will get error
like this:

 # virsh domif-setlink 123 vnet1 up
 error: interface (target: vnet1) not found
 error: Domain not found: no domain with matching id 123

The second line should be reset after call virshLookupDomainInternal,
because after some tries we get domain pointer, so output error
during we tried will make user confuse.

Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
---
 tools/virsh-domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 173bb15..69c5562 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -98,6 +98,8 @@ virshLookupDomainInternal(vshControl *ctl,
         dom = virDomainLookupByName(priv->conn, name);
     }
 
+    vshResetLibvirtError();
+
     if (!dom)
         vshError(ctl, _("failed to get domain '%s'"), name);
 
-- 
1.8.3.1

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