|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * virt/upgrading-virt.adoc |
| 4 | + |
| 5 | +[id="virt-configuring-workload-update-methods_{context}"] |
| 6 | += Configuring workload update methods |
| 7 | + |
| 8 | +When you upgrade {VirtProductName}, virtual machine instance (VMI) workloads, such as `virt-launcher` pods, update automatically if they support live migration. You can configure workload update strategies or opt out of workload updates by editing the `HyperConverged` custom resource (CR). |
| 9 | + |
| 10 | +.Prerequisites |
| 11 | + |
| 12 | +* To use live migration as an update method, you must first enable live migration in the cluster. |
| 13 | ++ |
| 14 | +[NOTE] |
| 15 | +==== |
| 16 | +If a `VirtualMachineInstance` CR contains `evictionStrategy: LiveMigrate` and the VMI does not support live migration, the VMI will not update. |
| 17 | +==== |
| 18 | + |
| 19 | +.Procedure |
| 20 | + |
| 21 | +. To open the `HyperConverged` CR in your default editor, run the following command: |
| 22 | ++ |
| 23 | +[source,terminal] |
| 24 | +---- |
| 25 | +$ oc edit hco -n openshift-cnv kubevirt-hyperconverged |
| 26 | +---- |
| 27 | + |
| 28 | +. Edit the `workloadUpdateStrategy` stanza of the `HyperConverged` CR. For example: |
| 29 | ++ |
| 30 | +[source,yaml] |
| 31 | +---- |
| 32 | +apiVersion: hco.kubevirt.io/v1beta1 |
| 33 | +kind: HyperConverged |
| 34 | +metadata: |
| 35 | + name: kubevirt-hyperconverged |
| 36 | +spec: |
| 37 | + workloadUpdateStrategy: |
| 38 | + workloadUpdateMethods: <1> |
| 39 | + - LiveMigrate <2> |
| 40 | + - Evict <3> |
| 41 | + batchEvictionSize: 10 <4> |
| 42 | + batchEvictionInterval: "1m0s" <5> |
| 43 | +---- |
| 44 | +<1> The methods that can be used to perform automated workload updates. The supported values are `LiveMigrate` and `Evict`. By default, only `LiveMigrate` is enabled. 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, set `workloadUpdateMethods: []` to leave the array empty. |
| 45 | +<2> 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. `LiveMigrate` is enabled by default. |
| 46 | +<3> 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. `Evict` is not enabled by default. |
| 47 | +<4> The number of VMIs that can be forced to be updated at a time. The default value is `10`. |
| 48 | +<5> The interval to wait before evicting the next batch of workloads. The default value is `"1m0s"`. |
| 49 | + |
| 50 | +. To apply your changes, save and exit the editor. |
0 commit comments