Configuring CPU features for virtual machines

You can enable or disable CPU feature flags for virtual machines without changing them on compute nodes. By configuring particular CPU feature flags for the compute cluster, you can avoid live migration compatibility issues across compute nodes, as well as control nested virtualization capabilities.

Limitations:

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

Prerequisites

  • The compute cluster CPU model is set, as instructed in Setting virtual machine CPU model.
  • Check the supported CPU feature flags on your compute nodes in the lscpu command output.

To enable or disable CPU features

  1. Check the CPU model set for the compute cluster. For example:

    # vinfra service compute show | grep cpu_model:
    | options      | cpu_model: Broadwell
  2. Configure the desired CPU features for this CPU model. For example, to disable nested virtualization for Intel-based virtual machines, run:

    # vinfra service compute set --cpu-model Broadwell --cpu-features='-vmx'
  3. If you want to re-enable this CPU feature, run:

    # vinfra service compute set --cpu-model Broadwell --cpu-features='+vmx'

Once you have configured CPU features for the compute cluster, you can start creating virtual machines.

To check CPU features of a virtual machine

  1. Find out the host and ID of the required virtual machine by listing VMs in the compute cluster. For example:

    # vinfra service compute server list
    +--------------------------------------+-------+--------+------------------------+---------------------------+
    | id                                   | name  | status | host                   | networks                  |
    +--------------------------------------+-------+--------+------------------------+---------------------------+
    | e893481f-f5d1-4c59-8c81-fc3df45b71f8 | myvm  | ACTIVE | node001.vstoragedomain | - private=192.168.128.237 |
    +--------------------------------------+-------+--------+------------------------+---------------------------+
  2. Log in to the host compute node and check the VM configuration by using the virsh dumpxml command. For example:

    # ssh node001.vstoragedomain
    # virsh dumpxml e893481f-f5d1-4c59-8c81-fc3df45b71f8 | grep vmx
        <feature policy='disable' name='vmx'/>