[libvirt] [PATCH] python: add virDomainGetCPUStats python binding API
Eric Blake
eblake at redhat.com
Wed Mar 14 12:22:58 UTC 2012
On 03/14/2012 06:12 AM, Guannan Ren wrote:
> On 03/14/2012 05:10 PM, Eric Blake wrote:
>> On 03/14/2012 03:02 AM, Daniel Veillard wrote:
>>> On Wed, Mar 14, 2012 at 03:06:38PM +0800, Alex Jia wrote:
>>>> On 03/14/2012 01:57 PM, Guannan Ren wrote:
>>>>> dom.cPUStats(True, 0)
>>>> I'd like getVcpuStats or cpuStats function naming.
>>> Based on existing conventions, it should be getVcpuStats() method,
>> getVcpuStats is wrong - if flags is 0, we are getting stats on the
>> physical cpu of the host, not the vcpu of the guest.
>>
>> I think we want getCpuStats.
>>
>
> getCPUStats is occupied by virNodeGetCPUStates. Renaming it is not
> good idea.
> It probably impact on those calling python code.
No it won't - you get the right stats according to which object you call
the method on. Remember that python is object oriented. There's a
difference between:
conn.getCPUStats => virNodeGetCPUStats
and
dom.getCPUStats => virDomainGetCPUStats
However, this _does_ point out that for consistent capitalization with
existing python bindings, we want to name it getCPUStats, not getCpuStats.
> I propose getDomCPUStates, what do you think about it?
No, getCPUStats is sufficient. And careful to avoid typos - it's Stats,
not States.
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120314/ae249d8c/attachment-0001.sig>
More information about the libvir-list
mailing list