Fix block statistics with newer versions of Xen

Apparently the xen block device statistics moved from
"/sys/devices/xen-backend/vbd-%d-%d/statistics/%s"
to
"/sys/bus/xen-backend/devices/vbd-%d-%d/statistics/%s"

* src/xen/block_stats.c: try the extra path in case of failure to
  find the statistics in /sys
This commit is contained in:
Guido Günther 2010-09-10 15:57:35 +02:00 committed by Daniel Veillard
parent dfec22cc60
commit 8a70113a99

View File

@ -117,6 +117,18 @@ read_bd_stat (int device, int domid, const char *str)
char path[PATH_MAX];
int64_t r;
snprintf (path, sizeof path,
"/sys/bus/xen-backend/devices/vbd-%d-%d/statistics/%s",
domid, device, str);
r = read_stat (path);
if (r >= 0) return r;
snprintf (path, sizeof path,
"/sys/bus/xen-backend/devices/tap-%d-%d/statistics/%s",
domid, device, str);
r = read_stat (path);
if (r >= 0) return r;
snprintf (path, sizeof path,
"/sys/devices/xen-backend/vbd-%d-%d/statistics/%s",
domid, device, str);