mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
virsh: cmdSchedinfo: Add separate variable for holding flags used for query
Instead of having two ad-hoc places which decide whether the original flags can be used add another variable specifically for flags used for query. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
82217a2c7b
commit
2337098b63
@ -5158,6 +5158,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
size_t i;
|
||||
bool ret_val = false;
|
||||
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||
unsigned int queryflags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||
bool current = vshCommandOptBool(cmd, "current");
|
||||
bool config = vshCommandOptBool(cmd, "config");
|
||||
bool live = vshCommandOptBool(cmd, "live");
|
||||
@ -5170,6 +5171,14 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
if (live)
|
||||
flags |= VIR_DOMAIN_AFFECT_LIVE;
|
||||
|
||||
/* We cannot query both live and config at once, so settle
|
||||
on current in that case. If we are setting, then the two values should
|
||||
match when we re-query; otherwise, we report the error later. */
|
||||
if (config && live)
|
||||
queryflags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||
else
|
||||
queryflags = flags;
|
||||
|
||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||
return false;
|
||||
|
||||
@ -5188,12 +5197,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
memset(params, 0, sizeof(*params) * nparams);
|
||||
|
||||
if (flags || current) {
|
||||
/* We cannot query both live and config at once, so settle
|
||||
on current in that case. If we are setting, then the
|
||||
two values should match when we re-query; otherwise, we
|
||||
report the error later. */
|
||||
if (virDomainGetSchedulerParametersFlags(dom, params, &nparams,
|
||||
((live && config) ? 0 : flags)) == -1)
|
||||
if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, queryflags) == -1)
|
||||
goto cleanup;
|
||||
} else {
|
||||
if (virDomainGetSchedulerParameters(dom, params, &nparams) == -1)
|
||||
@ -5212,8 +5216,7 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
nupdates, flags) == -1)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainGetSchedulerParametersFlags(dom, params, &nparams,
|
||||
((live && config) ? 0 : flags)) == -1)
|
||||
if (virDomainGetSchedulerParametersFlags(dom, params, &nparams, queryflags) == -1)
|
||||
goto cleanup;
|
||||
} else {
|
||||
if (virDomainSetSchedulerParameters(dom, updates, nupdates) == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user