mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Adding memtunables to libvirt-lxc command
libvirt-lxc now configures the hardlimit, softlimit and swaplimit, if specified in the domain xml file or picks up the defaults.
This commit is contained in:
parent
261ad74e52
commit
809e143004
@ -110,6 +110,36 @@ static int lxcSetContainerResources(virDomainDefPtr def)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(def->mem.hard_limit) {
|
||||||
|
rc = virCgroupSetMemoryHardLimit(cgroup, def->mem.hard_limit);
|
||||||
|
if (rc != 0) {
|
||||||
|
virReportSystemError(-rc,
|
||||||
|
_("Unable to set memory hard limit for domain %s"),
|
||||||
|
def->name);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(def->mem.soft_limit) {
|
||||||
|
rc = virCgroupSetMemorySoftLimit(cgroup, def->mem.soft_limit);
|
||||||
|
if (rc != 0) {
|
||||||
|
virReportSystemError(-rc,
|
||||||
|
_("Unable to set memory soft limit for domain %s"),
|
||||||
|
def->name);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(def->mem.swap_hard_limit) {
|
||||||
|
rc = virCgroupSetSwapHardLimit(cgroup, def->mem.swap_hard_limit);
|
||||||
|
if (rc != 0) {
|
||||||
|
virReportSystemError(-rc,
|
||||||
|
_("Unable to set swap hard limit for domain %s"),
|
||||||
|
def->name);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rc = virCgroupDenyAllDevices(cgroup);
|
rc = virCgroupDenyAllDevices(cgroup);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
virReportSystemError(-rc,
|
virReportSystemError(-rc,
|
||||||
|
Loading…
Reference in New Issue
Block a user