diff --git a/hosted_control_planes/hcp-manage/hcp-manage-virt.adoc b/hosted_control_planes/hcp-manage/hcp-manage-virt.adoc index aaf46eb970e1..8ef7c5416622 100644 --- a/hosted_control_planes/hcp-manage/hcp-manage-virt.adoc +++ b/hosted_control_planes/hcp-manage/hcp-manage-virt.adoc @@ -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"] diff --git a/modules/hcp-virt-evict-vms.adoc b/modules/hcp-virt-evict-vms.adoc new file mode 100644 index 000000000000..dff80ec97722 --- /dev/null +++ b/modules/hcp-virt-evict-vms.adoc @@ -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 +---- \ No newline at end of file