|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * migrating_from_ocp_3_to_4/advanced-migration-options-3-4.adoc |
| 4 | +// * migration-toolkit-for-containers/advanced-migration-options-mtc.adoc |
| 5 | + |
| 6 | +[id="migration-enabling-pv-resizing-dvm_{context}"] |
| 7 | += Enabling persistent volume resizing for direct volume migration |
| 8 | + |
| 9 | +You can enable persistent volume (PV) resizing for direct volume migration to avoid running out of disk space on the destination cluster. |
| 10 | + |
| 11 | +When the disk usage of a PV reaches a configured level, the `MigrationController` custom resource (CR) compares the requested storage capacity of a persistent volume claim (PVC) to its actual provisioned capacity. Then, it calculates the space required on the destination cluster. |
| 12 | + |
| 13 | +A `pv_resizing_threshold` parameter determines when PV resizing is used. The default threshold is `3%`. This means that PV resizing occurs when the disk usage of a PV is more than `97%`. You can increase this threshold so that PV resizing occurs at a lower disk usage level. |
| 14 | + |
| 15 | +PVC capacity is calculated according to the following criteria: |
| 16 | + |
| 17 | +* If the requested storage capacity (`spec.resources.requests.storage`) of the PVC is not equal to its actual provisioned capacity (`status.capacity.storage`), the greater value is used. |
| 18 | +* If a PV is provisioned through a PVC and then subsequently changed so that its PV and PVC capacities no longer match, the greater value is used. |
| 19 | + |
| 20 | +.Prerequisites |
| 21 | + |
| 22 | +* The PVCs must be attached to one or more running pods so that the `MigrationController` CR can execute commands. |
| 23 | + |
| 24 | +.Procedure |
| 25 | + |
| 26 | +. Log in to the host cluster. |
| 27 | +. Enable PV resizing by patching the `MigrationController` CR: |
| 28 | ++ |
| 29 | +[source,terminal] |
| 30 | +---- |
| 31 | +$ oc patch migrationcontroller migration-controller -p '{"spec":{"enable_dvm_pv_resizing":true}}' \ <1> |
| 32 | + --type='merge' -n openshift-migration |
| 33 | +---- |
| 34 | +<1> Set the value to `false` to disable PV resizing. |
| 35 | + |
| 36 | +. Optional: Update the `pv_resizing_threshold` parameter to increase the threshold: |
| 37 | ++ |
| 38 | +[source,terminal] |
| 39 | +---- |
| 40 | +$ oc patch migrationcontroller migration-controller -p '{"spec":{"pv_resizing_threshold":41}}' \ <1> |
| 41 | + --type='merge' -n openshift-migration |
| 42 | +---- |
| 43 | +<1> The default value is `3`. |
| 44 | ++ |
| 45 | +When the threshold is exceeded, the following status message is displayed in the `MigPlan` CR status: |
| 46 | ++ |
| 47 | +[source,yaml] |
| 48 | +---- |
| 49 | +status: |
| 50 | + conditions: |
| 51 | +... |
| 52 | + - category: Warn |
| 53 | + durable: true |
| 54 | + lastTransitionTime: "2021-06-17T08:57:01Z" |
| 55 | + message: 'Capacity of the following volumes will be automatically adjusted to avoid disk capacity issues in the target cluster: [pvc-b800eb7b-cf3b-11eb-a3f7-0eae3e0555f3]' |
| 56 | + reason: Done |
| 57 | + status: "False" |
| 58 | + type: PvCapacityAdjustmentRequired |
| 59 | +---- |
| 60 | ++ |
| 61 | +[NOTE] |
| 62 | +==== |
| 63 | +For AWS gp2 storage, this message does not appear unless the `pv_resizing_threshold` is 42% or greater because of the way gp2 calculates volume usage and size. (link:https://bugzilla.redhat.com/show_bug.cgi?id=1973148[*BZ#1973148*]) |
| 64 | +==== |
0 commit comments