On Wed, Aug 24, 2016 at 09:35:38AM -0400, Peter Krempa wrote:
To allow unplugging the vcpus, hotplugging of vcpus on platforms
which
require to plug multiple logical vcpus at once or plugging them in an
arbitrary order it's necessary to use the new device_add interface for
vcpu hotplug.
This patch adds support for the device_add interface using the old
setvcpus API by implementing an algorithm to select the appropriate
entities to plug in.
---
src/qemu/qemu_driver.c | 156 +++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 139 insertions(+), 17 deletions(-)
cleanup:
+ virJSONValueFree(vcpuprops);
return ret;
}
@@ -4771,6 +4792,95 @@ qemuDomainSetVcpusMax(virQEMUDriverPtr driver,
}
+/**
+ * qemuDomainSelectHotplugVcpuEntities:
+ *
+ * @def: domain definition
+ * @nvcpus: target vcpu count
+ * @cpumap: vcpu entity IDs filled on success
That is the return value, not a paramater.
ACK with the comment fixed
Jan
+ *
+ * Tries to find which vcpu entities need to be enabled or disabled to reach
+ * @nvcpus. This function works in order of the legacy hotplug but is able to
+ * skip over entries that are added out of order.
+ */
+static virBitmapPtr
+qemuDomainSelectHotplugVcpuEntities(virDomainDefPtr def,
+ unsigned int nvcpus)
+{
+ virBitmapPtr ret = NULL;
+ virDomainVcpuDefPtr vcpu;
+ qemuDomainVcpuPrivatePtr vcpupriv;
+ unsigned int maxvcpus = virDomainDefGetVcpusMax(def);
+ unsigned int curvcpus = virDomainDefGetVcpus(def);
+ ssize_t i;
+