Chapter 4. Migrating from OpenStack
Run your OpenStack migration plan from the MTV UI or from the command-line.
4.1. Prerequisites Copy linkLink copied to clipboard!
- You have planned your migration from OpenStack.
4.2. Running a migration plan in the MTV UI Copy linkLink copied to clipboard!
You can run a migration plan and view its progress in the Red Hat OpenShift web console.
Prerequisites
- Valid migration plan.
Procedure
In the Red Hat OpenShift web console, click Migration for Virtualization > Migration plans.
The Plans list displays the source and target providers, the number of virtual machines (VMs) being migrated, the status, the date that the migration started, and the description of each plan.
- Click Start beside a migration plan to start the migration.
Click Start in the confirmation window that opens.
The plan’s Status changes to Running, and the migration’s progress is displayed.
WarningDo not take a snapshot of a VM after you start a migration. Taking a snaphot after a migration starts might cause the migration to fail.
Optional: Click the links in the migration’s Status to see its overall status and the status of each VM:
- The link on the left indicates whether the migration failed, succeeded, or is ongoing. It also reports the number of VMs whose migration succeeded, failed, or was canceled.
The link on the right opens the Virtual machines tab of the Plan details page. For each VM, the tab displays the following data:
- The name of the VM
- The start and end times of the migration
- The amount of data copied
- A progress pipeline for the VM’s migration
Optional: To view your migration’s logs, either as it is running or after it is completed, perform the following actions:
- Click the Virtual machines tab.
Click the arrow (>) to the left of the virtual machine whose migration progress you want to check.
The VM’s details are displayed.
In the Pods section, in the Pod links column, click the Logs link.
The Logs tab opens.
NoteLogs are not always available. The following are common reasons for logs not being available:
-
The migration is from OpenShift Virtualization to OpenShift Virtualization. In this case,
virt-v2vis not involved, so no pod is required. - No pod was created.
- The pod was deleted.
- The migration failed before running the pod.
-
The migration is from OpenShift Virtualization to OpenShift Virtualization. In this case,
- To see the raw logs, click the Raw link.
- To download the logs, click the Download link.
4.2.1. Migration plan options Copy linkLink copied to clipboard!
On the Migration plans page of the Red Hat OpenShift web console, you can click the Options menu
beside a migration plan to access the following options:
Edit Plan: Edit the details of a migration plan. If the plan is running or has completed successfully, you cannot edit the following options:
- All properties on the Settings section of the Plan details page. For example, warm or cold migration, target namespace, and preserved static IPs.
- The plan’s mapping on the Mappings tab.
- The hooks listed on the Hooks tab.
- Start migration: Active only if relevant.
- Restart migration: Restart a migration that was interrupted. Before choosing this option, make sure there are no error messages. If there are, you need to edit the plan.
Duplicate: Create a new migration plan with the same virtual machines (VMs), parameters, mappings, and hooks as an existing plan. You can use this feature for the following tasks:
- Migrate VMs to a different namespace.
- Edit an archived migration plan.
- Edit a migration plan with a different status, for example, failed, canceled, running, critical, or ready.
Archive: Delete the logs, history, and metadata of a migration plan. The plan cannot be edited or restarted. It can only be viewed, duplicated, or deleted.
NoteArchive is irreversible. However, you can duplicate an archived plan.
Delete: Permanently remove a migration plan. You cannot delete a running migration plan.
NoteDelete is irreversible.
Deleting a migration plan does not remove temporary resources. To remove temporary resources, archive the plan first before deleting it.
NoteThe results of archiving and then deleting a migration plan vary by whether you created the plan and its storage and network mappings using the CLI or the UI.
- If you created them using the UI, then the migration plan and its mappings no longer appear in the UI.
- If you created them using the CLI, then the mappings might still appear in the UI. This is because mappings in the CLI can be used by more than one migration plan, but mappings created in the UI can only be used in one migration plan.
4.2.2. Canceling a migration Copy linkLink copied to clipboard!
You can cancel the migration of some or all virtual machines (VMs) while a migration plan is in progress by using the Red Hat OpenShift web console.
Procedure
- In the Red Hat OpenShift web console, click Migration for Virtualization > Migration plans.
- Click the name of a running migration plan to view the migration details.
- Select one or more VMs and click Cancel.
Click Yes, cancel to confirm the cancellation.
In the Migration details by VM list, the status of the canceled VMs is Canceled. The unmigrated and the migrated virtual machines are not affected.
- Restart a canceled migration by clicking Restart beside the migration plan on the Migration plans page.
4.3. Running an OpenStack migration from the command-line Copy linkLink copied to clipboard!
You can migrate from an OpenStack source provider by using the command-line interface (CLI).
Prerequisites
- If you are using a user-defined network (UDN), note the name of its namespace as defined in OpenShift Virtualization.
Procedure
Create a
Secretmanifest for the source provider credentials:$ cat << EOF | oc apply -f - apiVersion: v1 kind: Secret metadata: name: <secret> namespace: <namespace> ownerReferences: - apiVersion: forklift.konveyor.io/v1beta1 kind: Provider name: <provider_name> uid: <provider_uid> labels: createdForProviderType: openstack createdForResourceType: providers type: Opaque stringData: user: <user> password: <password> insecureSkipVerify: <"true"/"false"> domainName: <domain_name> projectName: <project_name> regionName: <region_name> cacert: | <ca_certificate> url: <api_end_point> EOFwhere:
ownerReferences-
Is an optional section in which you can specify a provider’s
nameanduid. <user>- Specifies the OpenStack user.
<password>- Specifies the user OpenStack password.
<"true"/"false">-
Specifies
"true"to skip certificate verification, and specifies"false"to verify the certificate. Defaults to"false"if not specified. Skipping certificate verification proceeds with an insecure migration and then the certificate is not required. Insecure migration means that the transferred data is sent over an insecure connection and potentially sensitive data could be exposed. cacert- Specifies the CA cert object. When this field is not set and skip certificate verification is disabled, MTV attempts to use the system CA.
<api_end_point>-
Specifies the API endpoint URL, for example,
https://<identity_service>/v3.
Create a
Providermanifest for the source provider:$ cat << EOF | oc apply -f - apiVersion: forklift.konveyor.io/v1beta1 kind: Provider metadata: name: <source_provider> namespace: <namespace> spec: type: openstack url: <api_end_point> secret: name: <secret> namespace: <namespace> EOFwhere:
<api_end_point>- Specifies the URL of the API endpoint.
<secret>-
Specifies the name of the provider
SecretCR.
Create a
NetworkMapmanifest to map the source and destination networks:$ cat << EOF | oc apply -f - apiVersion: forklift.konveyor.io/v1beta1 kind: NetworkMap metadata: name: <network_map> namespace: <namespace> spec: map: - destination: name: <network_name> type: pod source: id: <source_network_id> name: <source_network_name> - destination: name: <network_attachment_definition> namespace: <network_attachment_definition_namespace> type: multus source: id: <source_network_id> name: <source_network_name> provider: source: name: <source_provider> namespace: <namespace> destination: name: <destination_provider> namespace: <namespace> EOFwhere:
type-
Specifies the network type. Allowed values are
podandmultus. source-
Specifies the source network. You can use either the
idor thenameparameter to specify the source network. Forid, specify the OpenStack network UUID. <network_attachment_definition>- Specifies a network attachment definition (NAD) for each additional OpenShift Virtualization network.
<network_attachment_definition_namespace>-
Specifies the namespace of the OpenShift Virtualization NAD. Required only when
typeismultus. namespace- Specifies the namespace. If you are using a user-defined network (UDN), its namespace is defined in OpenShift Virtualization.
Create a
StorageMapmanifest to map source and destination storage:$ cat << EOF | oc apply -f - apiVersion: forklift.konveyor.io/v1beta1 kind: StorageMap metadata: name: <storage_map> namespace: <namespace> spec: map: - destination: storageClass: <storage_class> accessMode: <access_mode> source: id: <source_volume_type> provider: source: name: <source_provider> namespace: <namespace> destination: name: <destination_provider> namespace: <namespace> EOFwhere:
<access_mode>-
Specifies the access mode. Allowed values are
ReadWriteOnceandReadWriteMany. <source_volume_type>-
Specifies the OpenStack
volume_typeUUID. For example,f2737930-b567-451a-9ceb-2887f6207009.
Optional: Create a
Hookmanifest to run custom code on a VM during the phase specified in thePlanCR:$ cat << EOF | oc apply -f - apiVersion: forklift.konveyor.io/v1beta1 kind: Hook metadata: name: <hook> namespace: <namespace> spec: image: quay.io/kubev2v/hook-runner serviceAccount:<service account> playbook: | LS0tCi0gbm... EOFwhere:
<service account>-
Specifies the Red Hat OpenShift service account. This is an optional label. Use the
serviceAccountparameter to modify any cluster resources. playbookSpecifies the Base64-encoded Ansible Playbook. If you specify a playbook, the
imagemust include anansible-runner.NoteYou can use the default
hook-runnerimage or specify a custom image. If you specify a custom image, you do not have to specify a playbook.
Enter the following command to create the network attachment definition (NAD) of the transfer network used for MTV migrations.
You use this definition to configure an IP address for the interface, either from the Dynamic Host Configuration Protocol (DHCP) or statically.
Configuring the IP address enables the interface to reach the configured gateway.
$ oc edit NetworkAttachmentDefinitions <name_of_the_NAD_to_edit> apiVersion: k8s.cni.cncf.io/v1 kind: NetworkAttachmentDefinition metadata: name: <name_of_transfer_network> namespace: <namespace> annotations: forklift.konveyor.io/route: <IP_address>Create a
Planmanifest for the migration:$ cat << EOF | oc apply -f - apiVersion: forklift.konveyor.io/v1beta1 kind: Plan metadata: name: <plan> namespace: <namespace> spec: provider: source: name: <source_provider> namespace: <namespace> destination: name: <destination_provider> namespace: <namespace> map: network: name: <network_map> namespace: <namespace> storage: name: <storage_map> namespace: <namespace> targetNamespace: <target_namespace> vms: - id: <source_vm1> - name: <source_vm2> hooks: - hook: namespace: <namespace> name: <hook> step: <step> EOFwhere:
<plan>-
Specifies the name of the
PlanCR. map- Specifies only one network map and one storage map per plan.
network- Specifies a network mapping, even if the VMs to be migrated are not assigned to a network. The mapping can be empty in this case.
<network_map>-
Specifies the name of the
NetworkMapCR. storage- Specifies a storage mapping, even if the VMs to be migrated are not assigned with disk images. The mapping can be empty in this case.
<storage_map>-
Specifies the name of the
StorageMapCR. vms-
Specifies the source VMs. Accepts either the
idor thenameparameter to specify the source VMs. If you are using a UDN, verify that the IP address of the provider is outside the subnet of the UDN. If the IP address is within the subnet of the UDN, the migration fails. <source_vm1>- Specifies the OpenStack VM UUID.
hooks- Specifies up to two hooks for a VM. Each hook must run during a separate migration step. This is an optional label.
<hook>-
Specifies the name of the
HookCR. <step>-
Specifies the type of hook. Allowed values are
PreHook, before the migration plan starts, orPostHook, after the migration is complete.
Create a
Migrationmanifest to run thePlanCR:$ cat << EOF | oc apply -f - apiVersion: forklift.konveyor.io/v1beta1 kind: Migration metadata: name: <name_of_migration_cr> namespace: <namespace> spec: plan: name: <name_of_plan_cr> namespace: <namespace> cutover: <optional_cutover_time> EOFNoteIf you specify a cutover time, use the ISO 8601 format with the UTC time offset, for example,
2024-04-04T01:23:45.678+09:00.
4.3.1. Canceling a migration from the command-line interface Copy linkLink copied to clipboard!
You can use the command-line interface (CLI) to cancel either an entire migration or the migration of specific virtual machines (VMs) while a migration is in progress.
4.3.1.1. Canceling an entire migration from the command-line interface Copy linkLink copied to clipboard!
You can use the command-line interface (CLI) to cancel an entire migration while a migration is in progress.
Procedure
Delete the
MigrationCR:$ oc delete migration <migration> -n <namespace>where:
<migration>-
Specifies the name of the
MigrationCR.
4.3.1.2. Canceling the migration of specific VMs from the command-line interface Copy linkLink copied to clipboard!
You can use the command-line interface (CLI) to cancel the migration of specific virtual machines (VMs) while a migration is in progress.
Procedure
Add the specific VMs to the
spec.cancelblock of theMigrationmanifest, following this example:$ cat << EOF | oc apply -f - apiVersion: forklift.konveyor.io/v1beta1 kind: Migration metadata: name: <migration> namespace: <namespace> ... spec: cancel: - id: vm-102 - id: vm-203 name: rhel8-vm EOFwhere:
idornameSpecifies a VM by using the
idkey or thenamekey.The value of the
idkey is the managed object reference, for a VMware VM, or the VM UUID, for a Red Hat Virtualization VM.
Retrieve the
Migrationcustom resource (CR) to monitor the progress of the remaining VMs, following this example:$ oc get migration/<migration> -n <namespace> -o yaml