[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 4/7] qga/commands-posix: Log all net stats failures
From: |
marcandre . lureau |
Subject: |
[PULL 4/7] qga/commands-posix: Log all net stats failures |
Date: |
Wed, 4 May 2022 14:00:58 +0400 |
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
- [PULL 0/7] QGA patches, marcandre . lureau, 2022/05/04
- [PULL 1/7] qga/commands-posix: Use getifaddrs when available, marcandre . lureau, 2022/05/04
- [PULL 2/7] qga/commands-posix: Fix iface hw address detection, marcandre . lureau, 2022/05/04
- [PULL 4/7] qga/commands-posix: Log all net stats failures,
marcandre . lureau <=
- [PULL 3/7] qga/commands-posix: Fix listing ifaces for Solaris, marcandre . lureau, 2022/05/04
- [PULL 5/7] qga/commands-posix: 'guest-shutdown' for Solaris, marcandre . lureau, 2022/05/04
- [PULL 6/7] qga: Introduce NVMe disk bus type, marcandre . lureau, 2022/05/04
- [PULL 7/7] qga: Introduce disk smart, marcandre . lureau, 2022/05/04
- Re: [PULL 0/7] QGA patches, Richard Henderson, 2022/05/04