On 11/28/2011 10:19 AM, Peter Krempa wrote:
This patch adds binding for virNodeGetCPUStats method of libvirtd.
Return value is represended as a python dictionary mapping fileld names
s/represended/represented/ s/fileld/field/
to values.
---
include/libvirt/libvirt.h.in | 6 +++-
python/libvirt-override-api.xml | 7 +++++
python/libvirt-override.c | 47 +++++++++++++++++++++++++++++++++++++++
3 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 0787f18..1291c59 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -361,9 +361,11 @@ struct _virNodeInfo {
/**
* VIR_NODE_CPU_STATS_ALL_CPUS:
*
- * Macro for the total CPU time/utilization
+ * Value for specifying request for the total CPU time/utilization
*/
-#define VIR_NODE_CPU_STATS_ALL_CPUS (-1)
+typedef enum {
+ VIR_NODE_CPU_STATS_ALL_CPUS = -1,
+} virNodeGetCPUStatsAllCPUs;
Safe change to make, and if it helps python generation, then it should
be okay.
/**
* VIR_NODE_CPU_STATS_KERNEL:
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index ef02f34..e6dc967 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -77,6 +77,13 @@
<return type='int *' info='the list of information or None in case
of error'/>
<arg name='conn' type='virConnectPtr' info='pointer to the
hypervisor connection'/>
</function>
+ <function name='virNodeGetCPUStats' file='python'>
+ <info>Extract node's CPU statistics.</info>
+ <return type='virNodeCPUStats' info='dictionary mapping field names
to values or None in case of error'/>
+ <arg name='conn' type='virConnectPtr' info='pointer to
hypervisor connection'/>
+ <arg name='cpuNum' type='int' info='number of node cpu.
(VIR_NODE_CPU_STATS_ALL_CPUS means total cpu statistics)'/>
+ <arg name='flags' type='unsigned int' info='aditional
flags'/>
s/aditional/additional/
ACK with nits fixed, and worth including in 0.9.8.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org