|
|
9119d9 |
From 6f34957b6242c1537e91684af2864eeed434d5b1 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <6f34957b6242c1537e91684af2864eeed434d5b1@dist-git>
|
|
|
9119d9 |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
9119d9 |
Date: Thu, 15 Jan 2015 15:03:51 +0100
|
|
|
9119d9 |
Subject: [PATCH] qemu_driver: fix setting vcpus for offline domain
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1161540
|
|
|
9119d9 |
|
|
|
9119d9 |
Commit e3435caf fixed hot-plugging of vcpus with strict memory pinning
|
|
|
9119d9 |
on NUMA hosts, but unfortunately it also broke updating number of vcpus
|
|
|
9119d9 |
for offline guests using our API.
|
|
|
9119d9 |
|
|
|
9119d9 |
The issue is that we try to create a cpu cgroup for non-running guest
|
|
|
9119d9 |
which fails as there are no cgroups for that domain. We should create
|
|
|
9119d9 |
cgroups and update cpuset.mems only if we are hot-plugging.
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit e105dc981438bc33fa771bd67cece6234dbf6c8d)
|
|
|
9119d9 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_driver.c | 26 ++++++++++++++------------
|
|
|
9119d9 |
1 file changed, 14 insertions(+), 12 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
index afcf326..619f2d6 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_driver.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
@@ -4672,21 +4672,23 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|
|
9119d9 |
|
|
|
9119d9 |
priv = vm->privateData;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
- if (!(all_nodes = virNumaGetHostNodeset()))
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
- if (!(all_nodes_str = virBitmapFormat(all_nodes)))
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
-
|
|
|
9119d9 |
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (virCgroupGetCpusetMems(cgroup_temp, &mem_mask) < 0 ||
|
|
|
9119d9 |
- virCgroupSetCpusetMems(cgroup_temp, all_nodes_str) < 0)
|
|
|
9119d9 |
- goto endjob;
|
|
|
9119d9 |
+ if (flags & VIR_DOMAIN_AFFECT_LIVE && !(flags & VIR_DOMAIN_VCPU_GUEST)) {
|
|
|
9119d9 |
+ if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (!(all_nodes = virNumaGetHostNodeset()))
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (!(all_nodes_str = virBitmapFormat(all_nodes)))
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (virCgroupGetCpusetMems(cgroup_temp, &mem_mask) < 0 ||
|
|
|
9119d9 |
+ virCgroupSetCpusetMems(cgroup_temp, all_nodes_str) < 0)
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
|
|
|
9119d9 |
maximum = (flags & VIR_DOMAIN_VCPU_MAXIMUM) != 0;
|
|
|
9119d9 |
flags &= ~VIR_DOMAIN_VCPU_MAXIMUM;
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.2.1
|
|
|
9119d9 |
|