Skip to content

OSDOCS#39419: Fixing procedure for creating live migration policies #78982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions modules/virt-configuring-a-live-migration-policy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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 <vm_name>
----

.. 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: <vm_name>
namespace: default
labels:
app: my-app
environment: production
spec:
template:
metadata:
labels:
kubevirt.io/domain: <vm_name>
kubevirt.io/size: large
kubevirt.io/environment: production
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might not be a complete YAML example, so consider ending the YAML with:

...

This syntax aligns with the following guideline:

https://github.com/openshift/openshift-docs/blob/main/contributing_to_docs/doc_guidelines.adoc#yaml-formatting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it's not complete, will indicate as much in the codeblock

# ...
----

.. 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]
----
Expand All @@ -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.
Expand Down