Bug 1146539
| Summary: | Setting value to 0 will not turn to be unlimited with virsh command memtune | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Xuesong Zhang <xuzhang> |
| Component: | libvirt | Assignee: | Pavel Hrdina <phrdina> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.1 | CC: | dyuan, honzhang, lhuang, mzhan, rbalakri |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.16-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 05:53:19 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
Xuesong Zhang
2014-09-25 12:57:18 UTC
*** Bug 1146540 has been marked as a duplicate of this bug. *** Upstream patches proposed: https://www.redhat.com/archives/libvir-list/2015-March/msg00139.html Upstream commit:
commit cf521fc8bae5aa8bfb28806ced8ac3a9f58b0627
Author: Pavel Hrdina <phrdina>
Date: Mon Mar 2 20:04:12 2015 +0100
memtune: change the way how we store unlimited value
There was a mess in the way how we store unlimited value for memory
limits and how we handled values provided by user. Internally there
were two possible ways how to store unlimited value: as 0 value or as
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED. Because we chose to store memory
limits as unsigned long long, we cannot use -1 to represent unlimited.
It's much easier for us to say that everything greater than
VIR_DOMAIN_MEMORY_PARAM_UNLIMITED means unlimited and leave 0 as valid
value despite that it makes no sense to set limit to 0.
Remove unnecessary function virCompareLimitUlong. The update of test
is to prevent the 0 to be miss-used as unlimited in future.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1146539
Signed-off-by: Pavel Hrdina <phrdina>
v1.2.13-71-gcf521fc
Verify this bug in libvirt-1.2.17-2.el7.x86_64:
1. test with running guest:
# uname -r
3.10.0-295.el7.x86_64
# virsh memtune test4
hard_limit : unlimited
soft_limit : unlimited
swap_hard_limit: unlimited
2. set a valid value:
# virsh memtune test4 --hard-limit 10000
# cgget -g memory /machine.slice/machine-qemu\\x2dtest4.scope |grep limit_in_bytes
memory.kmem.tcp.limit_in_bytes: 9223372036854775807
memory.memsw.limit_in_bytes: 9223372036854775807
memory.kmem.limit_in_bytes: 9223372036854775807
memory.soft_limit_in_bytes: 9223372036854775807
memory.limit_in_bytes: 10240000
3. set to -1 :
# cgget -g memory /machine.slice/machine-qemu\\x2dtest4.scope |grep limit_in_bytes
memory.kmem.tcp.limit_in_bytes: 9223372036854775807
memory.memsw.limit_in_bytes: 9223372036854775807
memory.kmem.limit_in_bytes: 9223372036854775807
memory.soft_limit_in_bytes: 9223372036854775807
memory.limit_in_bytes: 9223372036854775807
4. there are some kernel issue when set hard limit to 0:
# virsh memtune test4 --hard-limit 0
error: Unable to change memory parameters
error: unable to set memory hard_limit tunable: Operation not permitted
# virsh memtune test4 --hard-limit 0
error: Unable to change memory parameters
error: unable to set memory hard_limit tunable: Operation not permitted
# virsh memtune test4 --hard-limit 0
error: Unable to change memory parameters
error: unable to set memory hard_limit tunable: Operation not permitted
# virsh memtune test4 --hard-limit 0
# virsh domstate test4 --reason
shut off (crashed)
5. test with inactive guest:
# virsh memtune test4 0 0 0
# virsh memtune test4
hard_limit : 0
soft_limit : 0
swap_hard_limit: 0
# virsh dumpxml test4
<memtune>
<hard_limit unit='KiB'>0</hard_limit>
<soft_limit unit='KiB'>0</soft_limit>
<swap_hard_limit unit='KiB'>0</swap_hard_limit>
</memtune>
# virsh memtune test4 -1 -1 -1
# virsh memtune test4
hard_limit : unlimited
soft_limit : unlimited
swap_hard_limit: unlimited
# virsh memtune test4 9007199254740991 9007199254740991 9007199254740991
# virsh memtune test4
hard_limit : unlimited
soft_limit : unlimited
swap_hard_limit: unlimited
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/RHBA-2015-2202.html |