[virt-tools-list] [PATCH v2 1/3] Add support for cpu mode attribute and cpu host-passthrough
Guannan Ren
gren at redhat.com
Fri Apr 12 09:38:07 UTC 2013
On 04/11/2013 01:45 PM, Hu Tao wrote:
> From: Ken ICHIKAWA <ichikawa.ken at jp.fujitsu.com>
>
> With this patch, users can use cpu host-passthrough like this:
>
> virt-install --cpu host-passthrough ...
>
> Signed-off-by: Ken ICHIKAWA <ichikawa.ken at jp.fujitsu.com>
> Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
> ---
>
> 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"
I am on the same work these days too. The following is my a
little thoughts about the work
For the "Copy host CPU configuration", host-model could be
used here instead of custom mode
<cpu mode='host-model'/>
seehttp://www.libvirt.org/formatdomain.html#elementsCPU
<http://www.libvirt.org/formatdomain.html#elementsCPU>||
If we use it, libvirt will do the copying work for cpu and
features from caps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20130412/85cf7c77/attachment.htm>
More information about the virt-tools-list
mailing list