summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Deason2022-04-26 21:55:25 +0200
committerMarc-André Lureau2022-05-04 10:00:46 +0200
commita539dc8a2c76dc8f04585a265e07af6ebaa4b86a (patch)
tree966456650a2c172b1447c46ddc0cc6c051484d5f
parentqga/commands-posix: Fix listing ifaces for Solaris (diff)
downloadqemu-a539dc8a2c76dc8f04585a265e07af6ebaa4b86a.tar.gz
qemu-a539dc8a2c76dc8f04585a265e07af6ebaa4b86a.tar.xz
qemu-a539dc8a2c76dc8f04585a265e07af6ebaa4b86a.zip
qga/commands-posix: Log all net stats failures
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>
-rw-r--r--qga/commands-posix.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index c1e994f3e6..ee997a58f2 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;
}