mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
util: suppress unimportant ovs-vsctl errors when getting interface stats
commit edaf13565
modified the stats retrieval for OVS interfaces to
not fail when one of the fields was unrecognized by the ovs-vsctl
command, but ovs-vsctl was still returning an error, and libvirt was
cluttering the logs with these inconsequential error messages.
This patch modifies the GET_STAT macro to add "--if-exists" to the
ovs-vsctl command, which causes it to return an empty string (and exit
with success) if the requested statistic isn't in its database, thus
eliminating the ugly error messages from the log.
Resolves: https://bugzilla.redhat.com/1683175
Signed-off-by: Laine Stump <laine@laine.org>
This commit is contained in:
parent
54eb3e096b
commit
3f7cba3f5e
@ -335,10 +335,10 @@ virNetDevOpenvswitchInterfaceStats(const char *ifname,
|
|||||||
virCommandFree(cmd); \
|
virCommandFree(cmd); \
|
||||||
cmd = virCommandNew(OVSVSCTL); \
|
cmd = virCommandNew(OVSVSCTL); \
|
||||||
virNetDevOpenvswitchAddTimeout(cmd); \
|
virNetDevOpenvswitchAddTimeout(cmd); \
|
||||||
virCommandAddArgList(cmd, "get", "Interface", ifname, \
|
virCommandAddArgList(cmd, "--if-exists", "get", "Interface", \
|
||||||
"statistics:" name, NULL); \
|
ifname, "statistics:" name, NULL); \
|
||||||
virCommandSetOutputBuffer(cmd, &output); \
|
virCommandSetOutputBuffer(cmd, &output); \
|
||||||
if (virCommandRun(cmd, NULL) < 0) { \
|
if (virCommandRun(cmd, NULL) < 0 || !output || !*output || *output == '\n') { \
|
||||||
stats->member = -1; \
|
stats->member = -1; \
|
||||||
} else { \
|
} else { \
|
||||||
if (virStrToLong_ll(output, &tmp, 10, &stats->member) < 0 || \
|
if (virStrToLong_ll(output, &tmp, 10, &stats->member) < 0 || \
|
||||||
|
Loading…
Reference in New Issue
Block a user