提交 18c9d157 编写于 作者: P Peter Krempa

qemu: agent: Don't automatically disable CPU0 via guest agent

While CPU0 was made unpluggable in Linux a while ago it's not desirable
to unplug it since some parts of the kernel (suspend-to-ram) still
depend on it.

This patch fixes the vCPU selection code in libvirt so that it will not
be disabled.
上级 91c9e4d9
......@@ -1601,9 +1601,13 @@ qemuAgentUpdateCPUInfo(unsigned int nvcpus,
size_t i;
int nonline = 0;
int nofflinable = 0;
ssize_t cpu0 = -1;
/* count the active and offlinable cpus */
for (i = 0; i < ncpuinfo; i++) {
if (cpuinfo[i].id == 0)
cpu0 = i;
if (cpuinfo[i].online)
nonline++;
......@@ -1618,6 +1622,15 @@ qemuAgentUpdateCPUInfo(unsigned int nvcpus,
}
}
/* CPU0 was made offlinable in linux a while ago, but certain parts (suspend
* to ram) of the kernel still don't cope well with that. Make sure that if
* all remaining vCPUs are offlinable, vCPU0 will not be selected to be
* offlined automatically */
if (nofflinable == nonline && cpu0 >= 0 && cpuinfo[cpu0].online) {
cpuinfo[cpu0].offlinable = false;
nofflinable--;
}
/* the guest agent reported less cpus than requested */
if (nvcpus > ncpuinfo) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册