mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-22 22:13:18 +00:00
virsh-domain: Flip logic in cmdSetvcpus
To avoid having to assign a failure code to the returned variable switch this function to negative logic. This will fix issue with invalid number of cpus returning success return code. https://bugzilla.redhat.com/show_bug.cgi?id=996466
This commit is contained in:
parent
70547bacae
commit
3abb6ec077
@ -5965,7 +5965,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
|
|||||||
{
|
{
|
||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool ret = true;
|
bool ret = false;
|
||||||
bool maximum = vshCommandOptBool(cmd, "maximum");
|
bool maximum = vshCommandOptBool(cmd, "maximum");
|
||||||
bool config = vshCommandOptBool(cmd, "config");
|
bool config = vshCommandOptBool(cmd, "config");
|
||||||
bool live = vshCommandOptBool(cmd, "live");
|
bool live = vshCommandOptBool(cmd, "live");
|
||||||
@ -5996,9 +5996,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags == -1) {
|
if (flags == -1) {
|
||||||
if (virDomainSetVcpus(dom, count) != 0) {
|
if (virDomainSetVcpus(dom, count) != 0)
|
||||||
ret = false;
|
goto cleanup;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
/* If the --maximum flag was given, we need to ensure only the
|
/* If the --maximum flag was given, we need to ensure only the
|
||||||
--config flag is in effect as well */
|
--config flag is in effect as well */
|
||||||
@ -6015,18 +6014,18 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
/* Warn the user about the invalid flag combination */
|
/* Warn the user about the invalid flag combination */
|
||||||
vshError(ctl, _("--maximum must be used with --config only"));
|
vshError(ctl, _("--maximum must be used with --config only"));
|
||||||
ret = false;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply the virtual cpu changes */
|
/* Apply the virtual cpu changes */
|
||||||
if (virDomainSetVcpusFlags(dom, count, flags) < 0) {
|
if (virDomainSetVcpusFlags(dom, count, flags) < 0)
|
||||||
ret = false;
|
goto cleanup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
ret = true;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
virDomainFree(dom);
|
virDomainFree(dom);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user