|
|
c313de |
From 53282d1e7f34724c6be7704ec56324c507894397 Mon Sep 17 00:00:00 2001
|
|
|
c313de |
Message-Id: <53282d1e7f34724c6be7704ec56324c507894397@dist-git>
|
|
|
c313de |
From: Laine Stump <laine@laine.org>
|
|
|
c313de |
Date: Tue, 30 Jul 2019 15:30:50 +0200
|
|
|
c313de |
Subject: [PATCH] util: suppress unimportant ovs-vsctl errors when getting
|
|
|
c313de |
interface stats
|
|
|
c313de |
MIME-Version: 1.0
|
|
|
c313de |
Content-Type: text/plain; charset=UTF-8
|
|
|
c313de |
Content-Transfer-Encoding: 8bit
|
|
|
c313de |
|
|
|
c313de |
commit edaf13565 modified the stats retrieval for OVS interfaces to
|
|
|
c313de |
not fail when one of the fields was unrecognized by the ovs-vsctl
|
|
|
c313de |
command, but ovs-vsctl was still returning an error, and libvirt was
|
|
|
c313de |
cluttering the logs with these inconsequential error messages.
|
|
|
c313de |
|
|
|
c313de |
This patch modifies the GET_STAT macro to add "--if-exists" to the
|
|
|
c313de |
ovs-vsctl command, which causes it to return an empty string (and exit
|
|
|
c313de |
with success) if the requested statistic isn't in its database, thus
|
|
|
c313de |
eliminating the ugly error messages from the log.
|
|
|
c313de |
|
|
|
c313de |
Resolves: https://bugzilla.redhat.com/1683175
|
|
|
c313de |
|
|
|
c313de |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
|
c313de |
(cherry picked from commit 3f7cba3f5ea1731b9028b89b671cbd7e7d5e0421)
|
|
|
c313de |
|
|
|
c313de |
Prerequisite of: https://bugzilla.redhat.com/show_bug.cgi?id=1721434
|
|
|
c313de |
|
|
|
c313de |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c313de |
Message-Id: <e0309b32467a30a8a9be8371ef8cbba1713d662c.1564493409.git.mprivozn@redhat.com>
|
|
|
c313de |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c313de |
---
|
|
|
c313de |
src/util/virnetdevopenvswitch.c | 6 +++---
|
|
|
c313de |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
c313de |
|
|
|
c313de |
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
|
|
|
c313de |
index 2f5c7ac789..cb403aaf2e 100644
|
|
|
c313de |
--- a/src/util/virnetdevopenvswitch.c
|
|
|
c313de |
+++ b/src/util/virnetdevopenvswitch.c
|
|
|
c313de |
@@ -342,10 +342,10 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname,
|
|
|
c313de |
virCommandFree(cmd); \
|
|
|
c313de |
cmd = virCommandNew(OVSVSCTL); \
|
|
|
c313de |
virNetDevOpenvswitchAddTimeout(cmd); \
|
|
|
c313de |
- virCommandAddArgList(cmd, "get", "Interface", ifname, \
|
|
|
c313de |
- "statistics:" name, NULL); \
|
|
|
c313de |
+ virCommandAddArgList(cmd, "--if-exists", "get", "Interface", \
|
|
|
c313de |
+ ifname, "statistics:" name, NULL); \
|
|
|
c313de |
virCommandSetOutputBuffer(cmd, &output); \
|
|
|
c313de |
- if (virCommandRun(cmd, NULL) < 0) { \
|
|
|
c313de |
+ if (virCommandRun(cmd, NULL) < 0 || !output || !*output || *output == '\n') { \
|
|
|
c313de |
stats->member = -1; \
|
|
|
c313de |
} else { \
|
|
|
c313de |
if (virStrToLong_ll(output, &tmp, 10, &stats->member) < 0 || \
|
|
|
c313de |
--
|
|
|
c313de |
2.22.0
|
|
|
c313de |
|