[virt-tools-list] [PATCH v3 2/2] virtinst: compare host and domain cpu models

Cole Robinson crobinso at redhat.com
Tue Apr 3 15:10:16 UTC 2018


On 03/28/2018 03:45 PM, Charles Arnold wrote:
> Lookup the domain capabilities CPU model and compare with
> the host capabilities CPU model and if they are not equal
> set the guest's CPU model to None.
> 
> ---
>  virtinst/guest.py | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/virtinst/guest.py b/virtinst/guest.py
> index 5e7d807..c47d42a 100644
> --- a/virtinst/guest.py
> +++ b/virtinst/guest.py
> @@ -869,6 +869,15 @@ class Guest(XMLBuilder):
>                  return
>  
>              self.cpu.set_special_mode(self.x86_cpu_default)
> +            domcaps = DomainCapabilities.build_from_guest(self)
> +            domcaps_model = domcaps.cpu.get_mode("host-model").get_models()
> +            if (isinstance(domcaps_model, list) and len(domcaps_model) and
> +                domcaps_model[0] != self.conn.caps.host.cpu.model):
> +                logging.debug("Host capabilities CPU '%s' does not match "
> +                      "domain capabilities CPU '%s'. Leaving CPU model unset.",
> +                      self.conn.caps.host.cpu.model, domcaps_model[0])
> +                self.cpu.model = None
> +
>              if self._os_object.broken_x2apic():
>                  self.cpu.add_feature("x2apic", policy="disable")
>  
> 

This is trying to compare against host-model CPU in domaincapabilities
which can be wrong some times. I think the proper fix is to check if the
model is usable=yes in domaincapabilities mode='custom' list. I reworked
this to work like that and pushed, please give it a test

Thanks,
Cole




More information about the virt-tools-list mailing list