// Module included in the following assemblies:
//
// * virt/updating/upgrading-virt.adoc

:_mod-docs-content-type: PROCEDURE
[id="virt-configuring-workload-update-methods_{context}"]
= Configuring workload update methods

[role="_abstract"]
You can configure how virtual machine workloads are updated during cluster upgrades by editing the `HyperConverged` custom resource (CR).

.Prerequisites

* You have enabled live migration in the cluster.
+
[NOTE]
====
If a `VirtualMachineInstance` CR contains `evictionStrategy: LiveMigrate` and the virtual machine instance (VMI) does not support live migration, the VMI will not update.
====

* You have installed the {oc-first}.

.Procedure

. To open the `HyperConverged` CR in your default editor, run the following command:
+
[source,terminal,subs="attributes+"]
----
$ oc edit {HCOCliKind} kubevirt-hyperconverged -n {CNVNamespace}
----

. Edit the `workloadUpdateStrategy` stanza of the `HyperConverged` CR. For example:
+
[source,yaml]
----
apiVersion: hco.kubevirt.io/v1
kind: HyperConverged
metadata:
  name: kubevirt-hyperconverged
spec:
  virtualization:
    workloadUpdateStrategy:
      workloadUpdateMethods:
      - LiveMigrate
      - Evict
      batchEvictionSize: 10
      batchEvictionInterval: "1m0s"
# ...
----
** `spec.virtualization.workloadUpdateStrategy.workloadUpdateMethods` defines the methods that can be used to perform automated workload updates. The available values are `LiveMigrate` and `Evict`. If you enable both options as shown in this example, updates use `LiveMigrate` for VMIs that support live migration and `Evict` for any VMIs that do not support live migration. To disable automatic workload updates, you can either remove the `workloadUpdateStrategy` stanza or set `workloadUpdateMethods: []` to leave the array empty.
*** `LiveMigrate` is the least disruptive update method. VMIs that support live migration are updated by migrating the virtual machine (VM) guest into a new pod with the updated components enabled. If `LiveMigrate` is the only workload update method listed, VMIs that do not support live migration are not disrupted or updated.
*** `Evict` is a disruptive method that shuts down VMI pods during upgrade. `Evict` is the only update method available if live migration is not enabled in the cluster. If a VMI is controlled by a `VirtualMachine` object that has `runStrategy: Always` configured, a new VMI is created in a new pod with updated components.
** `spec.virtualization.workloadUpdateStrategy.batchEvictionSize` defines the number of VMIs that can be forced to be updated at a time by using the `Evict` method. This does not apply to the `LiveMigrate` method.
** `spec.virtualization.workloadUpdateStrategy.batchEvictionInterval` defines the interval to wait before evicting the next batch of workloads. This does not apply to the `LiveMigrate` method.
+
[NOTE]
====
You can configure live migration limits and timeouts by editing the `spec.virtualization.liveMigrationConfig` stanza of the `HyperConverged` CR.
====

. To apply your changes, save and exit the editor.
