API/qemu: add async unplug flag to virDomainSetVcpu

Add VIR_DOMAIN_SETVCPU_ASYNC_UNPLUG for virDomainSetVcpu().

Define a dedicated virDomainSetVcpuBehaviour flag type and wire the
new flag through the QEMU driver. As with setvcpus async unplug,
success indicates request acceptance while final completion is
reported by the vcpu-removed event.

Update the API documentation and add virsh support for the async path to
the setvcpu subcommand.

Signed-off-by: Akash Kulhalli <akash.kulhalli@oracle.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Akash Kulhalli via Devel
2026-05-12 13:39:07 +02:00
committed by Peter Krempa
parent fb2791327e
commit 19e1dcf860
5 changed files with 47 additions and 4 deletions
+8
View File
@@ -7837,6 +7837,10 @@ static const vshCmdOptDef opts_setvcpu[] = {
.type = VSH_OT_BOOL,
.help = N_("disable cpus specified by cpumap")
},
{.name = "async",
.type = VSH_OT_BOOL,
.help = N_("return after firing vcpu unplug request")
},
VIRSH_COMMON_OPT_DOMAIN_CONFIG,
VIRSH_COMMON_OPT_DOMAIN_LIVE,
VIRSH_COMMON_OPT_DOMAIN_CURRENT,
@@ -7851,6 +7855,7 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd)
bool disable = vshCommandOptBool(cmd, "disable");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool async = vshCommandOptBool(cmd, "async");
const char *vcpulist = NULL;
int state = 0;
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
@@ -7859,11 +7864,14 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd)
VSH_EXCLUSIVE_OPTIONS("current", "live");
VSH_EXCLUSIVE_OPTIONS("current", "config");
VSH_EXCLUSIVE_OPTIONS("async", "enable");
if (config)
flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (live)
flags |= VIR_DOMAIN_AFFECT_LIVE;
if (async)
flags |= VIR_DOMAIN_SETVCPU_ASYNC_UNPLUG;
if (!(enable || disable)) {
vshError(ctl, "%s", _("one of --enable, --disable is required"));