You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= Creating a live migration policy by using the command line
8
8
9
-
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:
9
+
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:
10
10
11
11
* VM labels such as `size`, `os`, or `gpu`
12
12
* 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
22
22
23
23
.Procedure
24
24
25
-
. Create a `MigrationPolicy` object as in the following example:
25
+
. Edit the VM object to which you want to apply a live migration policy, and add the corresponding VM labels.
26
+
27
+
.. Open the YAML configuration of the resource:
28
+
+
29
+
[source,terminal]
30
+
----
31
+
$ oc edit vm <vm_name>
32
+
----
33
+
34
+
.. 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:
35
+
+
36
+
[source,yaml, subs="+quotes"]
37
+
----
38
+
apiVersion: migrations.kubevirt.io/v1alpha1
39
+
kind: VirtualMachine
40
+
metadata:
41
+
name: <vm_name>
42
+
namespace: default
43
+
labels:
44
+
app: my-app
45
+
environment: production
46
+
spec:
47
+
template:
48
+
metadata:
49
+
labels:
50
+
kubevirt.io/domain: <vm_name>
51
+
kubevirt.io/size: large
52
+
kubevirt.io/environment: production
53
+
# ...
54
+
----
55
+
56
+
.. Save and exit the configuration.
57
+
58
+
. Configure a `MigrationPolicy` object with the corresponding labels. The following example configures a policy that applies to all VMs that are labeled as `production`:
0 commit comments