mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
Remove conn parameter from Linux stats functions
It was used for error reporting only.
This commit is contained in:
parent
fe46a7e686
commit
0a5befc4c0
@ -61,6 +61,7 @@ src/util/json.c
|
||||
src/util/logging.c
|
||||
src/util/pci.c
|
||||
src/util/processinfo.c
|
||||
src/util/stats_linux.c
|
||||
src/util/storage_file.c
|
||||
src/util/util.c
|
||||
src/util/uuid.c
|
||||
|
@ -2048,7 +2048,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
ret = linuxDomainInterfaceStats(dom->conn, path, stats);
|
||||
ret = linuxDomainInterfaceStats(path, stats);
|
||||
else
|
||||
lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
|
||||
_("Invalid path, '%s' is not a known interface"), path);
|
||||
|
@ -6845,7 +6845,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
ret = linuxDomainInterfaceStats (dom->conn, path, stats);
|
||||
ret = linuxDomainInterfaceStats(path, stats);
|
||||
else
|
||||
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
|
||||
_("invalid path, '%s' is not a known interface"), path);
|
||||
|
@ -28,35 +28,9 @@
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_STATS_LINUX
|
||||
|
||||
/**
|
||||
* statsErrorFunc:
|
||||
* @conn: the connection
|
||||
* @error: the error number
|
||||
* @func: the function failing
|
||||
* @info: extra information string
|
||||
* @value: extra information number
|
||||
*
|
||||
* Handle a stats error.
|
||||
*/
|
||||
static void
|
||||
statsErrorFunc (virConnectPtr conn,
|
||||
virErrorNumber error, const char *func, const char *info,
|
||||
int value)
|
||||
{
|
||||
char fullinfo[1000];
|
||||
const char *errmsg;
|
||||
|
||||
errmsg = virErrorMsg(error, info);
|
||||
if (func != NULL) {
|
||||
snprintf(fullinfo, sizeof (fullinfo) - 1, "%s: %s", func, info);
|
||||
fullinfo[sizeof (fullinfo) - 1] = 0;
|
||||
info = fullinfo;
|
||||
}
|
||||
virRaiseError(conn, NULL, NULL, VIR_FROM_STATS_LINUX, error,
|
||||
VIR_ERR_ERROR,
|
||||
errmsg, info, NULL, value, 0, errmsg, info,
|
||||
value);
|
||||
}
|
||||
#define virStatsError(code, fmt...) \
|
||||
virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, fmt)
|
||||
|
||||
|
||||
/*-------------------- interface stats --------------------*/
|
||||
@ -66,7 +40,7 @@ statsErrorFunc (virConnectPtr conn,
|
||||
*/
|
||||
|
||||
int
|
||||
linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
|
||||
linuxDomainInterfaceStats(const char *path,
|
||||
struct _virDomainInterfaceStats *stats)
|
||||
{
|
||||
int path_len;
|
||||
@ -75,8 +49,8 @@ linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
|
||||
|
||||
fp = fopen ("/proc/net/dev", "r");
|
||||
if (!fp) {
|
||||
statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"/proc/net/dev", errno);
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Could not open /proc/net/dev"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -131,8 +105,8 @@ linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
|
||||
}
|
||||
fclose (fp);
|
||||
|
||||
statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||
"/proc/net/dev: Interface not found", 0);
|
||||
virStatsError(VIR_ERR_INTERNAL_ERROR,
|
||||
"/proc/net/dev: Interface not found");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
extern int linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
|
||||
extern int linuxDomainInterfaceStats(const char *path,
|
||||
struct _virDomainInterfaceStats *stats);
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
@ -1477,7 +1477,7 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom,
|
||||
return -1;
|
||||
}
|
||||
|
||||
return linuxDomainInterfaceStats (dom->conn, path, stats);
|
||||
return linuxDomainInterfaceStats(path, stats);
|
||||
#else
|
||||
virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
|
||||
"/proc/net/dev: Interface not found", 0);
|
||||
|
Loading…
Reference in New Issue
Block a user