You can define different migration configurations for specified groups of virtual machine instances (VMIs) by using a live migration policy.

Live migration policy is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.

To configure a live migration policy by using the web console, see the MigrationPolicies page documentation.

Configuring a live migration policy from the command line

Use the MigrationPolicy custom resource definition (CRD) to define migration policies for one or more groups of selected virtual machine instances (VMIs).

You can specify groups of VMIs by using any combination of the following:

  • Virtual machine instance labels such as size, os, gpu, and other VMI labels.

  • Namespace labels such as priority, bandwidth, hpc-workload, and other namespace labels.

For the policy to apply to a specific group of VMIs, all labels on the group of VMIs must match the labels in the policy.

If multiple live migration policies apply to a VMI, the policy with the highest number of matching labels takes precedence. If multiple policies meet this criteria, the policies are sorted by lexicographic order of the matching labels keys, and the first one in that order takes precedence.

  1. Create a MigrationPolicy CRD for your specified group of VMIs. The following example YAML configures a group with the labels hpc-workloads:true, xyz-workloads-type: "", workload-type: db, and operating-system: "":

    apiVersion: migrations.kubevirt.io/v1beta1
    kind: MigrationPolicy
      name: my-awesome-policy
      # Migration Configuration
      allowAutoConverge: true
      bandwidthPerMigration: 217Ki
      completionTimeoutPerGiB: 23
      allowPostCopy: false
      # Matching to VMIs
        namespaceSelector: (1)
          hpc-workloads: "True"
          xyz-workloads-type: ""
        virtualMachineInstanceSelector: (2)
          workload-type: "db"
          operating-system: ""
    1 Use namespaceSelector to define a group of VMIs by using namespace labels.
    2 Use virtualMachineInstanceSelector to define a group of VMIs by using VMI labels.