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