[libvirt] [PATCH 05/12] virsh: net-port-create: log errors for non-existent xml file

Lin Ma posted 12 patches 5 years, 5 months ago
There is a newer version of this series
[libvirt] [PATCH 05/12] virsh: net-port-create: log errors for non-existent xml file
Posted by Lin Ma 5 years, 5 months ago
Signed-off-by: Lin Ma <lma@suse.de>
---
 tools/virsh-network.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index f0f5358625..ce67e3f19b 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -1522,6 +1522,7 @@ cmdNetworkPortCreate(vshControl *ctl, const vshCmd *cmd)
 
     ret = true;
  cleanup:
+    vshReportError(ctl);
     VIR_FREE(buffer);
     if (port)
         virNetworkPortFree(port);
-- 
2.26.0

Re: [libvirt] [PATCH 05/12] virsh: net-port-create: log errors for non-existent xml file
Posted by Ján Tomko 5 years, 4 months ago
On a Friday in 2020, Lin Ma wrote:
>Signed-off-by: Lin Ma <lma@suse.de>
>---
> tools/virsh-network.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/tools/virsh-network.c b/tools/virsh-network.c
>index f0f5358625..ce67e3f19b 100644
>--- a/tools/virsh-network.c
>+++ b/tools/virsh-network.c
>@@ -1522,6 +1522,7 @@ cmdNetworkPortCreate(vshControl *ctl, const vshCmd *cmd)
>
>     ret = true;
>  cleanup:
>+    vshReportError(ctl);

vshReportError is already called in vshCommandRun,
all that's needed here is a vshSaveLibvirtError call, before
the error gets reset by virNetwork*Free APIs

Jano

>     VIR_FREE(buffer);
>     if (port)
>         virNetworkPortFree(port);
>-- 
>2.26.0
>