Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1245476 - error not right when set memtune but get failed
error not right when set memtune but get failed
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
x86_64 Linux
low Severity low
: rc
: ---
Assigned To: Libvirt Maintainers
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-07-22 03:24 EDT by Luyao Huang
Modified: 2016-11-03 14:20 EDT (History)
3 users (show)

See Also:
Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:20:04 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 08:07:06 EDT

  None (edit)
Description Luyao Huang 2015-07-22 03:24:00 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.
Comment 1 Luyao Huang 2015-07-22 03:37:36 EDT
I have sent a patch to upstream:

http://www.redhat.com/archives/libvir-list/2015-July/msg00831.html
Comment 2 Peter Krempa 2015-07-22 06:10:53 EDT
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
Comment 5 Luyao Huang 2016-06-01 04:19:20 EDT
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
Comment 7 errata-xmlrpc 2016-11-03 14:20:04 EDT
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

Note You need to log in before you can comment on or make changes to this bug.