RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 680190 - unable to set swap_hard_limit tunable by virsh memtune
Summary: unable to set swap_hard_limit tunable by virsh memtune
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-24 15:48 UTC by Alex Jia
Modified: 2011-10-22 19:45 UTC (History)
9 users (show)

Fixed In Version: libvirt-0.8.7-16.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-19 13:28:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0596 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-05-18 17:56:36 UTC

Description Alex Jia 2011-02-24 15:48:54 UTC
Description of problem:
Unable to set swap_hard_limit tunable by virsh memtune, but it is okay if directly edit guest xml configuration.

Version-Release number of selected component (if applicable):
# rpm -q libvirt 
libvirt-0.8.7-7.el6.x86_64

# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.145.el6.x86_64

# uname -r
2.6.32-113.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. virsh start domainname
2. virsh memtune domainname --swap-hard-limit size(kb)

  
Actual results:
# virsh memtune vr-rhel6-x86_64-kvm --swap-hard-limit 65536
error: Unable to change memory parameters
error: unable to set swap_hard_limit tunable: Invalid argument



Expected results:
can to set swap_hard_limit tunable by virsh command

Additional info:
# virsh start vr-rhel6-x86_64-kvm
Domain vr-rhel6-x86_64-kvm started

# virsh memtune vr-rhel6-x86_64-kvm
hard_limit     : unlimited
soft_limit     : unlimited
swap_hard_limit: unlimited

and can get these values via cgget:

# cgget -nr memory.limit_in_bytes libvirt/qemu/vr-rhel6-x86_64-kvm
memory.limit_in_bytes=9223372036854775807

# cgget -nr memory.soft_limit_in_bytes libvirt/qemu/vr-rhel6-x86_64-kvm
memory.soft_limit_in_bytes=9223372036854775807

# cgget -nr memory.memsw.limit_in_bytes libvirt/qemu/vr-rhel6-x86_64-kvm
memory.memsw.limit_in_bytes=9223372036854775807

# virsh memtune vr-rhel6-x86_64-kvm --swap-hard-limit 65536
error: Unable to change memory parameters
error: unable to set swap_hard_limit tunable: Invalid argument


But it's okay if directly edit guest xml configuration and add <memtune> block xml into guest xml:

# virsh edit vr-rhel6u1-x86_64-kvm

# virsh dumpxml vr-rhel6u1-x86_64-kvm
......
  <memory>2097152</memory>
  <currentMemory>1048576</currentMemory>
  <memtune>
    <hard_limit>512000</hard_limit>
    <soft_limit>128000</soft_limit>
    <swap_hard_limit>1024000</swap_hard_limit>
  </memtune>
  <vcpu>1</vcpu>
......

# virsh start vr-rhel6u1-x86_64-kvm
Domain vr-rhel6u1-x86_64-kvm started

# virsh memtune vr-rhel6u1-x86_64-kvm
hard_limit     : 512000 kB
soft_limit     : 128000 kB
swap_hard_limit: 1024000 kB

# cgget -nr memory.limit_in_bytes libvirt/qemu/vr-rhel6u1-x86_64-kvm
memory.limit_in_bytes=524288000

# cgget -nr memory.soft_limit_in_bytes libvirt/qemu/vr-rhel6u1-x86_64-kvm
memory.soft_limit_in_bytes=131072000

# cgget -nr memory.memsw.limit_in_bytes libvirt/qemu/vr-rhel6u1-x86_64-kvm
memory.memsw.limit_in_bytes=1048576000

Comment 1 Osier Yang 2011-03-02 09:44:17 UTC
Too small value is given for "swap hard limit".

virsh # start test
Domain test started

virsh # memtune test
hard_limit     : unlimited
soft_limit     : unlimited
swap_hard_limit: unlimited

virsh # memtune test --hard-limit 1024000

virsh # memtune test --swap-hard-limit 1023000
error: Unable to change memory parameters
error: unable to set swap_hard_limit tunable: Invalid argument

virsh # memtune test --swap-hard-limit 1024000

virsh # memtune test --swap-hard-limit 1024001

virsh # memtune test
hard_limit     : 1024000 kB
soft_limit     : unlimited
swap_hard_limit: 1024004 kB

virsh # memtune test --swap-hard-limit 1023999

virsh # memtune test
hard_limit     : 1024000 kB
soft_limit     : unlimited
swap_hard_limit: 1024000 kB

NB, 1024001 is rounded up to 1024004, 1023999 is rounded up to 1024000.

I beleive if you set value of "<swap_hard_limit>" smaller than of "<hard_limit>", same error will be raised up.

Note that "memsw" means "memory+swap", so, somehow it's NOTABUG, but probly we need doc improvements.

Comment 2 Osier Yang 2011-03-31 09:11:53 UTC
upstream 78ba748ef1 fix the document problem.

Comment 3 Jiri Denemark 2011-03-31 09:35:38 UTC
The upstream commit

commit 78ba748ef14c520ff1c4af2b5b0a44586ac49c8c
Author: Nikunj A. Dadhania <nikunj.ibm.com>
Date:   Wed Mar 16 10:37:12 2011 +0530

    virsh: fix memtune's help message for swap_hard_limit

is incomplete and needs a follow-up patch.

Comment 4 Jiri Denemark 2011-03-31 09:53:46 UTC
The follow-up patch has been sent upstream: https://www.redhat.com/archives/libvir-list/2011-March/msg01506.html

Comment 7 Alex Jia 2011-04-14 09:41:29 UTC
# virsh memtune rhel6_x86_64_kvm
error: Unable to get number of memory parameters
error: this function is not supported by the connection driver: qemuDomainGetMemoryParameters


Current kvm hypervisor doesn't support the function, Is this a expected result? 

Additional info:

# virsh list 
 Id Name                 State
----------------------------------
  2 rhel6_x86_64_kvm     running

# virsh dominfo rhel6_x86_64_kvm
Id:             2
Name:           rhel6_x86_64_kvm
UUID:           82092589-bce2-6e75-ecd4-d0ffa9e36651
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       37.1s
Max memory:     524288 kB
Used memory:    524288 kB
Persistent:     yes
Autostart:      disable
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c17,c124 (enforcing)

# uname -r
2.6.32-130.el6.x86_64

# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.153.el6.x86_64

# rpm -q libvirt
libvirt-0.8.7-16.el6.x86_64

Comment 8 Jiri Denemark 2011-04-15 12:43:41 UTC
No, that's not expected. Are you sure you are running the right libvirtd version? virsh memtune works as expected for me with the latest
libvirt-0.8.7-17.el6 package.

Comment 9 Alex Jia 2011-04-18 05:40:57 UTC
(In reply to comment #8)
> No, that's not expected. Are you sure you are running the right libvirtd
> version? virsh memtune works as expected for me with the latest
> libvirt-0.8.7-17.el6 package.

Hi Jiri,
I saw 'Fixed In Version: libvirt-0.8.7-16.el6' on the right top, so I used -16 version to verify the bug, please update 'Fixed In Version' for the bug.

And will use -17 to verify the bug again.

Alex

Comment 10 Alex Jia 2011-04-18 07:00:33 UTC
The bug has been verified on rhel6.1 snapshot3(2.6.32-130.el6.x86_64) with libvirt-0.8.7-17.el6.x86_64.

# virsh start rhel6_x86_64_kvm
Domain rhel6_x86_64_kvm started

# virsh memtune rhel6_x86_64_kvm
hard_limit     : unlimited
soft_limit     : unlimited
swap_hard_limit: unlimited

# virsh memtune rhel6_x86_64_kvm --hard-limit 1024000

# virsh memtune rhel6_x86_64_kvm
hard_limit     : 1024000 kB
soft_limit     : unlimited
swap_hard_limit: unlimited


# virsh memtune rhel6_x86_64_kvm --swap-hard-limit 1024000

# virsh memtune rhel6_x86_64_kvm
hard_limit     : 1024000 kB
soft_limit     : unlimited
swap_hard_limit: 1024000 kB

# virsh memtune rhel6_x86_64_kvm --swap-hard-limit 1024001

[root@localhost Libvirt]# virsh memtune rhel6_x86_64_kvm
hard_limit     : 1024000 kB
soft_limit     : unlimited
swap_hard_limit: 1024004 kB

# virsh memtune rhel6_x86_64_kvm --swap-hard-limit 1023999

# virsh memtune rhel6_x86_64_kvm
hard_limit     : 1024000 kB
soft_limit     : unlimited
swap_hard_limit: 1024000 kB

Comment 11 Jiri Denemark 2011-04-18 07:33:30 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > No, that's not expected. Are you sure you are running the right libvirtd
> > version? virsh memtune works as expected for me with the latest
> > libvirt-0.8.7-17.el6 package.
> 
> Hi Jiri,
> I saw 'Fixed In Version: libvirt-0.8.7-16.el6' on the right top, so I used -16
> version to verify the bug, please update 'Fixed In Version' for the bug.

It should also work with -16 and even older packages. The only thing we fixed for this BZ was documentation of memtune command and that was done in -16 so Fixed In Version is correct. Since you got an error about unsupported qemuDomainGetMemoryParameters API, an ancient libvirtd must have been running.

Comment 14 errata-xmlrpc 2011-05-19 13:28:13 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0596.html

Comment 15 Trey Dockendorf 2011-10-22 19:45:29 UTC
This still seems to be a problem in 0.8.7-18.  The memtune function does not seem supported.

# virsh memtune store_0
error: Unable to get number of memory parameters
error: this function is not supported by the connection driver: qemuDomainGetMemoryParameters


# virsh dominfo store_0
Id:             4
Name:           store_0
UUID:           2b4b0dab-4160-d396-34be-10572b478dd6
OS Type:        hvm
State:          running
CPU(s):         1
CPU time:       153.4s
Max memory:     2048000 kB
Used memory:    2048000 kB
Persistent:     yes
Autostart:      disable
Security model: selinux
Security DOI:   0
Security label: system_u:system_r:svirt_t:s0:c194,c863 (enforcing)

# uname -r
2.6.32-131.17.1.el6.x86_64

# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.160.el6_1.8.x86_64

# rpm -q libvirt
libvirt-0.8.7-18.el6_1.1.x86_64


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