[libvirt] [PATCH] memtune: Add min_guarantee to the virsh tool

Hi, I am adding the min_guarantee to the memtune command with this patch. I have tested this at the virsh tool level. This parameter is not supported by QEMU or LXC. Can be used by ESX and in future by other hypervisors. Nikunj From: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com> tools/virsh.c: Add new memory tunable "min_guarantee", currently the user would be ESX. tools/virsh.pod: Update the manpage Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com> --- tools/virsh.c | 17 +++++++++++++++-- tools/virsh.pod | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index fe35eb9..e79bfbb 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2632,6 +2632,8 @@ static const vshCmdOptDef opts_memtune[] = { N_("Memory during contention in kilobytes")}, {VIR_DOMAIN_SWAP_HARD_LIMIT, VSH_OT_STRING, VSH_OFLAG_NONE, N_("Max swap in kilobytes")}, + {VIR_DOMAIN_MEMORY_MIN_GUARANTEE, VSH_OT_STRING, VSH_OFLAG_NONE, + N_("Min guaranteed memory in kilobytes")}, {NULL, 0, 0, NULL} }; @@ -2639,7 +2641,7 @@ static int cmdMemtune(vshControl * ctl, const vshCmd * cmd) { virDomainPtr dom; - int hard_limit, soft_limit, swap_hard_limit; + int hard_limit, soft_limit, swap_hard_limit, min_guarantee; int nparams = 0; unsigned int i = 0; virMemoryParameterPtr params = NULL, temp = NULL; @@ -2667,6 +2669,12 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) if (swap_hard_limit) nparams++; + min_guarantee = + vshCommandOptInt(cmd, VIR_DOMAIN_MEMORY_MIN_GUARANTEE, + &min_guarantee); + if (min_guarantee) + nparams++; + if (nparams == 0) { /* get the number of memory parameters */ if ((virDomainGetMemoryParameters(dom, NULL, &nparams, 0) != 0) && @@ -2711,7 +2719,7 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) params[i].value.b); break; default: - vshPrint(ctl, "unimplemented scheduler parameter type\n"); + vshPrint(ctl, "unimplemented memory parameter type\n"); } } @@ -2746,6 +2754,11 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd) strncpy(temp->field, VIR_DOMAIN_SWAP_HARD_LIMIT, sizeof(temp->field)); swap_hard_limit = 0; + } else if (min_guarantee) { + temp->value.ul = min_guarantee; + strncpy(temp->field, VIR_DOMAIN_MEMORY_MIN_GUARANTEE, + sizeof(temp->field)); + min_guarantee = 0; } } if (virDomainSetMemoryParameters(dom, params, nparams, 0) != 0) diff --git a/tools/virsh.pod b/tools/virsh.pod index cb8e942..5f06360 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -460,7 +460,7 @@ kilobytes. Displays the domain memory parameters. -=item B<memtune> I<domain-id> optional I<--hard-limit> B<kilobytes> optional I<--soft-limit> B<kilobytes> optional I<--swap-hard-limit> B<kilobytes> +=item B<memtune> I<domain-id> optional I<--hard-limit> B<kilobytes> optional I<--soft-limit> B<kilobytes> optional I<--swap-hard-limit> B<kilobytes> -I<--min-guarantee> B<kilobytes> Allows you to set the domain memory parameters. LXC and QEMU/KVM supports these parameters.

On Mon, Oct 18, 2010 at 03:02:55PM +0530, Nikunj A. Dadhania wrote:
Hi,
I am adding the min_guarantee to the memtune command with this patch. I have tested this at the virsh tool level. This parameter is not supported by QEMU or LXC. Can be used by ESX and in future by other hypervisors.
Okay, makes sense, ACK, commited and pushed, thanks ! 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/

2010/10/18 Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>:
Hi,
I am adding the min_guarantee to the memtune command with this patch. I have tested this at the virsh tool level. This parameter is not supported by QEMU or LXC. Can be used by ESX and in future by other hypervisors.
Nikunj
From: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
tools/virsh.c: Add new memory tunable "min_guarantee", currently the user would be ESX.
Well, who said ESX could support this? :) I didn't, I just said that you added min_guarantee to libvirt, but didn't expose it in virsh. Matthias

On Tue, Oct 19, 2010 at 03:00:21PM +0200, Matthias Bolte wrote:
2010/10/18 Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>:
Hi,
I am adding the min_guarantee to the memtune command with this patch. I have tested this at the virsh tool level. This parameter is not supported by QEMU or LXC. Can be used by ESX and in future by other hypervisors.
Nikunj
From: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
tools/virsh.c: Add new memory tunable "min_guarantee", currently the user would be ESX.
Well, who said ESX could support this? :)
I didn't, I just said that you added min_guarantee to libvirt, but didn't expose it in virsh.
Hum ... I assumed there was an use case for it. On the other hand since it's now part of libvirt API as VIR_DOMAIN_MEMORY_MIN_GUARANTEE enum value, it's cleaner to have it available at the virsh level. If there is really no use (or no potential use in a reasonable future) for it, the best is to remove it altogether from the API and the of virsh, before next week release. Nikunj I could not find any reference to "the well-known tunable" min_guarantee (it's clearly not well known ...) but can you tell us where this comes from ? I would also appreciate a patch to include/libvirt/libvirt.h.in which change the comments for VIR_DOMAIN_MEMORY_HARD_LIMIT, VIR_DOMAIN_MEMORY_SOFT_LIMIT, VIR_DOMAIN_MEMORY_MIN_GUARANTEE, and VIR_DOMAIN_SWAP_HARD_LIMIT relapcing the non-reference "well known" with an actual description of what the tunable means. We cannot keep something that vague in the header and generated documentation, thanks, 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 Tue, 19 Oct 2010 15:49:05 +0200, Daniel Veillard <veillard@redhat.com> wrote:
On Tue, Oct 19, 2010 at 03:00:21PM +0200, Matthias Bolte wrote:
2010/10/18 Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>: [...]
tools/virsh.c: Add new memory tunable "min_guarantee", currently the user would be ESX.
Well, who said ESX could support this? :)
I didn't, I just said that you added min_guarantee to libvirt, but didn't expose it in virsh.
Hum ... I assumed there was an use case for it. On the other hand since it's now part of libvirt API as VIR_DOMAIN_MEMORY_MIN_GUARANTEE enum value, it's cleaner to have it available at the virsh level. If there is really no use (or no potential use in a reasonable future) for it, the best is to remove it altogether from the API and the of virsh, before next week release.
Nikunj I could not find any reference to "the well-known tunable" min_guarantee (it's clearly not well known ...) but can you tell us where this comes from ?
VMWare: ======= Reservation: Gauranteed lower bound on the amount of the physical memory that the host reserves for the VM even in case of the overcommit. The VM is allowed to allocate till this level and after it has hit the reservation, those pages are not reclaimed. In case, if guest is not using till the reservation, the host can use that portion of memory. And maybe in future cgroups.
I would also appreciate a patch to include/libvirt/libvirt.h.in which change the comments for VIR_DOMAIN_MEMORY_HARD_LIMIT, VIR_DOMAIN_MEMORY_SOFT_LIMIT, VIR_DOMAIN_MEMORY_MIN_GUARANTEE, and VIR_DOMAIN_SWAP_HARD_LIMIT relapcing the non-reference "well known" with an actual description of what the tunable means. We cannot keep something that vague in the header and generated documentation,
Sure, will send a patch Nikunj

2010/10/20 Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>:
On Tue, 19 Oct 2010 15:49:05 +0200, Daniel Veillard <veillard@redhat.com> wrote:
On Tue, Oct 19, 2010 at 03:00:21PM +0200, Matthias Bolte wrote:
2010/10/18 Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>: [...]
tools/virsh.c: Add new memory tunable "min_guarantee", currently the user would be ESX.
Well, who said ESX could support this? :)
I didn't, I just said that you added min_guarantee to libvirt, but didn't expose it in virsh.
Hum ... I assumed there was an use case for it. On the other hand since it's now part of libvirt API as VIR_DOMAIN_MEMORY_MIN_GUARANTEE enum value, it's cleaner to have it available at the virsh level. If there is really no use (or no potential use in a reasonable future) for it, the best is to remove it altogether from the API and the of virsh, before next week release.
Nikunj I could not find any reference to "the well-known tunable" min_guarantee (it's clearly not well known ...) but can you tell us where this comes from ?
VMWare: ======= Reservation: Gauranteed lower bound on the amount of the physical memory that the host reserves for the VM even in case of the overcommit. The VM is allowed to allocate till this level and after it has hit the reservation, those pages are not reclaimed. In case, if guest is not using till the reservation, the host can use that portion of memory.
And maybe in future cgroups.
Sorry, seems like I really did say that, but didn't remember doing so :( Yes, reservation maps to min_guarantee :) I'll add this to the ESX driver soon, so that we have at least one user for each memtuneable. Matthias

On Tue, 19 Oct 2010 15:00:21 +0200, Matthias Bolte <matthias.bolte@googlemail.com> wrote:
2010/10/18 Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>:
Hi,
I am adding the min_guarantee to the memtune command with this patch. I have tested this at the virsh tool level. This parameter is not supported by QEMU or LXC. Can be used by ESX and in future by other hypervisors.
Nikunj
From: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
tools/virsh.c: Add new memory tunable "min_guarantee", currently the user would be ESX.
Well, who said ESX could support this? :)
I guess you did: https://www.redhat.com/archives/libvir-list/2010-August/msg00613.html ======= "ESX itself also allows to set what's called memoryMinGaurantee in the thread, but this is not exposed in libvirt." ======= Nikunj
participants (3)
-
Daniel Veillard
-
Matthias Bolte
-
Nikunj A. Dadhania