|
| 1 | +:_mod-docs-content-type: ASSEMBLY |
| 2 | +[id="mtc-migrating-vms"] |
| 3 | += Migrating virtual machine storage |
| 4 | +include::_attributes/common-attributes.adoc[] |
| 5 | +:context: mtc-migrating-vms |
| 6 | + |
| 7 | +toc::[] |
| 8 | + |
| 9 | +You can migrate virtual machine (VM) storage _offline_, when you have the VM turned off, or _online_, when the VM is running. |
| 10 | + |
| 11 | +For KubeVirt VMs, the primary use case for VM storage migration is if you want to migrate from one storage class to another. You might migrate VM storage for one of the following reasons: |
| 12 | + |
| 13 | +* You are rebalancing between different storage providers. |
| 14 | +* New storage is available that is better suited to the workload running inside the VM. |
| 15 | +
|
| 16 | +:FeatureName: Virtual machine storage migration |
| 17 | +include::snippets/technology-preview.adoc[] |
| 18 | + |
| 19 | +include::modules/mtc-vm-storage-migration-process-works.adoc[leveloffset=+1] |
| 20 | + |
| 21 | +[id="mtc-supported-persistent-volumes-actions-vms_{context}"] |
| 22 | +== Supported persistent volume actions |
| 23 | + |
| 24 | +.Supported persistent volume actions |
| 25 | +[width="100%",cols="15%,15%,70%",options="header"] |
| 26 | +|=== |
| 27 | +|Action |
| 28 | +|Supported |
| 29 | +|User-initiated steps |
| 30 | + |
| 31 | +|Copy |
| 32 | +|Yes |
| 33 | +a| |
| 34 | +* Create a new persistent volume (PV) in the same namespace. |
| 35 | +* Copy data from the source PV to the target PV, and change the VM definition to point to the new PV. |
| 36 | +** If you have the `liveMigrate` flag set, the VM migrates live. |
| 37 | +** If you do have the `liveMigrate` flag set, the VM shuts down, the source PV contents are copied to the target PV, and the the VM is started. |
| 38 | + |
| 39 | +|Move |
| 40 | +|No |
| 41 | +|This action is not supported. |
| 42 | +|=== |
| 43 | + |
| 44 | + |
| 45 | +[id="mtc-vm-storage-prerequisites-for-migration_{context}"] |
| 46 | +== Prerequisites |
| 47 | + |
| 48 | +Before migrating virtual machine storage, you must install xref:../virt/install/installing-virt.adoc#installing-virt-operator_installing-virt[{VirtProductName} Operator]. |
| 49 | + |
| 50 | +To support storage live migration, you need to deploy {VirtProductName} version 4.17 or later. Earlier versions of {VirtProductName} do not support live storage migration. |
| 51 | + |
| 52 | +You also need to configure `KubeVirt` to enable storage live migration according to the xref:../virt/live_migration/virt-configuring-live-migration.adoc#virt-configuring-live-migration-limits_virt-configuring-live-migration[Configuring live migration]. |
| 53 | + |
| 54 | +In {VirtProductName} 4.17.0, not all the required feature gates are enabled. However, to use the storage live migration feature, you must enable the feature gate. |
| 55 | + |
| 56 | +Enable the feature gate by running the following command: |
| 57 | + |
| 58 | +[source,terminal] |
| 59 | +---- |
| 60 | +$ oc annotate --overwrite -n openshift-cnv hco kubevirt-hyperconverged kubevirt.kubevirt.io/jsonpatch='[ {"op": "add", "path": "/spec/configuration/developerConfiguration/featureGates/-", "value": "VolumesUpdateStrategy"}, {"op": "add", "path": "/spec/configuration/developerConfiguration/featureGates/-", "value": "VolumeMigration"} ]' |
| 61 | +---- |
| 62 | + |
| 63 | +[WARNING] |
| 64 | +==== |
| 65 | +Red{nbsp}Hat does not support clusters with the annotation enabling this feature gate. |
| 66 | +
|
| 67 | +Do not add this annotation in a production cluster, if you add that annotation you receive a cluster wide alert indicating that your cluster is no longer supported. |
| 68 | +==== |
| 69 | + |
| 70 | +For more information about the deployments and custom resource definitions (CRDs) that the migration controller uses to manipulate the VMs, see xref:../migrating_from_ocp_3_to_4/advanced-migration-options-3-4.adoc#migration-controller-options_advanced-migration-options-3-4[Migration controller options]. |
| 71 | + |
| 72 | +[NOTE] |
| 73 | +==== |
| 74 | +If the `mig-controller` pod starts before you install {VirtProductName}, the migration controller does not automatically see that you have the {VirtProductName} Custom Resource Definition (CRD) installed. |
| 75 | +
|
| 76 | +Restart the `mig-controller` pod in the `openshift-migration` namespace after installing {VirtProductName}. |
| 77 | +==== |
| 78 | + |
| 79 | +The following table explains that to use storage live migrations, you need to have {VirtProductName} installed. Moreover, you must use {mtc-short} CRDs and at least two storage classes. |
| 80 | + |
| 81 | +.Storage live migration requirements |
| 82 | +[width="100%",cols="50%,50%",options="header",] |
| 83 | +|=== |
| 84 | +|Resource |Purpose |
| 85 | +|`MigCluster` |
| 86 | +|Represents the cluster to use when migrating the storage. |
| 87 | + |
| 88 | +|`StorageClass` |
| 89 | +|The storage class, ensure there are at least two storage classes. |
| 90 | + |
| 91 | +|`VirtualMachine` |
| 92 | +|A virtual machine definition, installed by KubeVirt. |
| 93 | + |
| 94 | +|`VirtualMachineInstance` |
| 95 | +|A running virtual machine, installed by KubeVirt. |
| 96 | + |
| 97 | +|`DataVolume` |
| 98 | +|A definition on how to populate a persistent volume (PV) with a VM disk, installed by Containerized Data Importer (CDI). |
| 99 | +|=== |
| 100 | + |
| 101 | + |
| 102 | +include::modules/mtc-deploying-a-vm.adoc[leveloffset=+1] |
| 103 | + |
| 104 | +include::modules/migration-creating-migration-plan-cam.adoc[leveloffset=+1] |
| 105 | + |
| 106 | +include::modules/mtc-vm-creating-mig-plan-yaml.adoc[leveloffset=+2] |
| 107 | + |
| 108 | +include::modules/mtc-migrating-vms-known-issues.adoc[leveloffset=+1] |
0 commit comments