Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
xen.5015
538c7df7-libxenstat-handle-renamed-vifs.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 538c7df7-libxenstat-handle-renamed-vifs.patch of Package xen.5015
Subject: libxenstat: handle renamed VIFs From: Jacek Konieczny jajcus@jajcus.net Fri May 23 14:47:21 2014 +0200 Date: Mon Jun 2 14:36:55 2014 +0100: Git: b2a332bfde7aff580f461a1d81b5340573d556d1 Before trying to parse network interface name as 'vif*.*' try to get the domid and network number from sysfs. Fixes xentop output for domains with VIF renamed through the 'vifname' xl option. Signed-off-by: Jacek Konieczny <jajcus@jajcus.net> Acked-by: Ian Campbell <ian.campbell@citrix.com> Index: xen-4.4.1-testing/tools/xenstat/libxenstat/src/xenstat_linux.c =================================================================== --- xen-4.4.1-testing.orig/tools/xenstat/libxenstat/src/xenstat_linux.c +++ xen-4.4.1-testing/tools/xenstat/libxenstat/src/xenstat_linux.c @@ -235,6 +235,29 @@ int parseNetDevLine(char *line, char *if return 0; } +/* Find out the domid and network number given an interface name. + * Return 0 if the iface cannot be recognized as a Xen VIF. */ +static int get_iface_domid_network(const char *iface, unsigned int *domid_p, unsigned int *netid_p) +{ + char nodename_path[48]; + FILE * nodename_file; + int ret; + + snprintf(nodename_path, 48, "/sys/class/net/%s/device/nodename", iface); + nodename_file = fopen(nodename_path, "r"); + if (nodename_file != NULL) { + ret = fscanf(nodename_file, "backend/vif/%u/%u", domid_p, netid_p); + fclose(nodename_file); + if (ret == 2) + return 1; + } + + if (sscanf(iface, "vif%u.%u", domid_p, netid_p) == 2) + return 1; + + return 0; +} + /* Collect information about networks */ int xenstat_collect_networks(xenstat_node * node) { @@ -311,8 +334,7 @@ int xenstat_collect_networks(xenstat_nod } } else /* Otherwise we need to preserve old behaviour */ - if (strstr(iface, "vif") != NULL) { - sscanf(iface, "vif%u.%u", &domid, &net.id); + if (get_iface_domid_network(iface, &domid, &net.id)) { net.tbytes = txBytes; net.tpackets = txPackets;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor