[Libvir] Need more information on virDomainBlockStats, virDomainInterfaceStats and virNodeGetCellsFreeMemory

Hi, I am trying to use libvirt, any one please help more about virDomainBlockStats, virDomainInterfaceStats and virNodeGetCellsFreeMemory any pointer or docs? -- Thanks&Regards Ajeesh

On Mon, Mar 03, 2008 at 11:31:10AM +0530, Ajishrao.r wrote:
Hi, I am trying to use libvirt, any one please help more about virDomainBlockStats, virDomainInterfaceStats and virNodeGetCellsFreeMemory any pointer or docs?
Check http://libvirt.org/html/libvirt-libvirt.html#virDomainBlockStats http://libvirt.org/html/libvirt-libvirt.html#virDomainBlockStatsStruct (I notice description of fields are missing, adding them) there is also descritpions for the other functions Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

hi daniel, I saw the description, I couldn't understand any thing about DomainBlockStats structure please can you tell me in little more detail. On Mon, Mar 3, 2008 at 11:42 AM, Daniel Veillard <veillard@redhat.com> wrote:
On Mon, Mar 03, 2008 at 11:31:10AM +0530, Ajishrao.r wrote:
Hi, I am trying to use libvirt, any one please help more
about
virDomainBlockStats, virDomainInterfaceStats and virNodeGetCellsFreeMemory any pointer or docs?
Check http://libvirt.org/html/libvirt-libvirt.html#virDomainBlockStats
http://libvirt.org/html/libvirt-libvirt.html#virDomainBlockStatsStruct (I notice description of fields are missing, adding them) there is also descritpions for the other functions
Daniel
-- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
-- Thanks&Regards Ajeesh

On Mon, Mar 03, 2008 at 11:31:10AM +0530, Ajishrao.r wrote:
Hi, I am trying to use libvirt, any one please help more about virDomainBlockStats, virDomainInterfaceStats and virNodeGetCellsFreeMemory any pointer or docs?
Is there anything in particular you want to know? If you want to see virDomainBlockStats and virDomainInterfaceStats in action I suggest getting virt-top which makes use of these calls: http://et.redhat.com/~rjones/virt-top/ (It's also in Fedora). If you run virt-top with a recent version of libvirt and export LIBVIRT_DEBUG=1 then it will show you the libvirt calls being made. Basically what you do is call virDomainGetXMLDesc for a domain, parse out the <target dev="foo"> for each block device and network interface, and then pass that string ("foo") back to virDomainBlockStats or virDomainInterfaceStats as the path parameter. If the call is supported by the hypervisor then what you get back is a structure with the stats you requested. For reasons of efficiency you probably don't want to call virDomainGetXMLDesc frequently. You only need to call it when the domain's devices change, and for most programs you can ignore that possibility and just call it once per domain. All of the stats monotonically increment, so you need to do your own subtraction and divide by the time between calls in order to get rates. Again, see the code in virt-top. We expose all the stats as 64 bit counters so hopefully they don't wrap for a Very Long Time, but in some cases the underlying kernel or hypervisor is using 32 bit counters (particularly Linux's /proc/net/dev with a 32 bit kernel IIRC) so be careful about that. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
participants (3)
-
Ajishrao.r
-
Daniel Veillard
-
Richard W.M. Jones