[libvirt] [PATCH] fix path to xen device statistics for newer kernels

Cole Robinson crobinso at redhat.com
Thu Sep 9 14:48:44 UTC 2010


On 09/08/2010 03:35 PM, Guido Günther wrote:
> Hi,
> it seems Xen changed the paths to the block device statistics in sysfs:
> from "/sys/devices/xen-backend/vbd-%d-%d/statistics/%s" to
> "/sys/bus/xen-backend/devices/vbd-%d-%d/statistics/%s":
> 
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=596004
> 
> Attached patch fixes this. O.k. to apply?
>  -- Guido
> 

> diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
> index 6e7a5c3..1d875f2 100644
> --- a/src/xen/block_stats.c
> +++ b/src/xen/block_stats.c
> @@ -118,6 +118,18 @@ read_bd_stat (int device, int domid, const char *str)
>      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);
>      r = read_stat (path);

ACK if a brief comment is added explaining the situation.

- Cole




More information about the libvir-list mailing list