ac98aee
From: Cole Robinson <crobinso@redhat.com>
ac98aee
Date: Tue, 3 Nov 2015 11:15:26 -0500
ac98aee
Subject: [PATCH virt-manager] osdict: Disable x2apic for solaris10 (bz
ac98aee
 1262093)
ac98aee
ac98aee
It breaks networking:
ac98aee
https://bugzilla.redhat.com/show_bug.cgi?id=1262093
ac98aee
https://bugs.launchpad.net/bugs/1395217
ac98aee
ac98aee
(cherry picked from commit b7e073a407451e1f3e16e98d97357802cf6b3657)
ac98aee
---
ac98aee
 .../compare/virt-install-solaris10-defaults.xml    | 68 ++++++++++++++++++++++
ac98aee
 tests/clitest.py                                   |  1 +
ac98aee
 virtinst/guest.py                                  |  4 ++
ac98aee
 virtinst/osdict.py                                 |  5 ++
ac98aee
 4 files changed, 78 insertions(+)
ac98aee
 create mode 100644 tests/cli-test-xml/compare/virt-install-solaris10-defaults.xml
ac98aee
ac98aee
diff --git a/tests/cli-test-xml/compare/virt-install-solaris10-defaults.xml b/tests/cli-test-xml/compare/virt-install-solaris10-defaults.xml
ac98aee
new file mode 100644
ac98aee
index 0000000..34e89dc
ac98aee
--- /dev/null
ac98aee
+++ b/tests/cli-test-xml/compare/virt-install-solaris10-defaults.xml
ac98aee
@@ -0,0 +1,68 @@
ac98aee
+<domain type="kvm">
ac98aee
+  <name>foobar</name>
ac98aee
+  <uuid>00000000-1111-2222-3333-444444444444</uuid>
ac98aee
+  <memory>65536</memory>
ac98aee
+  <currentMemory>65536</currentMemory>
ac98aee
+  <vcpu>1</vcpu>
ac98aee
+  <os>
ac98aee
+    <type arch="x86_64">hvm</type>
ac98aee
+    <boot dev="hd"/>
ac98aee
+  </os>
ac98aee
+  <features>
ac98aee
+    <acpi/>
ac98aee
+    <apic/>
ac98aee
+    <vmport state="off"/>
ac98aee
+  </features>
ac98aee
+  <cpu mode="custom" match="exact">
ac98aee
+    <model>Opteron_G4</model>
ac98aee
+    <feature policy="disable" name="x2apic"/>
ac98aee
+  </cpu>
ac98aee
+  <clock offset="localtime">
ac98aee
+    <timer name="rtc" tickpolicy="catchup"/>
ac98aee
+    <timer name="pit" tickpolicy="delay"/>
ac98aee
+    <timer name="hpet" present="no"/>
ac98aee
+  </clock>
ac98aee
+  <on_poweroff>destroy</on_poweroff>
ac98aee
+  <on_reboot>restart</on_reboot>
ac98aee
+  <on_crash>restart</on_crash>
ac98aee
+  <pm>
ac98aee
+    <suspend-to-mem enabled="no"/>
ac98aee
+    <suspend-to-disk enabled="no"/>
ac98aee
+  </pm>
ac98aee
+  <devices>
ac98aee
+    <emulator>/usr/bin/qemu-kvm</emulator>
ac98aee
+    <disk type="file" device="disk">
ac98aee
+      <driver name="qemu" type="qcow2"/>
ac98aee
+      <source file="/var/lib/libvirt/images/foobar.qcow2"/>
ac98aee
+      <target dev="hda" bus="ide"/>
ac98aee
+    </disk>
ac98aee
+    <controller type="usb" index="0" model="ich9-ehci1"/>
ac98aee
+    <controller type="usb" index="0" model="ich9-uhci1">
ac98aee
+      <master startport="0"/>
ac98aee
+    </controller>
ac98aee
+    <controller type="usb" index="0" model="ich9-uhci2">
ac98aee
+      <master startport="2"/>
ac98aee
+    </controller>
ac98aee
+    <controller type="usb" index="0" model="ich9-uhci3">
ac98aee
+      <master startport="4"/>
ac98aee
+    </controller>
ac98aee
+    <interface type="bridge">
ac98aee
+      <source bridge="eth0"/>
ac98aee
+      <mac address="00:11:22:33:44:55"/>
ac98aee
+    </interface>
ac98aee
+    <input type="mouse" bus="ps2"/>
ac98aee
+    <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
ac98aee
+      <image compression="off"/>
ac98aee
+    </graphics>
ac98aee
+    <console type="pty"/>
ac98aee
+    <channel type="spicevmc">
ac98aee
+      <target type="virtio" name="com.redhat.spice.0"/>
ac98aee
+    </channel>
ac98aee
+    <sound model="ich6"/>
ac98aee
+    <video>
ac98aee
+      <model type="qxl"/>
ac98aee
+    </video>
ac98aee
+    <redirdev bus="usb" type="spicevmc"/>
ac98aee
+    <redirdev bus="usb" type="spicevmc"/>
ac98aee
+  </devices>
ac98aee
+</domain>
ac98aee
diff --git a/tests/clitest.py b/tests/clitest.py
ac98aee
index 056ec4a..2c7ced4 100644
ac98aee
--- a/tests/clitest.py
ac98aee
+++ b/tests/clitest.py
ac98aee
@@ -700,6 +700,7 @@ c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-rhel7")  #
ac98aee
 c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant centos7.0", "kvm-centos7")  # Centos 7 defaults
ac98aee
 c.add_compare("--os-variant win7 --cdrom %(EXISTIMG2)s --boot loader_type=pflash,loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s", "win7-uefi")  # no HYPER-V with UEFI
ac98aee
 c.add_compare("--machine q35 --cdrom %(EXISTIMG2)s --disk %(EXISTIMG1)s", "q35-defaults")  # proper q35 disk defaults
ac98aee
+c.add_compare("--disk size=20 --os-variant solaris10", "solaris10-defaults")  # test solaris OS defaults
ac98aee
 c.add_compare("--connect %(URI-KVM-REMOTE)s --import --disk %(EXISTIMG1)s --os-variant fedora21 --pm suspend_to_disk=yes", "f21-kvm-remote")
ac98aee
 
ac98aee
 c.add_valid("--connect %(URI-KVM-NODOMCAPS)s --arch aarch64 --nodisks --pxe")  # attempt to default to aarch64 UEFI, but it fails, but should only print warnings
ac98aee
diff --git a/virtinst/guest.py b/virtinst/guest.py
ac98aee
index fc5f2a8..91b078a 100644
ac98aee
--- a/virtinst/guest.py
ac98aee
+++ b/virtinst/guest.py
ac98aee
@@ -802,7 +802,11 @@ class Guest(XMLBuilder):
ac98aee
         elif self.os.is_x86() and self.type == "kvm":
ac98aee
             if self.os.arch != self.conn.caps.host.cpu.arch:
ac98aee
                 return
ac98aee
+
ac98aee
             self.cpu.set_special_mode(self.x86_cpu_default)
ac98aee
+            if self._os_object.broken_x2apic():
ac98aee
+                self.cpu.add_feature("x2apic", policy="disable")
ac98aee
+
ac98aee
 
ac98aee
     def _hv_supported(self):
ac98aee
         if (self.os.loader_type == "pflash" and
ac98aee
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
ac98aee
index a6ae3ac..479d24f 100644
ac98aee
--- a/virtinst/osdict.py
ac98aee
+++ b/virtinst/osdict.py
ac98aee
@@ -426,6 +426,11 @@ class _OsVariant(object):
ac98aee
     def need_old_xen_disable_acpi(self):
ac98aee
         return self._is_related_to(["winxp", "win2k"], check_upgrades=False)
ac98aee
 
ac98aee
+    def broken_x2apic(self):
ac98aee
+        # x2apic breaks networking in solaris10
ac98aee
+        # https://bugs.launchpad.net/bugs/1395217
ac98aee
+        return self.name == 'solaris10'
ac98aee
+
ac98aee
     def get_clock(self):
ac98aee
         if self.is_windows() or self._family in ['solaris']:
ac98aee
             return "localtime"