|
|
99cbc7 |
From 299fe2bb28582a9e26453355909ee5132c374936 Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <299fe2bb28582a9e26453355909ee5132c374936@dist-git>
|
|
|
99cbc7 |
From: Laine Stump <laine@laine.org>
|
|
|
99cbc7 |
Date: Thu, 2 May 2019 13:23:35 -0400
|
|
|
99cbc7 |
Subject: [PATCH] util: suppress unimportant ovs-vsctl errors when getting
|
|
|
99cbc7 |
interface stats
|
|
|
99cbc7 |
|
|
|
99cbc7 |
commit edaf13565 modified the stats retrieval for OVS interfaces to
|
|
|
99cbc7 |
not fail when one of the fields was unrecognized by the ovs-vsctl
|
|
|
99cbc7 |
command, but ovs-vsctl was still returning an error, and libvirt was
|
|
|
99cbc7 |
cluttering the logs with these inconsequential error messages.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
This patch modifies the GET_STAT macro to add "--if-exists" to the
|
|
|
99cbc7 |
ovs-vsctl command, which causes it to return an empty string (and exit
|
|
|
99cbc7 |
with success) if the requested statistic isn't in its database, thus
|
|
|
99cbc7 |
eliminating the ugly error messages from the log.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Resolves: https://bugzilla.redhat.com/1683175
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
|
99cbc7 |
(cherry picked from commit 3f7cba3f5ea1731b9028b89b671cbd7e7d5e0421)
|
|
|
99cbc7 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
99cbc7 |
Message-Id: <20190502172335.6691-1-laine@redhat.com>
|
|
|
99cbc7 |
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/util/virnetdevopenvswitch.c | 6 +++---
|
|
|
99cbc7 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
|
|
|
99cbc7 |
index f86f698430..f36916a300 100644
|
|
|
99cbc7 |
--- a/src/util/virnetdevopenvswitch.c
|
|
|
99cbc7 |
+++ b/src/util/virnetdevopenvswitch.c
|
|
|
99cbc7 |
@@ -363,10 +363,10 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname,
|
|
|
99cbc7 |
virCommandFree(cmd); \
|
|
|
99cbc7 |
cmd = virCommandNew(OVSVSCTL); \
|
|
|
99cbc7 |
virNetDevOpenvswitchAddTimeout(cmd); \
|
|
|
99cbc7 |
- virCommandAddArgList(cmd, "get", "Interface", ifname, \
|
|
|
99cbc7 |
- "statistics:" name, NULL); \
|
|
|
99cbc7 |
+ virCommandAddArgList(cmd, "--if-exists", "get", "Interface", \
|
|
|
99cbc7 |
+ ifname, "statistics:" name, NULL); \
|
|
|
99cbc7 |
virCommandSetOutputBuffer(cmd, &output); \
|
|
|
99cbc7 |
- if (virCommandRun(cmd, NULL) < 0) { \
|
|
|
99cbc7 |
+ if (virCommandRun(cmd, NULL) < 0 || !output || !*output || *output == '\n') { \
|
|
|
99cbc7 |
stats->member = -1; \
|
|
|
99cbc7 |
} else { \
|
|
|
99cbc7 |
if (virStrToLong_ll(output, &tmp, 10, &stats->member) < 0 || \
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.21.0
|
|
|
99cbc7 |
|