From 7316215c9b315e4629be66bfabb80afcf438761b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Herrmann?= Date: Wed, 17 Jul 2024 10:23:49 +0200 Subject: [PATCH] CNV-39419: Added new steps for live migration policies --- ...t-configuring-a-live-migration-policy.adoc | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/modules/virt-configuring-a-live-migration-policy.adoc b/modules/virt-configuring-a-live-migration-policy.adoc index 15065bcad654..d6d02492c12f 100644 --- a/modules/virt-configuring-a-live-migration-policy.adoc +++ b/modules/virt-configuring-a-live-migration-policy.adoc @@ -6,7 +6,7 @@ [id="virt-configuring-a-live-migration-policy_{context}"] = Creating a live migration policy by using the command line -You can create a live migration policy by using the command line. A live migration policy is applied to selected virtual machines (VMs) by using any combination of labels: +You can create a live migration policy by using the command line. KubeVirt applies the live migration policy to selected virtual machines (VMs) by using any combination of labels: * VM labels such as `size`, `os`, or `gpu` * Project labels such as `priority`, `bandwidth`, or `hpc-workload` @@ -22,7 +22,40 @@ If multiple policies meet this criteria, the policies are sorted by alphabetical .Procedure -. Create a `MigrationPolicy` object as in the following example: +. Edit the VM object to which you want to apply a live migration policy, and add the corresponding VM labels. + +.. Open the YAML configuration of the resource: ++ +[source,terminal] +---- +$ oc edit vm +---- + +.. Adjust the required label values in the `.spec.template.metadata.labels` section of the configuration. For example, to mark the VM as a `production` VM for the purposes of migration policies, add the `kubevirt.io/environment: production` line: ++ +[source,yaml, subs="+quotes"] +---- +apiVersion: migrations.kubevirt.io/v1alpha1 +kind: VirtualMachine +metadata: + name: + namespace: default + labels: + app: my-app + environment: production +spec: + template: + metadata: + labels: + kubevirt.io/domain: + kubevirt.io/size: large + kubevirt.io/environment: production +# ... +---- + +.. Save and exit the configuration. + +. Configure a `MigrationPolicy` object with the corresponding labels. The following example configures a policy that applies to all VMs that are labeled as `production`: + [source,yaml] ---- @@ -36,8 +69,7 @@ spec: hpc-workloads: "True" xyz-workloads-type: "" virtualMachineInstanceSelector: <2> - workload-type: "db" - operating-system: "" + kubevirt.io/environment: "production" ---- <1> Specify project labels. <2> Specify VM labels.