[gnome-boxes] vm-configurator: Explicitly assign host cpu model
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] vm-configurator: Explicitly assign host cpu model
- Date: Fri, 1 Aug 2014 09:15:17 +0000 (UTC)
commit 36c2f960ec00b0414e1c774eeefa497d2dfd4a86
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Fri Jul 4 14:55:33 2014 +0100
vm-configurator: Explicitly assign host cpu model
Instead of using 'host-passthrough' mode, use custom mode and set the
model of CPU explicitly to that of the host CPU. While 'host-model' mode
still has issues and should be avoided, turns out that 'host-passthrough'
does not work for non-KVM.
This patch follows the advice given in libvirt documentation.
From http://libvirt.org/formatdomain.html#elementsCPU
"Beware, due to the way libvirt detects host CPU and due to the fact
libvirt does not talk to QEMU/KVM when creating the CPU model, CPU
configuration created using host-model may not work as expected. The
guest CPU may differ from the configuration and it may also confuse
guest OS by using a combination of CPU features and other parameters
(such as CPUID level) that don't work. Until these issues are fixed,
it's a good idea to avoid using host-model and use custom mode with just
the CPU model from host capabilities XML."
https://bugzilla.gnome.org/show_bug.cgi?id=732680
src/vm-configurator.vala | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 1579190..fe8429f 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -200,7 +200,8 @@ private class Boxes.VMConfigurator {
}
private static void set_cpu_config (Domain domain, Capabilities caps) {
- var topology = caps.get_host ().get_cpu ().get_topology ();
+ var cpu_caps = caps.get_host ().get_cpu ();
+ var topology = cpu_caps.get_topology ();
if (topology == null)
return;
@@ -210,8 +211,14 @@ private class Boxes.VMConfigurator {
var cpu = new DomainCpu ();
// Ideally we should be using 'host-model' but there is currently issues with that:
// https://bugzilla.redhat.com/show_bug.cgi?id=870071
- cpu.set_mode (DomainCpuMode.HOST_PASSTHROUGH);
+ cpu.set_mode (DomainCpuMode.CUSTOM);
cpu.set_topology (topology);
+
+ var model_caps = cpu_caps.get_model ();
+ var model = new DomainCpuModel ();
+ model.set_name (model_caps.get_name ());
+ cpu.set_model (model);
+
domain.set_cpu (cpu);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]