diff --git a/tools/virsh.c b/tools/virsh.c index 17cc763052fe3d6c94010aae5941367eefbb16d0..4f8c49547b4f40c25972e98792c78222fdfc46ee 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2693,6 +2693,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} }; @@ -2700,7 +2702,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; @@ -2728,6 +2730,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) && @@ -2772,7 +2780,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"); } } @@ -2807,6 +2815,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 199046bc54a9ea981920d57d7843c7b01517b9fc..943a56325710d4caf91f3ca2b38fcbe638b23675 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -517,7 +517,7 @@ kilobytes. Displays the domain memory parameters. -=item B I optional I<--hard-limit> B optional I<--soft-limit> B optional I<--swap-hard-limit> B +=item B I optional I<--hard-limit> B optional I<--soft-limit> B optional I<--swap-hard-limit> B -I<--min-guarantee> B Allows you to set the domain memory parameters. LXC and QEMU/KVM supports these parameters.