Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions hosted_control_planes/hcp-manage/hcp-manage-virt.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ include::modules/hcp-virt-attach-nvidia-gpus.adoc[leveloffset=+1]

include::modules/hcp-virt-attach-nvidia-gpus-np-api.adoc[leveloffset=+1]

include::modules/hcp-virt-evict-vms.adoc[leveloffset=+1]

include::modules/hcp-topology-spread-constraint.adoc[leveloffset=+1]

[role="_additional-resources"]
Expand Down
53 changes: 53 additions & 0 deletions modules/hcp-virt-evict-vms.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Module included in the following assemblies:
//
// * hosted_control_planes/hcp-manage/hcp-manage-virt.adoc

:_mod-docs-content-type: PROCEDURE
[id="hcp-virt-evict-vms_{context}"]
= Evicting KubeVirt virtual machines

In cases where KubeVirt virtual machines (VMs) cannot be live migrated, such as when you use GPU passthrough, the VMs must be evicted at the same time as the `NodePool` resource of the hosted cluster. Otherwise, the compute nodes might be shut down without being drained from the workload. This might also happen when you are upgrading the {VirtProductName} Operator. To achieve a synchronized restart, you can set the `evictionStrategy` parameter on the `hyperconverged` resource to ensure that only VMs that are drained from workloads are rebooted.

.Procedure

. To learn more about the `hyperconverged` resource and the allowed values for the `evictionStrategy` parameter, enter the following command:
+
[source,terminal]
----
$ oc explain hyperconverged.spec.evictionStrategy
----

. Patch the `hyperconverged` resource by entering the following command:
+
[source,terminal]
----
$ oc -n openshift-cnv patch hyperconverged kubevirt-hyperconverged \
--type=merge \
-p '{"spec": {"evictionStrategy": "External"}}'
----

. Patch the workload update strategy and the workload update methods by entering the following command:
+
[source,terminal]
----
$ oc -n openshift-cnv patch hyperconverged kubevirt-hyperconverged \
--type=merge \
-p '{"spec": {"workloadUpdateStrategy": {"workloadUpdateMethods": ["LiveMigrate","Evict"]}}}'
----
+
By applying this patch, you specify that VMs should be live-migrated if possible, and that only the VMs that cannot be live-migrated should be evicted.

.Verification

* Check whether the patch command was applied properly by entering the following command:
+
[source,terminal]
----
$ oc -n openshift-cnv get hyperconverged kubevirt-hyperconverged -ojsonpath='{.spec.evictionStrategy}'
----
+
.Example output
[source,terminal]
----
External
----