retspen/webvirtmgr — pull request #296 by EmbeddedAndroid (2014-04-29 01:57:47+00:00)
Title: enable blockstats for network disks

Reading through the libvirt API I found that it is possible to retrieve block stats from network disks.

'dev_file' is assumed to be the path to the virtual hard disk which is gathered from the source element. However, network disks do not have a 'dev' or 'file' attribute as documented here:

http://libvirt.org/formatdomain.html#elementsDisks

Libvirt:blockStats will not only accept a path to the virtual disk, but also a target block device such as 'vdz'. This change set detects a network disk, and set dev_file = dev_bus in only that case.

I've tested this change locally, and disk usage is shown for both virtual machines with physical virtual hard disks, and network (rbd) disks! It would be nice if anyone else is using a network disk to test if this is working for them as well.

Here is a picture of disk usage reporting for a network disk:

![screen shot 2014-04-28 at 5 54 44 pm](https://cloud.githubusercontent.com/assets/1061011/2825057/9cca8392-cf41-11e3-8a14-7d9345e8b497.png)