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/logging.c
|
||||||
src/util/pci.c
|
src/util/pci.c
|
||||||
src/util/processinfo.c
|
src/util/processinfo.c
|
||||||
|
src/util/stats_linux.c
|
||||||
src/util/storage_file.c
|
src/util/storage_file.c
|
||||||
src/util/util.c
|
src/util/util.c
|
||||||
src/util/uuid.c
|
src/util/uuid.c
|
||||||
|
@ -2048,7 +2048,7 @@ lxcDomainInterfaceStats(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = linuxDomainInterfaceStats(dom->conn, path, stats);
|
ret = linuxDomainInterfaceStats(path, stats);
|
||||||
else
|
else
|
||||||
lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
|
lxcError(dom->conn, dom, VIR_ERR_INVALID_ARG,
|
||||||
_("Invalid path, '%s' is not a known interface"), path);
|
_("Invalid path, '%s' is not a known interface"), path);
|
||||||
|
@ -6845,7 +6845,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = linuxDomainInterfaceStats (dom->conn, path, stats);
|
ret = linuxDomainInterfaceStats(path, stats);
|
||||||
else
|
else
|
||||||
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
|
qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
|
||||||
_("invalid path, '%s' is not a known interface"), path);
|
_("invalid path, '%s' is not a known interface"), path);
|
||||||
|
@ -28,35 +28,9 @@
|
|||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_STATS_LINUX
|
#define VIR_FROM_THIS VIR_FROM_STATS_LINUX
|
||||||
|
|
||||||
/**
|
#define virStatsError(code, fmt...) \
|
||||||
* statsErrorFunc:
|
virReportErrorHelper(NULL, VIR_FROM_THIS, code, __FILE__, \
|
||||||
* @conn: the connection
|
__FUNCTION__, __LINE__, fmt)
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------- interface stats --------------------*/
|
/*-------------------- interface stats --------------------*/
|
||||||
@ -66,7 +40,7 @@ statsErrorFunc (virConnectPtr conn,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
|
linuxDomainInterfaceStats(const char *path,
|
||||||
struct _virDomainInterfaceStats *stats)
|
struct _virDomainInterfaceStats *stats)
|
||||||
{
|
{
|
||||||
int path_len;
|
int path_len;
|
||||||
@ -75,8 +49,8 @@ linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
|
|||||||
|
|
||||||
fp = fopen ("/proc/net/dev", "r");
|
fp = fopen ("/proc/net/dev", "r");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
virReportSystemError(errno, "%s",
|
||||||
"/proc/net/dev", errno);
|
_("Could not open /proc/net/dev"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,8 +105,8 @@ linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
|
|||||||
}
|
}
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
statsErrorFunc (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
virStatsError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"/proc/net/dev: Interface not found", 0);
|
"/proc/net/dev: Interface not found");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
extern int linuxDomainInterfaceStats (virConnectPtr conn, const char *path,
|
extern int linuxDomainInterfaceStats(const char *path,
|
||||||
struct _virDomainInterfaceStats *stats);
|
struct _virDomainInterfaceStats *stats);
|
||||||
|
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
@ -1477,7 +1477,7 @@ xenHypervisorDomainInterfaceStats (virDomainPtr dom,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return linuxDomainInterfaceStats (dom->conn, path, stats);
|
return linuxDomainInterfaceStats(path, stats);
|
||||||
#else
|
#else
|
||||||
virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
|
virXenErrorFunc (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__,
|
||||||
"/proc/net/dev: Interface not found", 0);
|
"/proc/net/dev: Interface not found", 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user