Bug 1121583

Summary: non-root user can use memtune to set limits but it can't work
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, dyuan, jiahu, jmiao, jtomko, lhuang, mzhan, zpeng
Target Milestone: rc   
Target Release: 7.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-28 13:34:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Luyao Huang 2014-07-21 09:35:30 UTC
description of problem:
non-root user can use memtune to set limits but it can't work.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-29.el7_0.1.x86_64


How reproducible:
100%

Steps to Reproduce:
1.$ virsh uri
qemu:///session

2.$ virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     sdsd                           shut off

3.$ virsh memtune sdsd
hard_limit     : unlimited
soft_limit     : unlimited
swap_hard_limit: unlimited

4.$ virsh memtune sdsd --hard-limit 1024000 --soft-limit 1024000 --swap-hard-limit 1024000

5.$ virsh memtune sdsd
hard_limit     : 1024000
soft_limit     : 1024000
swap_hard_limit: 1024000

6.check in xml
$ virsh dumpxml sdsd
 <memtune>
    <hard_limit unit='KiB'>1024000</hard_limit>
    <soft_limit unit='KiB'>1024000</soft_limit>
    <swap_hard_limit unit='KiB'>1024000</swap_hard_limit>
  </memtune>

7.$ virsh start sdsd
Domain sdsd started

8.$ virsh memtune sdsd
error: Unable to get number of memory parameters
error: Requested operation is not valid: cgroup memory controller is not mounted

9.make sure there is no guest dir in cgroup

/sys/fs/cgroup/memory/machine.slice/

10.$ virsh memtune sdsd --hard-limit 1024000 --soft-limit 1024000 --swap-hard-limit 1024000 --live
error: Unable to change memory parameters
error: Requested operation is not valid: cgroup memory controller is not mounted

$ virsh memtune sdsd --hard-limit 1024000 --soft-limit 1024000 --swap-hard-limit 1024000
error: Unable to change memory parameters
error: Requested operation is not valid: cgroup memory controller is not mounted

$ virsh memtune sdsd --hard-limit 1024000 --soft-limit 1024000 --swap-hard-limit 1024000 --config


Actual results:
memtune can't work in non-root user although it can set hard-limit soft-limit swap-hard-limit in xml,
the output limit numerical value is not from cgroup and libvirt can't change cgroup in non-root user.


Expected results:
memtune can't be used in non-root and report error message should be:memtune can't use in user mode/session mode

Additional info:

Comment 2 Ján Tomko 2014-07-28 13:34:50 UTC

*** This bug has been marked as a duplicate of bug 1023366 ***