Skip to content

Commit e913d0f

Browse files
authored
Merge pull request #98489 from Vaishali-gif-rh/CNV-65115
CNV- 65115: How to migrate a VM to a specific destination node
2 parents 6036eb5 + c4f73fb commit e913d0f

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Module included in the following assemblies:
2+
//
3+
// virt/live_migration/virt-configuring-live-migration.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="virt-migrate-vm-to-labeled-node_{context}"]
7+
= Migrating a VM to a specific node
8+
9+
You can migrate a running virtual machine (VM) to a specific subset of nodes by using the `addedNodeSelector` field on the `VirtualMachineInstanceMigration` object. This field lets you apply additional node selection rules for a *one-time* migration attempt, without affecting the VM configuration or future migrations.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster as a user with the `cluster-admin` role.
14+
* The VM you want to migrate is running.
15+
* You have identified the labels of the target nodes. Multiple labels can be specified and are combined with logical `AND`.
16+
* The `oc` CLI tool is installed.
17+
18+
.Procedure
19+
20+
. Create a migration manifest YAML file. For example:
21+
+
22+
[source,yaml]
23+
----
24+
apiVersion: kubevirt.io/v1
25+
kind: VirtualMachineInstanceMigration
26+
metadata:
27+
name: migration-job
28+
spec:
29+
vmiName: vmi-fedora
30+
addedNodeSelector:
31+
accelerator: gpu-enabled23
32+
kubernetes.io/hostname: "ip-172-28-114-199.example"
33+
----
34+
+
35+
36+
where:
37+
38+
`vmiName`:: Specifies the name of the running VM (for example, `vmi-fedora`).
39+
`addedNodeSelector`:: Specifies additional constraints for selecting the target node.
40+
41+
. Apply the manifest to the cluster by running the following command:
42+
+
43+
[source,terminal]
44+
----
45+
$ oc apply -f <file_name>.yaml
46+
----
47+
+
48+
If no nodes satisfy the constraints, the migration is declared a failure after a timeout. The VM remains unaffected.

virt/live_migration/virt-configuring-live-migration.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
:_mod-docs-content-type: ASSEMBLY
22
[id="virt-configuring-live-migration"]
33
= Configuring live migration
4+
45
include::_attributes/common-attributes.adoc[]
6+
57
:context: virt-configuring-live-migration
68

79
toc::[]
@@ -31,6 +33,8 @@ You can create live migration policies by using the {product-title} web console.
3133

3234
include::modules/virt-configuring-a-live-migration-policy.adoc[leveloffset=+2]
3335

36+
include::modules/virt-migrate-vm-to-labeled-node.adoc[leveloffset=+1]
37+
3438
[role="_additional-resources"]
3539
[id="additional-resources_virt-configuring-live-migration"]
3640
== Additional resources

0 commit comments

Comments
 (0)