When we dropped virDomainSetMemory usage it got kind of tricky to
figure out the flags correctly.
Originally the logic was following:
no option | --current | --live | --config | --live --config
----------+-----------+--------+----------+----------------
LIVE | CURRENT | LIVE | CONFIG | LIVE & CONFIG
But after the commit removing virDomainSetMemory usage it changed to:
no option | --current | --live | --config | --live --config
----------+-----------+--------+-----------------+----------------
LIVE | CURRENT | LIVE | LIVE & CONFIG | LIVE & CONFIG
This commit fixes the logic back to the original behavior except for
ESX, HyperV and Virtuozzo drivers where virDomainSetMemory() default
behavior was CURRENT instead of LIVE.
Fixes: ce8138564bba0def7d7195814fba4555915d60d5
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1980199
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
tools/virsh-domain.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6fb057736b..f9962f0515 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9005,10 +9005,15 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd)
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
- if (current)
+ if (config || live || current) {
flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ }
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
--
2.31.1
On 7/23/21 10:35 AM, Pavel Hrdina wrote: > When we dropped virDomainSetMemory usage it got kind of tricky to > figure out the flags correctly. > > Originally the logic was following: > > no option | --current | --live | --config | --live --config > ----------+-----------+--------+----------+---------------- > LIVE | CURRENT | LIVE | CONFIG | LIVE & CONFIG > > But after the commit removing virDomainSetMemory usage it changed to: > > no option | --current | --live | --config | --live --config > ----------+-----------+--------+-----------------+---------------- > LIVE | CURRENT | LIVE | LIVE & CONFIG | LIVE & CONFIG > > This commit fixes the logic back to the original behavior except for > ESX, HyperV and Virtuozzo drivers where virDomainSetMemory() default > behavior was CURRENT instead of LIVE. > > Fixes: ce8138564bba0def7d7195814fba4555915d60d5 > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1980199 > Signed-off-by: Pavel Hrdina <phrdina@redhat.com> > --- > tools/virsh-domain.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > Oops. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
© 2016 - 2026 Red Hat, Inc.