libxl: implement virDomainBlockStats
libxl: implement virDomainBlockStats

Introduce initial support for domainBlockStats API call that
allow us to query block device statistics. OpenStack nova
uses this API call to query block statistics, alongside
virDomainMemoryStats and virDomainInterfaceStats.  Note that
this patch only introduces it for VBD for starters. QDisk
would come in a separate patch series.

A new statistics data structure is introduced to fit common
statistics among others specific to the underlying block
backends. For the VBD statistics on linux these are exported
via sysfs on the path:

"/sys/bus/xen-backend/devices/vbd-<domid>-<devid>/statistics"

To calculate the block devno libxlDiskPathToID is introduced.
Each backend implements its own function to extract statistics,
allowing support for multiple backends and different platforms.

VBD stats are exposed in reqs and number of sectors from
blkback, and it's up to us to convert it to sector sizes.
The sector size is gathered through xenstore in the device
backend entry "physical-sector-size".

BlockStatsFlags variant is also implemented which has the
added benefit of getting the number of flush requests.

Signed-off-by: Joao Martins <7c86cc079af931b7847bbaae227ac1245d2901a0@oracle.com>

fabianfreyer/libvirt,olafhering/libvirt,VenkatDatta/libvirt,VenkatDatta/libvirt,VenkatDatta/libvirt,andreabolognani/libvirt,olafhering/libvirt,olafhering/libvirt,zippy2/libvirt,libvirt/libvirt,jardasgit/libvirt,andreabolognani/libvirt,crobinso/libvirt,nertpinx/libvirt,datto/libvirt,datto/libvirt,libvirt/libvirt,jfehlig/libvirt,crobinso/libvirt,datto/libvirt,zippy2/libvirt,taget/libvirt,taget/libvirt,jfehlig/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,eskultety/libvirt,nertpinx/libvirt,taget/libvirt,andreabolognani/libvirt,datto/libvirt,crobinso/libvirt,jardasgit/libvirt,olafhering/libvirt,jfehlig/libvirt,zippy2/libvirt,datto/libvirt,taget/libvirt,jfehlig/libvirt,fabianfreyer/libvirt,crobinso/libvirt,eskultety/libvirt,fabianfreyer/libvirt,VenkatDatta/libvirt,nertpinx/libvirt,eskultety/libvirt,jardasgit/libvirt,zippy2/libvirt,jardasgit/libvirt,jardasgit/libvirt,VenkatDatta/libvirt,nertpinx/libvirt,eskultety/libvirt,andreabolognani/libvirt,libvirt/libvirt,libvirt/libvirt,fabianfreyer/libvirt,eskultety/libvirt,taget/libvirt,andreabolognani/libvirt