Re: [PATCH 7/7] qemu: Allow making vcpus hotpluggable with virDomainSetVcpusFlags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09/21/2016 05:19 PM, Peter Krempa wrote:
Implement support for VIR_DOMAIN_VCPU_HOTPLUGGABLE so that users can
choose to make vcpus added by the API removable.
---
  src/qemu/qemu_driver.c | 22 ++++++++++++++++------
  1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 357be4e..8453628 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4912,7 +4912,8 @@ qemuDomainSetVcpusLive(virQEMUDriverPtr driver,
   */
  static void
  qemuDomainSetVcpusConfig(virDomainDefPtr def,
-                         unsigned int nvcpus)
+                         unsigned int nvcpus,
+                         bool hotpluggable)
  {
      virDomainVcpuDefPtr vcpu;
Here  if (curvcpus == nvcpus)

                    return
we still need to allow if someone wants to switch from hotpluggable = yes to no/ vice versa.


      size_t curvcpus = virDomainDefGetVcpus(def);
@@ -4933,7 +4934,12 @@ qemuDomainSetVcpusConfig(virDomainDefPtr def,
                  continue;

              vcpu->online = true;
-            vcpu->hotpluggable = VIR_TRISTATE_BOOL_NO;
+            if (hotpluggable) {
+                vcpu->hotpluggable = VIR_TRISTATE_BOOL_YES;
+                def->individualvcpus = true;
+            } else {
+                vcpu->hotpluggable = VIR_TRISTATE_BOOL_NO;
+            }

              if (++curvcpus == nvcpus)
                  break;

Can we add checks here to see on PPC, the config is valid with a check when topology is given in xml to see (curvcpus%threads_per_core == 0)

Otherwise with virsh setvcpus rhel71 13 --config --hotpluggable
for a guest with topology     <topology sockets='8' cores='2' threads='4'/>
we would see,
2016-09-29 10:12:05.929+0000: 1137: error : qemuProcessValidateHotpluggableVcpus:4829 : unsupported configuration: vcpus '12' and '13' are in the same hotplug group but differ in configuration

OR

Even when setvcpus live to a number not leading to a complete core, we have checks leading to sensible error (error: unsupported configuration: target vm vcpu granularity does not allow the desired vcpu count ) . So, in case of --config also may be we can add the check to bring the consistency.

Otherwise the series looks good with the above two cases addressed . ACK

Thanks,
Shivaprasad


@@ -4960,7 +4966,8 @@ qemuDomainSetVcpusInternal(virQEMUDriverPtr driver,
                             virDomainObjPtr vm,
                             virDomainDefPtr def,
                             virDomainDefPtr persistentDef,
-                           unsigned int nvcpus)
+                           unsigned int nvcpus,
+                           bool hotpluggable)
  {
      virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
      int ret = -1;
@@ -4985,7 +4992,7 @@ qemuDomainSetVcpusInternal(virQEMUDriverPtr driver,
          goto cleanup;

      if (persistentDef) {
-        qemuDomainSetVcpusConfig(persistentDef, nvcpus);
+        qemuDomainSetVcpusConfig(persistentDef, nvcpus, hotpluggable);

          if (virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef) < 0)
              goto cleanup;
@@ -5008,12 +5015,14 @@ qemuDomainSetVcpusFlags(virDomainPtr dom,
      virDomainObjPtr vm = NULL;
      virDomainDefPtr def;
      virDomainDefPtr persistentDef;
+    bool hotpluggable = !!(flags & VIR_DOMAIN_VCPU_HOTPLUGGABLE);
      int ret = -1;

      virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                    VIR_DOMAIN_AFFECT_CONFIG |
                    VIR_DOMAIN_VCPU_MAXIMUM |
-                  VIR_DOMAIN_VCPU_GUEST, -1);
+                  VIR_DOMAIN_VCPU_GUEST |
+                  VIR_DOMAIN_VCPU_HOTPLUGGABLE, -1);

      if (!(vm = qemuDomObjFromDomain(dom)))
          goto cleanup;
@@ -5032,7 +5041,8 @@ qemuDomainSetVcpusFlags(virDomainPtr dom,
      else if (flags & VIR_DOMAIN_VCPU_MAXIMUM)
          ret = qemuDomainSetVcpusMax(driver, def, persistentDef, nvcpus);
      else
-        ret = qemuDomainSetVcpusInternal(driver, vm, def, persistentDef, nvcpus);
+        ret = qemuDomainSetVcpusInternal(driver, vm, def, persistentDef,
+                                         nvcpus, hotpluggable);

   endjob:
      qemuDomainObjEndJob(driver, vm);

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]