Blame virtinst-0.500.2-use-x2apic.patch

14a87f1
diff -rup virtinst-0.500.2/virtinst/CapabilitiesParser.py foo/virtinst/CapabilitiesParser.py
14a87f1
--- virtinst-0.500.2/virtinst/CapabilitiesParser.py	2010-02-08 23:07:04.000000000 -0500
14a87f1
+++ foo/virtinst/CapabilitiesParser.py	2010-03-22 15:05:19.530904000 -0400
14a87f1
@@ -90,6 +90,7 @@ class Host(object):
14a87f1
     def __init__(self, node = None):
14a87f1
         # e.g. "i686" or "x86_64"
14a87f1
         self.arch = None
14a87f1
+        self.model = None
14a87f1
 
14a87f1
         self.features = CapabilityFeatures()
14a87f1
         self.topology = None
14a87f1
@@ -115,6 +116,8 @@ class Host(object):
14a87f1
             while n:
14a87f1
                 if n.name == "arch":
14a87f1
                     self.arch = n.content
14a87f1
+                elif n.name == "model":
14a87f1
+                    self.model = n.content
14a87f1
                 elif n.name == "features":
14a87f1
                     self.features = CapabilityFeatures(n)
14a87f1
                 n = n.next
14a87f1
diff -rup virtinst-0.500.2/virtinst/Guest.py foo/virtinst/Guest.py
14a87f1
--- virtinst-0.500.2/virtinst/Guest.py	2010-03-22 15:03:37.220776000 -0400
14a87f1
+++ foo/virtinst/Guest.py	2010-03-22 15:07:16.032765000 -0400
14a87f1
@@ -695,6 +695,22 @@ class Guest(object):
14a87f1
         """
14a87f1
         return self.clock.get_xml_config()
14a87f1
 
14a87f1
+    def _get_cpu_xml(self):
14a87f1
+        """
14a87f1
+        Return <cpu> XML
14a87f1
+        """
14a87f1
+        xml = ""
14a87f1
+        is_kvm = self.type == "kvm"
14a87f1
+        model = self._caps.host.model
14a87f1
+
14a87f1
+        if is_kvm and model:
14a87f1
+            xml += "  <cpu match='exact'>\n"
14a87f1
+            xml += "    <model>%s</model>\n" % model
14a87f1
+            xml += "    <feature policy='force' name='x2apic'/>\n"
14a87f1
+            xml += "  </cpu>"
14a87f1
+
14a87f1
+        return xml
14a87f1
+
14a87f1
     def _get_seclabel_xml(self):
14a87f1
         """
14a87f1
         Return <seclabel> XML
14a87f1
@@ -718,6 +734,7 @@ class Guest(object):
14a87f1
         xml = _util.xml_append(xml,
14a87f1
                                self.installer.get_install_xml(self, install))
14a87f1
         xml = _util.xml_append(xml, self._get_features_xml())
14a87f1
+        xml = _util.xml_append(xml, self._get_cpu_xml())
14a87f1
         xml = _util.xml_append(xml, self._get_clock_xml())
14a87f1
         return xml
14a87f1