mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-06 21:15:22 +00:00
qemuSetupMemoryCgroup: Handle hard_limit properly
Since 16bcb3 we have a regression. The hard_limit is set
unconditionally. By default the limit is zero. Hence, if user hasn't
configured any, we set the zero in cgroup subsystem making the kernel
kill the corresponding qemu process immediately. The proper fix is to
set hard_limit iff user has configured any.
(cherry picked from commit 94a24dd3a9
)
Conflicts:
src/qemu/qemu_cgroup.c
This commit is contained in:
parent
9421fd0010
commit
11253a09f2
@ -618,12 +618,14 @@ int qemuSetupCgroup(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
if (virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
|
||||
rc = virCgroupSetMemoryHardLimit(priv->cgroup, vm->def->mem.hard_limit);
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc,
|
||||
_("Unable to set memory hard limit for domain %s"),
|
||||
vm->def->name);
|
||||
goto cleanup;
|
||||
if (vm->def->mem.hard_limit != 0) {
|
||||
rc = virCgroupSetMemoryHardLimit(priv->cgroup, vm->def->mem.hard_limit);
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc,
|
||||
_("Unable to set memory hard limit for domain %s"),
|
||||
vm->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
if (vm->def->mem.soft_limit != 0) {
|
||||
rc = virCgroupSetMemorySoftLimit(priv->cgroup, vm->def->mem.soft_limit);
|
||||
|
Loading…
Reference in New Issue
Block a user