Red Hat Bugzilla – Bug 1245476
error not right when set memtune but get failed
Last modified: 2016-11-03 14:20:04 EDT
Description of problem: error not right when set memtune but get failed Version-Release number of selected component (if applicable): libvirt-1.2.17-2.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. prepare a running guest: # virsh list Id Name State ---------------------------------------------------- 13 rhel7.0-rhel running 2. set some invalid memory hard limit : # virsh memtune rhel7.0-rhel 1 error: Unable to change memory parameters error: unable to set memory hard_limit tunable: Operation not permitted 3. check the log: 2015-07-22 07:13:14.560+0000: 28633: error : virCgroupSetValueStr:735 : Unable to write to '/sys/fs/cgroup/memory/machine.slice/machine-qemu\x2drhel7.0\x2drhel.scope/memory.limit_in_bytes': Device or resource busy 2015-07-22 07:13:14.560+0000: 28633: error : qemuDomainSetMemoryParameters:9909 : unable to set memory hard_limit tunable: Operation not permitted Actual results: memtune report Operation not permitted but should be Device or resource busy Expected results: not cover the error from the virCgroup*: Unable to write to '/sys/fs/cgroup/memory/machine.slice/machine-qemu\x2drhel7.0\x2drhel.scope/memory.limit_in_bytes': Device or resource busy or just: unable to set memory hard_limit tunable: Device or resource busy Additional info: We will report the error in the cgroup code after commit 0d7f45a, so the cgroup function will return -1, and as 1 is defined as: #define EPERM 1 /* Operation not permitted */ so we will always report Operation not permitted.
I have sent a patch to upstream: http://www.redhat.com/archives/libvir-list/2015-July/msg00831.html
Fixed upstream: commit 704cf06a14ca92dcb9be2c3db6bdf1b21f02e1f7 Author: Luyao Huang <lhuang@redhat.com> Date: Wed Jul 22 15:35:14 2015 +0800 qemu: fix the error cover issue in SetMemoryParameters https://bugzilla.redhat.com/show_bug.cgi?id=1245476 We won't return the errno after commit 0d7f45ae, and the more clearly error will be set in the code in vircgroup*. Also We will always report error "Operation not permitted", because the return is -1. Signed-off-by: Luyao Huang <lhuang@redhat.com> v1.2.17-158-g704cf06
Verify this bug on libvirt-1.3.4-1.el7.x86_64: 1. prepare a running guest: # virsh list --all Id Name State ---------------------------------------------------- 56 rhel72-test running 2. set set guest memory hard limit with a too small value: # virsh memtune rhel72-test 1 error: Unable to change memory parameters error: Unable to write to '/sys/fs/cgroup/memory/machine.slice/machine-qemu\x2d56\x2drhel72\x2dtest.scope/memory.limit_in_bytes': Device or resource busy 3. check libvirtd log: 2016-06-01 08:12:02.349+0000: 8702: error : virCgroupSetValueStr:788 : Unable to write to '/sys/fs/cgroup/memory/machine.slice/machine-qemu\x2d56\x2drhel72\x2dtest.scope/memory.limit_in_bytes': Device or resource busy
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2577.html