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 or a group of nodes in the compute cluster, and then manually set it as default either for the compute cluster or for particular nodes. In this case, however, the most compatible CPU model will be the least advanced one and compute nodes will lose CPU capabilities of a more advanced processor.

During live migration, the nova-scheduler service that manages scheduling of virtual machines does not filter the destination node by CPU model. A VM can migrate to a node with a different CPU model if this model is newer than that of the source node and supports all its CPU features. If a VM tries to migrate to a node with an older CPU model, this attempt will fail, and the scheduler will try to migrate the VM to another node.

  • 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 CPU model per compute cluster

    1. Determine baseline CPU models for the compute cluster. For example:

      # vinfra service compute baseline-cpu
      +------------------------+-------------------+
      | Field                  | Value             |
      +------------------------+-------------------+
      | All selected nodes     | models:           |
      |                        | - Haswell-noTSX   |
      |                        | patched: true     |
      | node001.vstoragedomain | models:           |
      |                        | - EPYC-IBPB       |
      |                        | - Broadwell-noTSX |
      |                        | - Haswell-noTSX   |
      |                        | - HostPassthrough |
      |                        | patched: true     |
      | node002.vstoragedomain | models:           |
      |                        | - Haswell-noTSX   |
      |                        | - Broadwell-noTSX |
      |                        | patched: true     |
      | node003.vstoragedomain | models:           |
      |                        | - Haswell-noTSX   |
      |                        | patched: true     |
      +------------------------+-------------------+

      The command will print the most compatible CPU model across all compute nodes. In the example, it is Haswell-noTSX.

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

      # vinfra service compute set --cpu-model Haswell-noTSX

    You can check that the CPU model has been successfully applied to the compute cluster in the vinfra service compute show output:

    # vinfra service compute show | grep cpu_model:
    | options      | cpu_model: Haswell-noTSX      |

    To set the CPU model per node

    1. Determine baseline CPU models for required nodes. For example:

      # vinfra service compute baseline-cpu --nodes node002,node003
      +------------------------+-------------------+
      | Field                  | Value             |
      +------------------------+-------------------+
      | All selected nodes     | models:           |
      |                        | - Haswell-noTSX   |
      |                        | patched: true     |
      | node002.vstoragedomain | models:           |
      |                        | - Haswell-noTSX   |
      |                        | - Broadwell-noTSX |
      |                        | patched: true     |
      | node003.vstoragedomain | models:           |
      |                        | - Haswell-noTSX   |
      |                        | patched: true     |
      +------------------------+-------------------+

      The command will print the most compatible CPU model across the specified compute nodes. In the example, it is Haswell-noTSX.

    2. Set this CPU model for the compute nodes. For example:

      # vinfra service compute set --cpu-model Haswell-noTSX --nodes node002,node003

    You can check that the CPU model has been successfully applied to the specified nodes in the vinfra service compute node show output:

    # vinfra service compute node show node002 | grep cpu_model
    | cpu_model      | Haswell-noTSX           |
    

    To unset the CPU model

    Specify an empty value for the --cpu-model option. For example, to unset the CPU model from specific nodes, run:

    # vinfra service compute set --cpu-model '' --nodes node002,node003

    In this case, the specified nodes will use the cluster-wide CPU model.

    If you want to unset the CPU model from the entire compute cluster, run:

    # vinfra service compute set --cpu-model ''