mirror of https://gitee.com/openkylin/libvirt.git
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>
|
||||
<dt><code>swap_hard_limit</code></dt>
|
||||
<dd> The optional <code>swap_hard_limit</code> element is the maximum
|
||||
swap the guest can use. The units for this value are kilobytes
|
||||
(i.e. blocks of 1024 bytes)</dd>
|
||||
memory plus swap the guest can use. The units for this value are
|
||||
kilobytes (i.e. blocks of 1024 bytes). This has to be more than
|
||||
hard_limit value provided</dd>
|
||||
<dt><code>min_guarantee</code></dt>
|
||||
<dd> The optional <code>min_guarantee</code> element is the guaranteed
|
||||
minimum memory allocation for the guest. The units for this value are
|
||||
|
|
|
@ -805,7 +805,8 @@ typedef enum {
|
|||
* VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT:
|
||||
*
|
||||
* 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"
|
||||
|
|
|
@ -74,10 +74,10 @@ virCgroupGetFreezerState;
|
|||
virCgroupGetMemoryHardLimit;
|
||||
virCgroupGetMemorySoftLimit;
|
||||
virCgroupGetMemoryUsage;
|
||||
virCgroupGetSwapHardLimit;
|
||||
virCgroupGetMemSwapHardLimit;
|
||||
virCgroupKill;
|
||||
virCgroupKillRecursive;
|
||||
virCgroupKillPainfully;
|
||||
virCgroupKillRecursive;
|
||||
virCgroupMounted;
|
||||
virCgroupPathOfController;
|
||||
virCgroupRemove;
|
||||
|
@ -87,7 +87,7 @@ virCgroupSetFreezerState;
|
|||
virCgroupSetMemory;
|
||||
virCgroupSetMemoryHardLimit;
|
||||
virCgroupSetMemorySoftLimit;
|
||||
virCgroupSetSwapHardLimit;
|
||||
virCgroupSetMemSwapHardLimit;
|
||||
|
||||
|
||||
# command.h
|
||||
|
|
|
@ -146,7 +146,7 @@ static int lxcSetContainerResources(virDomainDefPtr def)
|
|||
}
|
||||
|
||||
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) {
|
||||
virReportSystemError(-rc,
|
||||
_("Unable to set swap hard limit for domain %s"),
|
||||
|
|
|
@ -779,7 +779,7 @@ static int lxcDomainSetMemoryParameters(virDomainPtr dom,
|
|||
continue;
|
||||
}
|
||||
|
||||
rc = virCgroupSetSwapHardLimit(cgroup, params[i].value.ul);
|
||||
rc = virCgroupSetMemSwapHardLimit(cgroup, params[i].value.ul);
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc, "%s",
|
||||
_("unable to set swap_hard_limit tunable"));
|
||||
|
@ -885,7 +885,7 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom,
|
|||
break;
|
||||
|
||||
case 2: /* fill swap hard limit here */
|
||||
rc = virCgroupGetSwapHardLimit(cgroup, &val);
|
||||
rc = virCgroupGetMemSwapHardLimit(cgroup, &val);
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc, "%s",
|
||||
_("unable to get swap hard limit"));
|
||||
|
|
|
@ -330,7 +330,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
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) {
|
||||
virReportSystemError(-rc,
|
||||
_("Unable to set swap hard limit for domain %s"),
|
||||
|
|
|
@ -4721,7 +4721,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
|
|||
continue;
|
||||
}
|
||||
|
||||
rc = virCgroupSetSwapHardLimit(group, params[i].value.ul);
|
||||
rc = virCgroupSetMemSwapHardLimit(group, params[i].value.ul);
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc, "%s",
|
||||
_("unable to set swap_hard_limit tunable"));
|
||||
|
@ -4832,7 +4832,7 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
|
|||
break;
|
||||
|
||||
case 2: /* fill swap hard limit here */
|
||||
rc = virCgroupGetSwapHardLimit(group, &val);
|
||||
rc = virCgroupGetMemSwapHardLimit(group, &val);
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc, "%s",
|
||||
_("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
|
||||
* @kb: The swap amount in kilobytes
|
||||
* @group: The cgroup to change mem+swap hard limit for
|
||||
* @kb: The mem+swap amount in kilobytes
|
||||
*
|
||||
* 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;
|
||||
|
||||
|
@ -1059,14 +1059,14 @@ int virCgroupSetSwapHardLimit(virCgroupPtr group, unsigned long long kb)
|
|||
}
|
||||
|
||||
/**
|
||||
* virCgroupGetSwapHardLimit:
|
||||
* virCgroupGetMemSwapHardLimit:
|
||||
*
|
||||
* @group: The cgroup to get swap hard limit for
|
||||
* @kb: The swap amount in kilobytes
|
||||
* @group: The cgroup to get mem+swap hard limit for
|
||||
* @kb: The mem+swap amount in kilobytes
|
||||
*
|
||||
* 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;
|
||||
int ret;
|
||||
|
|
|
@ -57,8 +57,8 @@ int virCgroupSetMemoryHardLimit(virCgroupPtr group, unsigned long long kb);
|
|||
int virCgroupGetMemoryHardLimit(virCgroupPtr group, unsigned long long *kb);
|
||||
int virCgroupSetMemorySoftLimit(virCgroupPtr group, unsigned long long kb);
|
||||
int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb);
|
||||
int virCgroupSetSwapHardLimit(virCgroupPtr group, unsigned long long kb);
|
||||
int virCgroupGetSwapHardLimit(virCgroupPtr group, unsigned long long *kb);
|
||||
int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long long kb);
|
||||
int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb);
|
||||
|
||||
enum {
|
||||
VIR_CGROUP_DEVICE_READ = 1,
|
||||
|
|
Loading…
Reference in New Issue