|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * virt/live_migration/virt-configuring-live-migration-policies.adoc |
| 4 | + |
| 5 | + |
| 6 | +:_content-type: PROCEDURE |
| 7 | +[id="virt-configuring-a-live-migration-policy_{context}"] |
| 8 | += Configuring a live migration policy |
| 9 | + |
| 10 | +Use the `MigrationPolicy` custom resource definition (CRD) to define migration policies for one or more groups of selected virtual machine instances (VMIs). |
| 11 | + |
| 12 | +You can specify groups of VMIs by using any combination of the following: |
| 13 | + |
| 14 | +* Virtual machine instance labels such as `size`, `os`, `gpu`, and other VMI labels. |
| 15 | +* Namespace labels such as `priority`, `bandwidth`, `hpc-workload`, and other namespace labels. |
| 16 | +
|
| 17 | +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. |
| 18 | + |
| 19 | +[NOTE] |
| 20 | +==== |
| 21 | +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. |
| 22 | +==== |
| 23 | + |
| 24 | +.Procedure |
| 25 | + |
| 26 | +. 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: ""`: |
| 27 | + |
| 28 | ++ |
| 29 | +[source,yaml] |
| 30 | +---- |
| 31 | +apiVersion: migrations.kubevirt.io/v1alpha1 |
| 32 | +kind: MigrationPolicy |
| 33 | +metadata: |
| 34 | + name: my-awesome-policy |
| 35 | +spec: |
| 36 | + # Migration Configuration |
| 37 | + allowAutoConverge: true |
| 38 | + bandwidthPerMigration: 217Ki |
| 39 | + completionTimeoutPerGiB: 23 |
| 40 | + allowPostCopy: false |
| 41 | +
|
| 42 | + # Matching to VMIs |
| 43 | + selectors: |
| 44 | + namespaceSelector: <1> |
| 45 | + matchLabels: |
| 46 | + hpc-workloads: true |
| 47 | + xyz-workloads-type: "" |
| 48 | + virtualMachineInstanceSelector: <2> |
| 49 | + matchLabels: |
| 50 | + workload-type: db |
| 51 | + operating-system: "" |
| 52 | +---- |
| 53 | +<1> Use `namespaceSelector` to define a group of VMIs by using namespace labels. |
| 54 | +<2> Use `virtualMachineInstanceSelector` to define a group of VMIs by using VMI labels. |
0 commit comments