[Libvir] python libvirt methods to virDomainBlockStats and virDomainInterfaceStats

Richard W.M. Jones rjones at redhat.com
Thu Sep 27 09:40:14 UTC 2007


Marco Sinhoreli wrote:
> Hello all,
> 
> I'm using libvirt from cvs, and in libvirt.h there are
> virDomainBlockStats, and virDomainInterfaceStats calls. I think it is
> compiled into libvirtmod, then I'm trying to write two methods,
> blockStats, and interfacesStats in the class virDomain at the
> libvirt.py library file. I'm not a specialist in python programming
> and it's not working.
> 
> Bellow folow the code I have been wrote:
> 
>     def blockStats(self):
>         """Block device stats for virDomainBlockStats """
>         ret = libvirtmod.virDomainBlockStats(self._o)
>         if ret is None: raise libvirtError ('virDomainBlockStats()
> failed', dom=self)
>         return ret
> 
>     def  interfaceStats(self):
>         """Network interface stats for virDomainInterfaceStats."""
>         ret = libvirtmod.virDomainInterfaceStats(self._o)
>         if ret is None: raise libvirtError ('virDomainInterfaceStats()
> failed', dom=self)
>         return ret

This isn't going to work because you need to pass the path to both calls.

I think this requires a hand-written C binding.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070927/f0d56e29/attachment-0001.bin>


More information about the libvir-list mailing list