Set up the types for the domainMemStats function and insert it into the
virDriver structure definition. Because of static initializers, update every
driver and set the new field to NULL.
Note: The changes in python/* are to fix compiler errors. The actual python
binding is implemented in a later patch.
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
To: libvirt list <libvir-list(a)redhat.com>
---
include/libvirt/libvirt.h.in | 31 +++++++++++++++++++++++++++++++
python/generator.py | 4 +++-
src/driver.h | 6 ++++++
src/esx/esx_driver.c | 1 +
src/lxc/lxc_driver.c | 1 +
src/opennebula/one_driver.c | 1 +
src/openvz/openvz_driver.c | 1 +
src/phyp/phyp_driver.c | 1 +
src/qemu/qemu_driver.c | 1 +
src/remote/remote_driver.c | 1 +
src/test/test_driver.c | 1 +
src/uml/uml_driver.c | 1 +
src/vbox/vbox_tmpl.c | 1 +
src/xen/xen_driver.c | 1 +
14 files changed, 51 insertions(+), 1 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index f51a565..e430599 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -333,6 +333,34 @@ struct _virDomainInterfaceStats {
*/
typedef virDomainInterfaceStatsStruct *virDomainInterfaceStatsPtr;
+/**
+ * virDomainMemStats:
+ *
+ * Memory stats for virDomainMemStats.
+ *
+ * Hypervisors may return a field set to ((long long)-1) which indicates
+ * that the hypervisor or guest does not support that statistic.
+ *
+ * NB. Here 'long long' means 64 bit integer.
+ */
+typedef struct _virDomainMemStats virDomainMemStatsStruct;
+
+struct _virDomainMemStats {
+ unsigned long long swap_in;
+ unsigned long long swap_out;
+ unsigned long long major_fault;
+ unsigned long long minor_fault;
+ unsigned long long mem_free;
+ unsigned long long mem_tot;
+};
+
+/**
+ * virDomainMemStatsPtr:
+ *
+ * A pointer to a virDomainMemStats structure
+ */
+typedef virDomainMemStatsStruct *virDomainMemStatsPtr;
+
/* Domain migration flags. */
typedef enum {
@@ -633,6 +661,9 @@ int virDomainInterfaceStats (virDomainPtr dom,
const char *path,
virDomainInterfaceStatsPtr stats,
size_t size);
+int virDomainMemStats (virDomainPtr dom,
+ virDomainMemStatsPtr stats,
+ size_t size);
int virDomainBlockPeek (virDomainPtr dom,
const char *path,
unsigned long long offset,
diff --git a/python/generator.py b/python/generator.py
index 21b4137..fef20fb 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -160,7 +160,8 @@ def enum(type, name, value):
functions_failed = []
functions_skipped = [
- "virConnectListDomains"
+ "virConnectListDomains",
+ "virDomainMemStats"
]
skipped_modules = {
@@ -170,6 +171,7 @@ skipped_types = {
# 'int *': "usually a return type",
'virConnectDomainEventCallback': "No function types in python",
'virEventAddHandleFunc': "No function types in python",
+ 'virDomainMemStatsPtr': "Not implemented"
}
#######################################################################
diff --git a/src/driver.h b/src/driver.h
index 0c8f923..42615c5 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -226,6 +226,11 @@ typedef int
struct _virDomainInterfaceStats *stats);
typedef int
+ (*virDrvDomainMemStats)
+ (virDomainPtr domain,
+ struct _virDomainMemStats *stats);
+
+typedef int
(*virDrvDomainBlockPeek)
(virDomainPtr domain,
const char *path,
@@ -406,6 +411,7 @@ struct _virDriver {
virDrvDomainMigrateFinish domainMigrateFinish;
virDrvDomainBlockStats domainBlockStats;
virDrvDomainInterfaceStats domainInterfaceStats;
+ virDrvDomainMemStats domainMemStats;
virDrvDomainBlockPeek domainBlockPeek;
virDrvDomainMemoryPeek domainMemoryPeek;
virDrvNodeGetCellsFreeMemory nodeGetCellsFreeMemory;
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index e063b46..3e94686 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3263,6 +3263,7 @@ static virDriver esxDriver = {
esxDomainMigrateFinish, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
NULL, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
NULL, /* nodeGetCellsFreeMemory */
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 0b614e3..a890c67 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2312,6 +2312,7 @@ static virDriver lxcDriver = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
NULL, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
nodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
index 9bcd5c3..3702d03 100644
--- a/src/opennebula/one_driver.c
+++ b/src/opennebula/one_driver.c
@@ -776,6 +776,7 @@ static virDriver oneDriver = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
NULL, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
NULL, /* nodeGetCellsFreeMemory */
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index f64ad1e..4ba9f47 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1421,6 +1421,7 @@ static virDriver openvzDriver = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
NULL, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
NULL, /* nodeGetCellsFreeMemory */
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index ef465ed..f275283 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1366,6 +1366,7 @@ virDriver phypDriver = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
NULL, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
NULL, /* nodeGetCellsFreeMemory */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c544c4b..35c397d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7124,6 +7124,7 @@ static virDriver qemuDriver = {
NULL, /* domainMigrateFinish */
qemudDomainBlockStats, /* domainBlockStats */
qemudDomainInterfaceStats, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
qemudDomainBlockPeek, /* domainBlockPeek */
qemudDomainMemoryPeek, /* domainMemoryPeek */
nodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index bf001eb..0bfe730 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -8437,6 +8437,7 @@ static virDriver remote_driver = {
remoteDomainMigrateFinish, /* domainMigrateFinish */
remoteDomainBlockStats, /* domainBlockStats */
remoteDomainInterfaceStats, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
remoteDomainBlockPeek, /* domainBlockPeek */
remoteDomainMemoryPeek, /* domainMemoryPeek */
remoteNodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 0541a73..b82fb1b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4546,6 +4546,7 @@ static virDriver testDriver = {
NULL, /* domainMigrateFinish */
testDomainBlockStats, /* domainBlockStats */
testDomainInterfaceStats, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
NULL, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
testNodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 9a7fe42..10b62d9 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1850,6 +1850,7 @@ static virDriver umlDriver = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
umlDomainBlockPeek, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
nodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 4f43901..6b6656e 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -6451,6 +6451,7 @@ virDriver NAME(Driver) = {
NULL, /* domainMigrateFinish */
NULL, /* domainBlockStats */
NULL, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
NULL, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
nodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 5273a11..5a5eca9 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1714,6 +1714,7 @@ static virDriver xenUnifiedDriver = {
xenUnifiedDomainMigrateFinish, /* domainMigrateFinish */
xenUnifiedDomainBlockStats, /* domainBlockStats */
xenUnifiedDomainInterfaceStats, /* domainInterfaceStats */
+ NULL, /* domainMemStats */
xenUnifiedDomainBlockPeek, /* domainBlockPeek */
NULL, /* domainMemoryPeek */
xenUnifiedNodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
--
1.6.5