--- tools/virsh.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 018e363..f14144d 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -2765,11 +2765,32 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) ret = FALSE; } } else { + /* If the --maximum flag was given, we need to ensure only the + --config flag is in effect as well */ + if (VIR_DOMAIN_VCPU_MAXIMUM & flags) { + vshDebug(ctl, 5, "--maximum flag was given\n"); + + /* If neither the --config nor --live flags were given, OR + if just the --live flag was given, we need to error out + warning the user that the --maximum flag can only be used + with the --config flag */ + if ((VIR_DOMAIN_VCPU_LIVE & flags) | + (VIR_DOMAIN_VCPU_MAXIMUM == flags)) { + + /* Warn the user about the invalid flag combination */ + vshError(ctl, _("--maximum must be used with --config only")); + ret = FALSE; + goto cleanup; + } + } + + /* Apply the virtual cpu changes */ if (virDomainSetVcpusFlags(dom, count, flags) < 0) { ret = FALSE; } } + cleanup: virDomainFree(dom); return ret; } -- 1.7.3.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list