Configuring live migration policies

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.

Procedure

  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: "":

    1. apiVersion: migrations.kubevirt.io/v1beta1
    2. kind: MigrationPolicy
    3. metadata:
    4. name: my-awesome-policy
    5. spec:
    6. # Migration Configuration
    7. allowAutoConverge: true
    8. bandwidthPerMigration: 217Ki
    9. completionTimeoutPerGiB: 23
    10. allowPostCopy: false
    11. # Matching to VMIs
    12. selectors:
    13. namespaceSelector: (1)
    14. hpc-workloads: "True"
    15. xyz-workloads-type: ""
    16. virtualMachineInstanceSelector: (2)
    17. workload-type: "db"
    18. operating-system: ""
    1Use namespaceSelector to define a group of VMIs by using namespace labels.
    2Use virtualMachineInstanceSelector to define a group of VMIs by using VMI labels.