]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lib: Introduce VIR_DOMAIN_VCPU_HOTPLUGGABLE for virDomainSetVcpusFlags
authorPeter Krempa <pkrempa@redhat.com>
Tue, 20 Sep 2016 12:08:55 +0000 (14:08 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 5 Oct 2016 07:05:52 +0000 (09:05 +0200)
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.

include/libvirt/libvirt-domain.h
tools/virsh-domain.c
tools/virsh.pod

index f1c35d97f74610f1cc60175323e5f80a85a4d442..385b846fc037bcd9b538df53aca445591eae0cad 100644 (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,
index 3829b17a26c0258d9373671352c2054ad1562334..2ce0a060a4b65013662724b044dedbb93817dbf5 100644 (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;
index 971b408369076299e404c35cf530b71119cb8284..227c9b22185604039eb0262cbcb471f8be5ad63f 100644 (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>