|
|
3e5111 |
From 2d773381c7dd2d015a0890db36df64c76a6bfe46 Mon Sep 17 00:00:00 2001
|
|
|
3e5111 |
Message-Id: <2d773381c7dd2d015a0890db36df64c76a6bfe46@dist-git>
|
|
|
3e5111 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
3e5111 |
Date: Tue, 4 Apr 2017 09:31:23 +0200
|
|
|
3e5111 |
Subject: [PATCH] qemu: hotplug: Add validation for coldplug of individual
|
|
|
3e5111 |
vcpus
|
|
|
3e5111 |
|
|
|
3e5111 |
Validate that users don't try to disable vcpu 0.
|
|
|
3e5111 |
|
|
|
3e5111 |
(cherry picked from commit ee86d45de35bff5f75d1583701cc9514b59e747c)
|
|
|
3e5111 |
|
|
|
3e5111 |
https://bugzilla.redhat.com/show_bug.cgi?id=1437010
|
|
|
3e5111 |
---
|
|
|
3e5111 |
src/qemu/qemu_hotplug.c | 20 ++++++++++++++++++++
|
|
|
3e5111 |
1 file changed, 20 insertions(+)
|
|
|
3e5111 |
|
|
|
3e5111 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
index 5488b1dd4..999c8b804 100644
|
|
|
3e5111 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
3e5111 |
@@ -5875,6 +5875,21 @@ qemuDomainFilterHotplugVcpuEntities(virDomainDefPtr def,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
|
|
|
3e5111 |
+static int
|
|
|
3e5111 |
+qemuDomainVcpuValidateConfig(virBitmapPtr map,
|
|
|
3e5111 |
+ bool state)
|
|
|
3e5111 |
+{
|
|
|
3e5111 |
+ /* vcpu 0 can't be disabled */
|
|
|
3e5111 |
+ if (!state && virBitmapIsBitSet(map, 0)) {
|
|
|
3e5111 |
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
|
|
|
3e5111 |
+ _("vCPU '0' must be enabled"));
|
|
|
3e5111 |
+ return -1;
|
|
|
3e5111 |
+ }
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+ return 0;
|
|
|
3e5111 |
+}
|
|
|
3e5111 |
+
|
|
|
3e5111 |
+
|
|
|
3e5111 |
int
|
|
|
3e5111 |
qemuDomainSetVcpuInternal(virQEMUDriverPtr driver,
|
|
|
3e5111 |
virDomainObjPtr vm,
|
|
|
3e5111 |
@@ -5909,6 +5924,11 @@ qemuDomainSetVcpuInternal(virQEMUDriverPtr driver,
|
|
|
3e5111 |
}
|
|
|
3e5111 |
}
|
|
|
3e5111 |
|
|
|
3e5111 |
+ if (persistentDef) {
|
|
|
3e5111 |
+ if (qemuDomainVcpuValidateConfig(map, state) < 0)
|
|
|
3e5111 |
+ goto cleanup;
|
|
|
3e5111 |
+ }
|
|
|
3e5111 |
+
|
|
|
3e5111 |
if (livevcpus &&
|
|
|
3e5111 |
qemuDomainSetVcpusLive(driver, cfg, vm, livevcpus, state) < 0)
|
|
|
3e5111 |
goto cleanup;
|
|
|
3e5111 |
--
|
|
|
3e5111 |
2.12.2
|
|
|
3e5111 |
|