]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix block statistics with newer versions of Xen
authorGuido Günther <agx@sigxcpu.org>
Fri, 10 Sep 2010 13:57:35 +0000 (15:57 +0200)
committerDaniel Veillard <veillard@redhat.com>
Fri, 10 Sep 2010 13:57:35 +0000 (15:57 +0200)
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

src/xen/block_stats.c

index 6e7a5c3439b7d60d99904163cb010a74ef54137a..1d875f28d784f83693571563d8bc407e5d778f98 100644 (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);