Bug 1024272
Summary: | Changing --hard-limit with memtune report invalid error when --swap-hard-limit is unlimited. | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Hao Liu <hliu> |
Component: | libvirt | Assignee: | Martin Kletzander <mkletzan> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.0 | CC: | acathrow, dallan, dyuan, hliu, jmiao, lsu, mzhan |
Target Milestone: | rc | ||
Target Release: | 7.0 | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | libvirt-1.1.1-15.el7 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-06-13 12:05:29 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
Hao Liu
2013-10-29 09:45:24 UTC
In the following part of qemuDomainSetMemoryParameters() in src/qemu/qemu_driver.c , when the VM is fresh started, vm->def->mem.swap_hard_limit is 0, then the comparison is true. when --swap-hard-limit is manually set to -1, then vm->def->mem.swap_hard_limit is the maximum ulong, then this comparison is false. if (set_swap_hard_limit || set_hard_limit) { unsigned long long mem_limit = vm->def->mem.hard_limit; unsigned long long swap_limit = vm->def->mem.swap_hard_limit; if (set_swap_hard_limit) swap_limit = swap_hard_limit; if (set_hard_limit) mem_limit = hard_limit; if (virCompareLimitUlong(mem_limit, swap_limit) > 0) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("memory hard_limit tunable value must be lower " "than swap_hard_limit")); goto cleanup; } } So this might be caused by ambiguous representation of unlimited memory. Need to adopt this patch from upstream: commit 19e7c04dce34afeb9a762471e09777de7d219db8 Author: Bing Bu Cao <mars.ibm.com> Date: Fri Oct 11 14:50:33 2013 +0800 util: fix two virCompareLimitUlong bugs The helper function virCompareLimitUlong compares limit values, where value of 0 is equal to unlimited. If the latter parameter is 0, it should return -1 instead of 1, hence the user can only set hard_limit whe swap_hard_limit currently is unlimited. Worse, all callers pass 2 64-bit values, but on 32-bit platforms, the second argument was silently truncated to 32 bits, which could lead to incorrect computations. Thanks for the info, but unfortunately that's not enough since upstream is currently a bit broken as well. Rest of the upstream code is waiting for review (don't mind the misleading subject): https://www.redhat.com/archives/libvir-list/2013-December/msg00434.html and https://www.redhat.com/archives/libvir-list/2013-December/msg00501.html This fix is VERIFIED. Verification Steps: Same as https://bugzilla.redhat.com/show_bug.cgi?id=1024272#c0 In step 3: for libvirt-1.1.1-14.el7: # virsh memtune <vm-name> --live --hard-limit 100000000 error: Unable to change memory parameters error: invalid argument: memory hard_limit tunable value must be lower than swap_hard_limit for libvirt-1.1.1-15.el7: # virsh memtune <vm-name> --live --hard-limit 100000000 # virsh memtune <vm-name> --live hard_limit : 100000000 soft_limit : unlimited swap_hard_limit: unlimited So this bug is fixed and VERIFIED. This request was resolved in Red Hat Enterprise Linux 7.0. Contact your manager or support representative in case you have further questions about the request. |