[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Fix several minor problems introduced by the memtune series



Add proper documentation to the new VIR_DOMAIN_MEMORY_* macros in
libvirt.h.in to placate apibuild.py.

Mark args as unused in for libvirt_virDomain{Get,Set}MemoryParameters
in the Python bindings and add both to the libvirtMethods array.

Update remote_protocol-structs to placate make syntax-check.

Undo unintended modifications in vboxDomainGetInfo.

Update the function table of the VirtualBox and XenAPI drivers.
---
 include/libvirt/libvirt.h.in |   28 ++++++++++++++++++++++++++++
 python/libvirt-override.c    |    6 ++++--
 src/remote_protocol-structs  |   35 +++++++++++++++++++++++++++++++++++
 src/vbox/vbox_tmpl.c         |    6 ++++--
 src/xenapi/xenapi_driver.c   |    2 ++
 5 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index e244eac..ca8e6fa 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -695,9 +695,37 @@ typedef enum {
  */
 
 #define VIR_DOMAIN_MEMORY_FIELD_LENGTH 80
+
+/**
+ * VIR_DOMAIN_MEMORY_HARD_LIMIT:
+ *
+ * Macro for the well-known tunable hard_limit.
+ */
+
 #define VIR_DOMAIN_MEMORY_HARD_LIMIT "hard_limit"
+
+/**
+ * VIR_DOMAIN_MEMORY_SOFT_LIMIT:
+ *
+ * Macro for the well-known tunable soft_limit.
+ */
+
 #define VIR_DOMAIN_MEMORY_SOFT_LIMIT "soft_limit"
+
+/**
+ * VIR_DOMAIN_MEMORY_MIN_GUARANTEE:
+ *
+ * Macro for the well-known tunable min_guarantee.
+ */
+
 #define VIR_DOMAIN_MEMORY_MIN_GUARANTEE "min_guarantee"
+
+/**
+ * VIR_DOMAIN_SWAP_HARD_LIMIT:
+ *
+ * Macro for the well-known tunable swap_hard_limit.
+ */
+
 #define VIR_DOMAIN_SWAP_HARD_LIMIT "swap_hard_limit"
 
 /**
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index c43ab15..4a03d72 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -374,14 +374,14 @@ libvirt_virDomainSetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED,
 /* FIXME: This is a place holder for the implementation. */
 static PyObject *
 libvirt_virDomainSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
-                                     PyObject *args) {
+                                     PyObject *args ATTRIBUTE_UNUSED) {
     return VIR_PY_INT_FAIL;
 }
 
 /* FIXME: This is a place holder for the implementation. */
 static PyObject *
 libvirt_virDomainGetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
-                                     PyObject *args) {
+                                     PyObject *args ATTRIBUTE_UNUSED) {
     return VIR_PY_INT_FAIL;
 }
 
@@ -3532,6 +3532,8 @@ static PyMethodDef libvirtMethods[] = {
     {(char *) "virDomainGetSchedulerType", libvirt_virDomainGetSchedulerType, METH_VARARGS, NULL},
     {(char *) "virDomainGetSchedulerParameters", libvirt_virDomainGetSchedulerParameters, METH_VARARGS, NULL},
     {(char *) "virDomainSetSchedulerParameters", libvirt_virDomainSetSchedulerParameters, METH_VARARGS, NULL},
+    {(char *) "virDomainSetMemoryParameters", libvirt_virDomainSetMemoryParameters, METH_VARARGS, NULL},
+    {(char *) "virDomainGetMemoryParameters", libvirt_virDomainGetMemoryParameters, METH_VARARGS, NULL},
     {(char *) "virDomainGetVcpus", libvirt_virDomainGetVcpus, METH_VARARGS, NULL},
     {(char *) "virDomainPinVcpu", libvirt_virDomainPinVcpu, METH_VARARGS, NULL},
     {(char *) "virConnectListStoragePools", libvirt_virConnectListStoragePools, METH_VARARGS, NULL},
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index a5fc6aa..838423e 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -70,6 +70,21 @@ struct remote_sched_param {
 	remote_nonnull_string      field;
 	remote_sched_param_value   value;
 };
+struct remote_memory_param_value {
+	int                        type;
+	union {
+		int                i;
+		u_int              ui;
+		int64_t            l;
+		uint64_t           ul;
+		double             d;
+		int                b;
+	} remote_memory_param_value_u;
+};
+struct remote_memory_param {
+	remote_nonnull_string      field;
+	remote_memory_param_value  value;
+};
 struct remote_open_args {
 	remote_string              name;
 	int                        flags;
@@ -151,6 +166,26 @@ struct remote_domain_set_scheduler_parameters_args {
 		remote_sched_param * params_val;
 	} params;
 };
+struct remote_domain_set_memory_parameters_args {
+	remote_nonnull_domain      dom;
+	struct {
+		u_int              params_len;
+		remote_memory_param * params_val;
+	} params;
+	u_int                      flags;
+};
+struct remote_domain_get_memory_parameters_args {
+	remote_nonnull_domain      dom;
+	int                        nparams;
+	u_int                      flags;
+};
+struct remote_domain_get_memory_parameters_ret {
+	struct {
+		u_int              params_len;
+		remote_memory_param * params_val;
+	} params;
+	int                        nparams;
+};
 struct remote_domain_block_stats_args {
 	remote_nonnull_domain      dom;
 	remote_nonnull_string      path;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 65bfd9e..7e7d8e4 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -1734,8 +1734,8 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) {
 
                 info->cpuTime = 0;
                 info->nrVirtCpu = CPUCount;
-                info->mem.cur_balloon = memorySize * 1024;
-                info->mem.max_balloon = maxMemorySize * 1024;
+                info->memory = memorySize * 1024;
+                info->maxMem = maxMemorySize * 1024;
                 switch(state) {
                     case MachineState_Running:
                         info->state = VIR_DOMAIN_RUNNING;
@@ -8344,6 +8344,8 @@ virDriver NAME(Driver) = {
     vboxDomainRevertToSnapshot, /* domainRevertToSnapshot */
     vboxDomainSnapshotDelete, /* domainSnapshotDelete */
     NULL, /* qemuDomainMonitorCommand */
+    NULL, /* domainSetMemoryParameters */
+    NULL, /* domainGetMemoryParameters */
 };
 
 virNetworkDriver NAME(NetworkDriver) = {
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index ad5b5d8..e62a139 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1821,6 +1821,8 @@ static virDriver xenapiDriver = {
     NULL, /* domainRevertToSnapshot */
     NULL, /* domainSnapshotDelete */
     NULL, /* qemuDomainMonitorCommand */
+    NULL, /* domainSetMemoryParameters */
+    NULL, /* domainGetMemoryParameters */
 };
 
 /**
-- 
1.7.0.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]