qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: marcandre.lureau@redhat.com
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
	Michael Roth <michael.roth@amd.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Andrew Deason <adeason@sinenomine.net>
Subject: [PULL 4/7] qga/commands-posix: Log all net stats failures
Date: Wed,  4 May 2022 14:00:58 +0400	[thread overview]
Message-ID: <20220504100101.564747-5-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20220504100101.564747-1-marcandre.lureau@redhat.com>

From: Andrew Deason <adeason@sinenomine.net>

guest_get_network_stats can silently fail in a couple of ways. Add
debug messages to these cases, so we're never completely silent on
failure.

Signed-off-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220426195526.7699-5-adeason@sinenomine.net>
---
 qga/commands-posix.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index c1e994f3e6ab..ee997a58f21c 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2775,6 +2775,8 @@ static int guest_get_network_stats(const char *name,
     size_t n = 0;
     fp = fopen(devinfo, "r");
     if (!fp) {
+        g_debug("failed to open network stats %s: %s", devinfo,
+                g_strerror(errno));
         return -1;
     }
     name_len = strlen(name);
@@ -2823,7 +2825,9 @@ static int guest_get_network_stats(const char *name,
     fclose(fp);
     g_free(line);
     g_debug("/proc/net/dev: Interface '%s' not found", name);
-#endif /* CONFIG_LINUX */
+#else /* !CONFIG_LINUX */
+    g_debug("Network stats reporting available only for Linux");
+#endif /* !CONFIG_LINUX */
     return -1;
 }
 
-- 
2.36.0.44.g0f828332d5ac



  parent reply	other threads:[~2022-05-04 11:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 10:00 [PULL 0/7] QGA patches marcandre.lureau
2022-05-04 10:00 ` [PULL 1/7] qga/commands-posix: Use getifaddrs when available marcandre.lureau
2022-05-04 10:00 ` [PULL 2/7] qga/commands-posix: Fix iface hw address detection marcandre.lureau
2022-05-04 10:00 ` [PULL 3/7] qga/commands-posix: Fix listing ifaces for Solaris marcandre.lureau
2022-05-04 10:00 ` marcandre.lureau [this message]
2022-05-04 10:00 ` [PULL 5/7] qga/commands-posix: 'guest-shutdown' " marcandre.lureau
2022-05-04 10:01 ` [PULL 6/7] qga: Introduce NVMe disk bus type marcandre.lureau
2022-05-04 10:01 ` [PULL 7/7] qga: Introduce disk smart marcandre.lureau
2022-05-04 15:06 ` [PULL 0/7] QGA patches Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220504100101.564747-5-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=adeason@sinenomine.net \
    --cc=michael.roth@amd.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).