<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 04/11/2013 01:45 PM, Hu Tao wrote:<br>
    </div>
    <blockquote
cite="mid:8d112b84aaa39d375e121edd83807fa8933b822b.1365658965.git.hutao@cn.fujitsu.com"
      type="cite">
      <pre wrap="">From: Ken ICHIKAWA <a class="moz-txt-link-rfc2396E" href="mailto:ichikawa.ken@jp.fujitsu.com"><ichikawa.ken@jp.fujitsu.com></a>

With this patch, users can use cpu host-passthrough like this:

  virt-install --cpu host-passthrough ...

Signed-off-by: Ken ICHIKAWA <a class="moz-txt-link-rfc2396E" href="mailto:ichikawa.ken@jp.fujitsu.com"><ichikawa.ken@jp.fujitsu.com></a>
Signed-off-by: Hu Tao <a class="moz-txt-link-rfc2396E" href="mailto:hutao@cn.fujitsu.com"><hutao@cn.fujitsu.com></a>
---

Cole,

    v2 is rebased on top of latest virt-manager. Please review.

Regards,
Hu Tao

 virtinst/CPU.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/virtinst/CPU.py b/virtinst/CPU.py
index 6ada5bc..c1c47e8 100644
--- a/virtinst/CPU.py
+++ b/virtinst/CPU.py
@@ -81,6 +81,7 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
         self._model = None
         self._match = None
         self._vendor = None
+        self._mode = None
         self._features = []
 
         self._sockets = None
@@ -130,6 +131,8 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
     def _get_model(self):
         return self._model
     def _set_model(self, val):
+        if val:
+            self.mode = "custom"
         if val and not self.match:
             self.match = "exact"
         self._model = val
@@ -150,6 +153,13 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
     vendor = _xml_property(_get_vendor, _set_vendor,
                            xpath="./cpu/vendor")
 
+    def _get_mode(self):
+        return self._mode
+    def _set_mode(self, val):
+        self._mode = val
+    mode = _xml_property(_get_mode, _set_mode,
+                         xpath="./cpu/@mode")
+
     # Topology properties
     def _get_sockets(self):
         return self._sockets
@@ -184,6 +194,7 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
         if not cpu.model:
             raise ValueError(_("No host CPU reported in capabilities"))
 
+        self.mode = "custom"</pre>
    </blockquote>
    <br>
    <br>
              I am on the same work these days too. The following is my
    a little thoughts about the work<br>
    <br>
              For the "Copy host CPU configuration",  host-model could
    be used here instead of custom mode<br>
    <br>
              <cpu mode='host-model'/> <br>
              see<a
      href="http://www.libvirt.org/formatdomain.html#elementsCPU">
      http://www.libvirt.org/formatdomain.html#elementsCPU</a><code></code><br>
    <br>
              If we use it, libvirt will do the copying work for cpu and
    features from caps
  </body>
</html>