lib: Introduce VIR_DOMAIN_VCPU_HOTPLUGGABLE for virDomainSetVcpusFlags

For compatibility reasons virDomainSetVcpus needs to add vcpus as non
hotpluggable which means that the users will not be able to unplug it
after the VM has started. Add a flag that will allow to tell the API
that the unpluggable vcpus are okay.
This commit is contained in:
Peter Krempa 2016-09-20 14:08:55 +02:00
parent 2c739866df
commit 0f95f31c83
3 changed files with 14 additions and 1 deletions

View File

@ -1707,6 +1707,7 @@ typedef enum {
/* Additionally, these flags may be bitwise-OR'd in. */
VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */
VIR_DOMAIN_VCPU_GUEST = (1 << 3), /* Modify state of the cpu in the guest */
VIR_DOMAIN_VCPU_HOTPLUGGABLE = (1 << 4), /* Make vcpus added hot(un)pluggable */
} virDomainVcpuFlags;
int virDomainSetVcpus (virDomainPtr domain,

View File

@ -6722,6 +6722,10 @@ static const vshCmdOptDef opts_setvcpus[] = {
.type = VSH_OT_BOOL,
.help = N_("modify cpu state in the guest")
},
{.name = "hotpluggable",
.type = VSH_OT_BOOL,
.help = N_("make added vcpus hot(un)pluggable")
},
{.name = NULL}
};
@ -6736,6 +6740,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
bool guest = vshCommandOptBool(cmd, "guest");
bool hotpluggable = vshCommandOptBool(cmd, "hotpluggable");
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
@ -6752,6 +6757,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_VCPU_GUEST;
if (maximum)
flags |= VIR_DOMAIN_VCPU_MAXIMUM;
if (hotpluggable)
flags |= VIR_DOMAIN_VCPU_HOTPLUGGABLE;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;

View File

@ -2316,7 +2316,7 @@ exclusive. If no flag is specified, behavior is different depending
on hypervisor.
=item B<setvcpus> I<domain> I<count> [I<--maximum>] [[I<--config>]
[I<--live>] | [I<--current>]] [I<--guest>]
[I<--live>] | [I<--current>]] [I<--guest>] [I<--hotpluggable>]
Change the number of virtual CPUs active in a guest domain. By default,
this command works on active guest domains. To change the settings for an
@ -2348,6 +2348,11 @@ If I<--guest> is specified, then the count of cpus is modified in the guest
instead of the hypervisor. This flag is usable only for live domains
and may require guest agent to be configured in the guest.
To allow adding vcpus to persistent definitions that can be later hotunplugged
after the domain is booted it is necessary to specify the I<--hotpluggable>
flag. Vcpus added to live domains supporting vcpu unplug are automatically
marked as hotpluggable.
The I<--maximum> flag controls the maximum number of virtual cpus that can
be hot-plugged the next time the domain is booted. As such, it must only be
used with the I<--config> flag, and not with the I<--live> or the I<--current>