Setting virtual machine CPU model

Virtual machines are created with the host CPU model by default. If nodes in the compute cluster have different CPUs, live migration of VMs between compute nodes may not work or applications inside VMs that depend on particular CPUs may not function properly. To avoid this, you can find out which CPU model offers compatibility across all nodes in the compute cluster and manually set it as the compute cluster default. In this case, however, the compute cluster CPU model will be the least advanced one and compute nodes will lose CPU capabilities of a more advanced processor.

  • You can view the list of supported CPU models by running the command vinfra service compute show.
  • Limitations:

    • Changing CPU model affects only new VMs, that is, those created after the change.

    Prerequisites

    To set the compute cluster CPU model

    1. Run virsh capabilities on each compute node, to print an XML document with information on node’s CPU.
    2. On one of the nodes, create an XML file, for example, cpu-compare.xml. Add the <cpu> sections from all of the nodes to this file. For example:

      <cpu>
        <arch>x86_64</arch>
        <model>SandyBridge-IBRS</model>
        <vendor>Intel</vendor>
        <counter name='tsc' frequency='2099999000' scaling='yes'/>
        <topology sockets='1' cores='16' threads='2'/>
        <feature policy='require' name='vme'/>
        <feature policy='require' name='ds'/>
        <feature policy='require' name='acpi'/>
        <feature policy='require' name='ss'/>
        <feature policy='require' name='ht'/>
        <feature policy='require' name='tm'/>
        <feature policy='require' name='pbe'/>
        <feature policy='require' name='dtes64'/>
        <feature policy='require' name='monitor'/>
        <feature policy='require' name='ds_cpl'/>
        <feature policy='require' name='vmx'/>
        <feature policy='require' name='smx'/>
        <feature policy='require' name='est'/>
        <feature policy='require' name='tm2'/>
        <feature policy='require' name='xtpr'/>
        <feature policy='require' name='pdcm'/>
        <feature policy='require' name='pcid'/>
        <feature policy='require' name='dca'/>
        <feature policy='require' name='arat'/>
        <feature policy='require' name='md-clear'/>
        <feature policy='require' name='stibp'/>
        <feature policy='require' name='ssbd'/>
        <feature policy='require' name='xsaveopt'/>
        <feature policy='require' name='pdpe1gb'/>
        <feature policy='require' name='invtsc'/>
      </cpu>
      <cpu>
        <arch>x86_64</arch>
        <model>Skylake-Server</model>
        <vendor>Intel</vendor>
        <counter name='tsc' frequency='2099999000' scaling='yes'/>
        <topology sockets='1' cores='16' threads='2'/>
        <feature name='ds'/>
        <feature name='acpi'/>
        <feature name='ss'/>
        <feature name='ht'/>
        <feature name='tm'/>
        <feature name='pbe'/>
        <feature name='dtes64'/>
        <feature name='monitor'/>
        <feature name='ds_cpl'/>
        <feature name='vmx'/>
        <feature name='smx'/>
        <feature name='est'/>
        <feature name='tm2'/>
        <feature name='xtpr'/>
        <feature name='pdcm'/>
        <feature name='dca'/>
        <feature name='tsc_adjust'/>
        <feature name='cmt'/>
        <feature name='intel-pt'/>
        <feature name='pku'/>
        <feature name='md-clear'/>
        <feature name='stibp'/>
        <feature name='arch-capabilities'/>
        <feature name='xsaves'/>
        <feature name='invtsc'/>
        <feature name='rdctl-no'/>
        <feature name='ibrs-all'/>
        <feature name='skip-l1dfl-vmentry'/>
        <feature name='mds-no'/>
        <pages unit='KiB' size='4'/>
        <pages unit='KiB' size='2048'/>
        <pages unit='KiB' size='1048576'/>
      </cpu>
      
    3. Compare the CPU features by using virsh cpu-baseline. For example:

      # virsh cpu-baseline cpu-compare.xml | grep model
      <model fallback='allow'>SandyBridge</model>

      The command will print the most compatible CPU model across all nodes. In the example, it is SandyBridge.

    4. Set this CPU model for the compute cluster. For example:

      # vinfra service compute set --cpu-model SandyBridge