[libvirt] [PATCH] tools: improve the error info when fail to parse parameter --soft-limit of memtune

When set guest memory with a invalid parameter of --soft-limit, it posts weird error: $ virsh memtune r7 --hard-limit 20417224 --soft-limit 9007199254740992 --swap-hard-limit 35417224 error: Unable to parse integer parameter 'NAME Change it to error: Unable to parse integer parameter soft-limit Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211550 Signed-off-by: Shanzhi Yu <shyu@redhat.com> --- tools/virsh-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3e2c420..ebdf398 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8417,7 +8417,7 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd) #define PARSE_MEMTUNE_PARAM(NAME, FIELD) \ if ((rc = vshMemtuneGetSize(cmd, NAME, &tmpVal)) < 0) { \ - vshError(ctl, "%s", _("Unable to parse integer parameter 'NAME'")); \ + vshError(ctl, _("Unable to parse integer parameter %s"), NAME); \ goto cleanup; \ } \ if (rc == 1) { \ -- 2.1.0

After set memory parameters for running domain, save the change to live xml is needed otherwise it will disappear after restart libvirtd. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211548 Signed-off-by: Shanzhi Yu <shyu@redhat.com> --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e790664..2e4504e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9843,6 +9843,9 @@ qemuDomainSetMemoryParameters(virDomainPtr dom, #undef QEMU_SET_MEM_PARAMETER + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + goto endjob; + if (flags & VIR_DOMAIN_AFFECT_CONFIG && virDomainSaveConfig(cfg->configDir, persistentDef) < 0) goto endjob; -- 2.1.0

On Tue, Apr 14, 2015 at 06:24:41PM +0800, Shanzhi Yu wrote:
After set memory parameters for running domain, save the change to live xml is needed otherwise it will disappear after restart libvirtd.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211548 Signed-off-by: Shanzhi Yu <shyu@redhat.com> --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e790664..2e4504e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9843,6 +9843,9 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
#undef QEMU_SET_MEM_PARAMETER
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + goto endjob;
This should only be done if flags & VIR_DOMAIN_AFFECT_LIVE. ACK and pushed with that change. Jan

On 04/14/2015 07:54 PM, Ján Tomko wrote:
On Tue, Apr 14, 2015 at 06:24:41PM +0800, Shanzhi Yu wrote:
After set memory parameters for running domain, save the change to live xml is needed otherwise it will disappear after restart libvirtd.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211548 Signed-off-by: Shanzhi Yu <shyu@redhat.com> --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e790664..2e4504e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9843,6 +9843,9 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
#undef QEMU_SET_MEM_PARAMETER
+ if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) + goto endjob; This should only be done if flags & VIR_DOMAIN_AFFECT_LIVE.
ACK and pushed with that change.
Oh, right. Thanks for your review for both.
Jan
-- Regards shyu

On Tue, Apr 14, 2015 at 06:24:40PM +0800, Shanzhi Yu wrote:
When set guest memory with a invalid parameter of --soft-limit, it posts weird error:
$ virsh memtune r7 --hard-limit 20417224 --soft-limit 9007199254740992 --swap-hard-limit 35417224
The subject is too long, as well as this line.
error: Unable to parse integer parameter 'NAME
Change it to
error: Unable to parse integer parameter soft-limit
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211550 Signed-off-by: Shanzhi Yu <shyu@redhat.com> --- tools/virsh-domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3e2c420..ebdf398 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8417,7 +8417,7 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd)
#define PARSE_MEMTUNE_PARAM(NAME, FIELD) \ if ((rc = vshMemtuneGetSize(cmd, NAME, &tmpVal)) < 0) { \ - vshError(ctl, "%s", _("Unable to parse integer parameter 'NAME'")); \ + vshError(ctl, _("Unable to parse integer parameter %s"), NAME); \
Indentation of the backlash is off. ACK, I have shortened the long lines, fixed the indentation and pushed the patch. Jan
participants (2)
-
Ján Tomko
-
Shanzhi Yu