]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: vcpu: Clear vcpu order information rather than making it invalid v2.3.0-rc2
authorPeter Krempa <pkrempa@redhat.com>
Wed, 21 Sep 2016 05:59:57 +0000 (07:59 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 30 Sep 2016 06:25:20 +0000 (08:25 +0200)
Certain operations may make the vcpu order information invalid. Since
the order is primarily used to ensure migration compatibility and has
basically no other user benefits, clear the order prior to certain
operations and document that it may be cleared.

All the operations that would clear the order can still be properly
executed by defining a new domain configuration rather than using the
helper APIs.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1370357

docs/formatdomain.html.in
src/conf/domain_conf.c
src/conf/domain_conf.h
src/libvirt_private.syms
src/qemu/qemu_driver.c

index 513bc0efc32f9ac47f9fbe7a9fff538b3e01a4c9..1266e9d164b54fb33ab5a385882178800f64366c 100644 (file)
         the order may be be duplicated accross all vcpus that need to be
         enabled at once. Specifying order is not necessary, vcpus are then
         added in an arbitrary order. If order info is used, it must be used for
-        all online vcpus.
+        all online vcpus. Hypervisors may clear or update ordering information
+        during certain operations to assure valid configuration.
 
         Note that hypervisors may create hotpluggable vcpus differently from
         boot vcpus thus special initialization may be necessary.
index 7972a4eac2bd71fba0d645d0d79843d0f012b2c9..920529a76d6c1a57476cd658ac8234ffb35c369e 100644 (file)
@@ -25566,3 +25566,13 @@ virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
     virBufferFreeAndReset(&buf);
     return -1;
 }
+
+
+void
+virDomainDefVcpuOrderClear(virDomainDefPtr def)
+{
+    size_t i;
+
+    for (i = 0; i < def->maxvcpus; i++)
+        def->vcpus[i]->order = 0;
+}
index 561a179e63dacb1260e544395cbe15f4e0f56bda..fd3ae8e5007d3851e2f4b6cba6448cab4fc07799 100644 (file)
@@ -2487,6 +2487,7 @@ unsigned int virDomainDefGetVcpus(const virDomainDef *def);
 virBitmapPtr virDomainDefGetOnlineVcpumap(const virDomainDef *def);
 virDomainVcpuDefPtr virDomainDefGetVcpu(virDomainDefPtr def, unsigned int vcpu)
     ATTRIBUTE_RETURN_CHECK;
+void virDomainDefVcpuOrderClear(virDomainDefPtr def);
 
 virDomainObjPtr virDomainObjNew(virDomainXMLOptionPtr caps)
     ATTRIBUTE_NONNULL(1);
index 68d0ea973f2768d5b4a8fc51a10bb2e7144f4ab1..eae817d14dc1f439682e78ac52435029ca70bcf6 100644 (file)
@@ -264,6 +264,7 @@ virDomainDefSetMemoryTotal;
 virDomainDefSetVcpus;
 virDomainDefSetVcpusMax;
 virDomainDefValidate;
+virDomainDefVcpuOrderClear;
 virDomainDeleteConfig;
 virDomainDeviceAddressIsValid;
 virDomainDeviceAddressTypeToString;
index 487bafc7d6e3e7eb2940cdcce2d84c9ad99ce734..12ddbc0c9a6403b2b555656414f9af66f7ace9e3 100644 (file)
@@ -4745,6 +4745,9 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver,
         }
     }
 
+    /* ordering information may become invalid, thus clear it */
+    virDomainDefVcpuOrderClear(persistentDef);
+
     if (virDomainDefSetVcpusMax(persistentDef, nvcpus, driver->xmlopt) < 0)
         goto cleanup;
 
@@ -4919,6 +4922,8 @@ qemuDomainSetVcpusConfig(virDomainDefPtr def,
     size_t maxvcpus = virDomainDefGetVcpusMax(def);
     size_t i;
 
+    /* ordering information may become invalid, thus clear it */
+    virDomainDefVcpuOrderClear(def);
 
     if (curvcpus == nvcpus)
         return;