mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virsh: fix memtune's help message for swap_hard_limit
* Correct the documentation for cgroup: the swap_hard_limit indicates mem+swap_hard_limit. * Change cgroup private apis to: virCgroupGet/SetMemSwapHardLimit Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
This commit is contained in:
parent
2090b0f52d
commit
78ba748ef1
@ -325,8 +325,9 @@
|
|||||||
kilobytes (i.e. blocks of 1024 bytes)</dd>
|
kilobytes (i.e. blocks of 1024 bytes)</dd>
|
||||||
<dt><code>swap_hard_limit</code></dt>
|
<dt><code>swap_hard_limit</code></dt>
|
||||||
<dd> The optional <code>swap_hard_limit</code> element is the maximum
|
<dd> The optional <code>swap_hard_limit</code> element is the maximum
|
||||||
swap the guest can use. The units for this value are kilobytes
|
memory plus swap the guest can use. The units for this value are
|
||||||
(i.e. blocks of 1024 bytes)</dd>
|
kilobytes (i.e. blocks of 1024 bytes). This has to be more than
|
||||||
|
hard_limit value provided</dd>
|
||||||
<dt><code>min_guarantee</code></dt>
|
<dt><code>min_guarantee</code></dt>
|
||||||
<dd> The optional <code>min_guarantee</code> element is the guaranteed
|
<dd> The optional <code>min_guarantee</code> element is the guaranteed
|
||||||
minimum memory allocation for the guest. The units for this value are
|
minimum memory allocation for the guest. The units for this value are
|
||||||
|
@ -805,7 +805,8 @@ typedef enum {
|
|||||||
* VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT:
|
* VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT:
|
||||||
*
|
*
|
||||||
* Macro for the swap tunable swap_hard_limit: it represents the maximum swap
|
* Macro for the swap tunable swap_hard_limit: it represents the maximum swap
|
||||||
* the guest can use.
|
* plus memory the guest can use. This limit has to be more than
|
||||||
|
* VIR_DOMAIN_MEMORY_HARD_LIMIT.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT "swap_hard_limit"
|
#define VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT "swap_hard_limit"
|
||||||
|
@ -74,10 +74,10 @@ virCgroupGetFreezerState;
|
|||||||
virCgroupGetMemoryHardLimit;
|
virCgroupGetMemoryHardLimit;
|
||||||
virCgroupGetMemorySoftLimit;
|
virCgroupGetMemorySoftLimit;
|
||||||
virCgroupGetMemoryUsage;
|
virCgroupGetMemoryUsage;
|
||||||
virCgroupGetSwapHardLimit;
|
virCgroupGetMemSwapHardLimit;
|
||||||
virCgroupKill;
|
virCgroupKill;
|
||||||
virCgroupKillRecursive;
|
|
||||||
virCgroupKillPainfully;
|
virCgroupKillPainfully;
|
||||||
|
virCgroupKillRecursive;
|
||||||
virCgroupMounted;
|
virCgroupMounted;
|
||||||
virCgroupPathOfController;
|
virCgroupPathOfController;
|
||||||
virCgroupRemove;
|
virCgroupRemove;
|
||||||
@ -87,7 +87,7 @@ virCgroupSetFreezerState;
|
|||||||
virCgroupSetMemory;
|
virCgroupSetMemory;
|
||||||
virCgroupSetMemoryHardLimit;
|
virCgroupSetMemoryHardLimit;
|
||||||
virCgroupSetMemorySoftLimit;
|
virCgroupSetMemorySoftLimit;
|
||||||
virCgroupSetSwapHardLimit;
|
virCgroupSetMemSwapHardLimit;
|
||||||
|
|
||||||
|
|
||||||
# command.h
|
# command.h
|
||||||
|
@ -146,7 +146,7 @@ static int lxcSetContainerResources(virDomainDefPtr def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (def->mem.swap_hard_limit) {
|
if (def->mem.swap_hard_limit) {
|
||||||
rc = virCgroupSetSwapHardLimit(cgroup, def->mem.swap_hard_limit);
|
rc = virCgroupSetMemSwapHardLimit(cgroup, def->mem.swap_hard_limit);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc,
|
virReportSystemError(-rc,
|
||||||
_("Unable to set swap hard limit for domain %s"),
|
_("Unable to set swap hard limit for domain %s"),
|
||||||
|
@ -779,7 +779,7 @@ static int lxcDomainSetMemoryParameters(virDomainPtr dom,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = virCgroupSetSwapHardLimit(cgroup, params[i].value.ul);
|
rc = virCgroupSetMemSwapHardLimit(cgroup, params[i].value.ul);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc, "%s",
|
virReportSystemError(-rc, "%s",
|
||||||
_("unable to set swap_hard_limit tunable"));
|
_("unable to set swap_hard_limit tunable"));
|
||||||
@ -885,7 +885,7 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* fill swap hard limit here */
|
case 2: /* fill swap hard limit here */
|
||||||
rc = virCgroupGetSwapHardLimit(cgroup, &val);
|
rc = virCgroupGetMemSwapHardLimit(cgroup, &val);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc, "%s",
|
virReportSystemError(-rc, "%s",
|
||||||
_("unable to get swap hard limit"));
|
_("unable to get swap hard limit"));
|
||||||
|
@ -330,7 +330,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vm->def->mem.swap_hard_limit != 0) {
|
if (vm->def->mem.swap_hard_limit != 0) {
|
||||||
rc = virCgroupSetSwapHardLimit(cgroup, vm->def->mem.swap_hard_limit);
|
rc = virCgroupSetMemSwapHardLimit(cgroup, vm->def->mem.swap_hard_limit);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc,
|
virReportSystemError(-rc,
|
||||||
_("Unable to set swap hard limit for domain %s"),
|
_("Unable to set swap hard limit for domain %s"),
|
||||||
|
@ -4721,7 +4721,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = virCgroupSetSwapHardLimit(group, params[i].value.ul);
|
rc = virCgroupSetMemSwapHardLimit(group, params[i].value.ul);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc, "%s",
|
virReportSystemError(-rc, "%s",
|
||||||
_("unable to set swap_hard_limit tunable"));
|
_("unable to set swap_hard_limit tunable"));
|
||||||
@ -4832,7 +4832,7 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* fill swap hard limit here */
|
case 2: /* fill swap hard limit here */
|
||||||
rc = virCgroupGetSwapHardLimit(group, &val);
|
rc = virCgroupGetMemSwapHardLimit(group, &val);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc, "%s",
|
virReportSystemError(-rc, "%s",
|
||||||
_("unable to get swap hard limit"));
|
_("unable to get swap hard limit"));
|
||||||
|
@ -1033,14 +1033,14 @@ int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virCgroupSetSwapHardLimit:
|
* virCgroupSetMemSwapHardLimit:
|
||||||
*
|
*
|
||||||
* @group: The cgroup to change swap hard limit for
|
* @group: The cgroup to change mem+swap hard limit for
|
||||||
* @kb: The swap amount in kilobytes
|
* @kb: The mem+swap amount in kilobytes
|
||||||
*
|
*
|
||||||
* Returns: 0 on success
|
* Returns: 0 on success
|
||||||
*/
|
*/
|
||||||
int virCgroupSetSwapHardLimit(virCgroupPtr group, unsigned long long kb)
|
int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long long kb)
|
||||||
{
|
{
|
||||||
unsigned long long maxkb = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
|
unsigned long long maxkb = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
|
||||||
|
|
||||||
@ -1059,14 +1059,14 @@ int virCgroupSetSwapHardLimit(virCgroupPtr group, unsigned long long kb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virCgroupGetSwapHardLimit:
|
* virCgroupGetMemSwapHardLimit:
|
||||||
*
|
*
|
||||||
* @group: The cgroup to get swap hard limit for
|
* @group: The cgroup to get mem+swap hard limit for
|
||||||
* @kb: The swap amount in kilobytes
|
* @kb: The mem+swap amount in kilobytes
|
||||||
*
|
*
|
||||||
* Returns: 0 on success
|
* Returns: 0 on success
|
||||||
*/
|
*/
|
||||||
int virCgroupGetSwapHardLimit(virCgroupPtr group, unsigned long long *kb)
|
int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb)
|
||||||
{
|
{
|
||||||
long long unsigned int limit_in_bytes;
|
long long unsigned int limit_in_bytes;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -57,8 +57,8 @@ int virCgroupSetMemoryHardLimit(virCgroupPtr group, unsigned long long kb);
|
|||||||
int virCgroupGetMemoryHardLimit(virCgroupPtr group, unsigned long long *kb);
|
int virCgroupGetMemoryHardLimit(virCgroupPtr group, unsigned long long *kb);
|
||||||
int virCgroupSetMemorySoftLimit(virCgroupPtr group, unsigned long long kb);
|
int virCgroupSetMemorySoftLimit(virCgroupPtr group, unsigned long long kb);
|
||||||
int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb);
|
int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb);
|
||||||
int virCgroupSetSwapHardLimit(virCgroupPtr group, unsigned long long kb);
|
int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long long kb);
|
||||||
int virCgroupGetSwapHardLimit(virCgroupPtr group, unsigned long long *kb);
|
int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VIR_CGROUP_DEVICE_READ = 1,
|
VIR_CGROUP_DEVICE_READ = 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user