[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

On 10/12/2010 01:29 PM, Matthias Bolte wrote:
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(-)
ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2010/10/12 Eric Blake <eblake@redhat.com>:
On 10/12/2010 01:29 PM, Matthias Bolte wrote:
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(-)
ACK.
Thanks, pushed. Matthias

On Tue, Oct 12, 2010 at 09:29:38PM +0200, Matthias Bolte wrote:
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.
Gahh, thanks for catching those !
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;
Hum, that file I didn't know about ... aren't those already declared in the .x so why the duplication, I'm surprized ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 10/13/2010 02:25 AM, Daniel Veillard wrote:
--- 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 {
Hum, that file I didn't know about ... aren't those already declared in the .x so why the duplication, I'm surprized !
That file only gets modified if you have the 'dwarves' package installed. It is a manual check that we are not changing the on-the-wire protocol inadvertently. Yes, it would be nice if this file could be regenerated automatically, instead of manually updating it; but the point of having this file is that we are forced to review every protocol change to make sure it is only additions and not modifications of an existing struct. See this thread for its introduction: https://www.redhat.com/archives/libvir-list/2010-May/msg00152.html -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

'make -C src rpcgen' is supposed to be idempotent. But commit f928f43b7b mistakently manually edited a generated file rather than fixing the upstream file. * src/remote/remote_protocol.x (remote_memory_param_value): Use correct spelling of enum values. * src/remote/remote_protocol.c: Regenerate. --- I'm pushing this under the obvious rule, as without it, I cannot rebase my vcpus patch series. Meanwhile, I'd like to figure out if 'make syntax-check' could automatically run 'make -C src rpcgen' if the right rpcgen is detected, and thus prevent us from repeating this problem. src/remote/remote_protocol.c | 47 +++++++++++++++++++++-------------------- src/remote/remote_protocol.x | 12 +++++----- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c index 6a74574..5c55713 100644 --- a/src/remote/remote_protocol.c +++ b/src/remote/remote_protocol.c @@ -308,38 +308,39 @@ xdr_remote_sched_param (XDR *xdrs, remote_sched_param *objp) } bool_t -xdr_remote_memory_param_value(XDR * xdrs, remote_memory_param_value * objp) +xdr_remote_memory_param_value (XDR *xdrs, remote_memory_param_value *objp) { - if (!xdr_int(xdrs, &objp->type)) - return FALSE; - switch (objp->type) { + if (!xdr_int (xdrs, &objp->type)) + return FALSE; + switch (objp->type) { case VIR_DOMAIN_MEMORY_PARAM_INT: - return FALSE; + return FALSE; + break; case VIR_DOMAIN_MEMORY_PARAM_UINT: - if (!xdr_u_int(xdrs, &objp->remote_memory_param_value_u.ui)) - return FALSE; - break; + if (!xdr_u_int (xdrs, &objp->remote_memory_param_value_u.ui)) + return FALSE; + break; case VIR_DOMAIN_MEMORY_PARAM_LLONG: - if (!xdr_int64_t(xdrs, &objp->remote_memory_param_value_u.l)) - return FALSE; - break; + if (!xdr_int64_t (xdrs, &objp->remote_memory_param_value_u.l)) + return FALSE; + break; case VIR_DOMAIN_MEMORY_PARAM_ULLONG: - if (!xdr_uint64_t(xdrs, &objp->remote_memory_param_value_u.ul)) - return FALSE; - break; + if (!xdr_uint64_t (xdrs, &objp->remote_memory_param_value_u.ul)) + return FALSE; + break; case VIR_DOMAIN_MEMORY_PARAM_DOUBLE: - if (!xdr_double(xdrs, &objp->remote_memory_param_value_u.d)) - return FALSE; - break; + if (!xdr_double (xdrs, &objp->remote_memory_param_value_u.d)) + return FALSE; + break; case VIR_DOMAIN_MEMORY_PARAM_BOOLEAN: - if (!xdr_int(xdrs, &objp->remote_memory_param_value_u.b)) - return FALSE; - break; + if (!xdr_int (xdrs, &objp->remote_memory_param_value_u.b)) + return FALSE; + break; default: - return FALSE; - } - return TRUE; + return FALSE; + } + return TRUE; } bool_t diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index f5dcb5c..e80fb5f 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -317,17 +317,17 @@ struct remote_sched_param { }; union remote_memory_param_value switch (int type) { - case VIR_DOMAIN_MEMORY_FIELD_INT: + case VIR_DOMAIN_MEMORY_PARAM_INT: int i; - case VIR_DOMAIN_MEMORY_FIELD_UINT: + case VIR_DOMAIN_MEMORY_PARAM_UINT: unsigned int ui; - case VIR_DOMAIN_MEMORY_FIELD_LLONG: + case VIR_DOMAIN_MEMORY_PARAM_LLONG: hyper l; - case VIR_DOMAIN_MEMORY_FIELD_ULLONG: + case VIR_DOMAIN_MEMORY_PARAM_ULLONG: unsigned hyper ul; - case VIR_DOMAIN_MEMORY_FIELD_DOUBLE: + case VIR_DOMAIN_MEMORY_PARAM_DOUBLE: double d; - case VIR_DOMAIN_MEMORY_FIELD_BOOLEAN: + case VIR_DOMAIN_MEMORY_PARAM_BOOLEAN: int b; }; -- 1.7.2.3
participants (3)
-
Daniel Veillard
-
Eric Blake
-
Matthias Bolte