[libvirt] [PATCH 0/2]fix two bugs when using virsh memtune

Patch 2/2 fix BZ: https://bugzilla.redhat.com/show_bug.cgi?id=911998 Guannan Ren(2) [PATCH 1/2] util: fix a integer boundary error [PATCH 2/2] qemu: update domain live xml for virsh memtune with src/qemu/qemu_driver.c | 36 +++++++++++++++++++++--------------- src/util/virutil.c | 2 +- 2 files changed, 22 insertions(+), 16 deletions(-)

A value which is equal to a integer maximum such as LLONG_MAX is a valid integer value. The patch fix the following error: 1, virsh memtune vm --swap-hard-limit -1 2, virsh start vm In debug mode, it shows error like: virScaleInteger:1813 : numerical overflow:\ value too large: 9007199254740991KiB --- src/util/virutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virutil.c b/src/util/virutil.c index 4af2599..4605c78 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -1809,7 +1809,7 @@ virScaleInteger(unsigned long long *value, const char *suffix, } } - if (*value && *value >= (limit / scale)) { + if (*value && *value > (limit / scale)) { virReportError(VIR_ERR_OVERFLOW, _("value too large: %llu%s"), *value, suffix); return -1; -- 1.7.11.2

On 03/05/2013 09:29 AM, Guannan Ren wrote:
A value which is equal to a integer maximum such as LLONG_MAX is a valid integer value.
The patch fix the following error: 1, virsh memtune vm --swap-hard-limit -1 2, virsh start vm In debug mode, it shows error like: virScaleInteger:1813 : numerical overflow:\ value too large: 9007199254740991KiB --- src/util/virutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Mar 5, 2013 at 10:50 AM, Eric Blake <eblake@redhat.com> wrote:
On 03/05/2013 09:29 AM, Guannan Ren wrote:
A value which is equal to a integer maximum such as LLONG_MAX is a valid integer value.
The patch fix the following error: 1, virsh memtune vm --swap-hard-limit -1 2, virsh start vm In debug mode, it shows error like: virScaleInteger:1813 : numerical overflow:\ value too large: 9007199254740991KiB --- src/util/virutil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ACK.
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Backported to v1.0.3-maint. Thanks. -- Doug Goldstein

virsh subcommand memtune forgot updating domain live xml after setting cgroup value. --- src/qemu/qemu_driver.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 42b8c77..32b0522 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7303,11 +7303,13 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, } if (set_swap_hard_limit) { - if (flags & VIR_DOMAIN_AFFECT_LIVE && - (rc = virCgroupSetMemSwapHardLimit(group, swap_hard_limit)) < 0) { - virReportSystemError(-rc, "%s", - _("unable to set memory swap_hard_limit tunable")); - goto cleanup; + if (flags & VIR_DOMAIN_AFFECT_LIVE) { + if ((rc = virCgroupSetMemSwapHardLimit(group, swap_hard_limit)) < 0) { + virReportSystemError(-rc, "%s", + _("unable to set memory swap_hard_limit tunable")); + goto cleanup; + } + vm->def->mem.swap_hard_limit = swap_hard_limit; } if (flags & VIR_DOMAIN_AFFECT_CONFIG) @@ -7315,11 +7317,13 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, } if (set_memory_hard_limit) { - if (flags & VIR_DOMAIN_AFFECT_LIVE && - (rc = virCgroupSetMemoryHardLimit(group, memory_hard_limit)) < 0) { - virReportSystemError(-rc, "%s", - _("unable to set memory hard_limit tunable")); - goto cleanup; + if (flags & VIR_DOMAIN_AFFECT_LIVE) { + if ((rc = virCgroupSetMemoryHardLimit(group, memory_hard_limit)) < 0) { + virReportSystemError(-rc, "%s", + _("unable to set memory hard_limit tunable")); + goto cleanup; + } + vm->def->mem.hard_limit = memory_hard_limit; } if (flags & VIR_DOMAIN_AFFECT_CONFIG) @@ -7327,11 +7331,13 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, } if (set_memory_soft_limit) { - if (flags & VIR_DOMAIN_AFFECT_LIVE && - (rc = virCgroupSetMemorySoftLimit(group, memory_soft_limit)) < 0) { - virReportSystemError(-rc, "%s", - _("unable to set memory soft_limit tunable")); - goto cleanup; + if (flags & VIR_DOMAIN_AFFECT_LIVE) { + if ((rc = virCgroupSetMemorySoftLimit(group, memory_soft_limit)) < 0) { + virReportSystemError(-rc, "%s", + _("unable to set memory soft_limit tunable")); + goto cleanup; + } + vm->def->mem.soft_limit = memory_soft_limit; } if (flags & VIR_DOMAIN_AFFECT_CONFIG) -- 1.7.11.2

On 03/05/2013 09:29 AM, Guannan Ren wrote:
virsh subcommand memtune forgot updating domain live xml after setting cgroup value. --- src/qemu/qemu_driver.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 03/06/2013 12:51 AM, Eric Blake wrote:
On 03/05/2013 09:29 AM, Guannan Ren wrote:
virsh subcommand memtune forgot updating domain live xml after setting cgroup value. --- src/qemu/qemu_driver.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) ACK.
Thanks, pushed the two patches. Guannan

On Tue, Mar 5, 2013 at 10:51 AM, Eric Blake <eblake@redhat.com> wrote:
On 03/05/2013 09:29 AM, Guannan Ren wrote:
virsh subcommand memtune forgot updating domain live xml after setting cgroup value. --- src/qemu/qemu_driver.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)
ACK.
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Backported to v1.0.3-maint. Thanks. -- Doug Goldstein
participants (3)
-
Doug Goldstein
-
Eric Blake
-
Guannan Ren