Migrating a Standard Virtual Machine using OpenShift Migration Toolkit for Virtualization

Red Hat

Audience
Public
Technology Integrations
Linux
Source Type
Documentation

This is the baseline workflow for migrating a VM with one or more disks that are not shared with other VMs.

Prerequistes:

  1. If using the CLI for migration: oc and kubectl installed and authenticated (oc whoami confirms active session)

  2. Migration Toolkit for Virtualization (MTV) operator installed in the target OpenShift cluster

  3. XCopy Offload enabled on the MTV controller

  4. Ephemeral image registry configured (required only for VDDK path, skip for XCopy or Vol copy offload)

  5. SCSI Persistent Reservation enabled if migrating Windows Failover Clustering VMs

  6. FORKLIFT_NAMESPACE environment variable set to the target Forklift project namespace

  1. Ensure that xcopy offload is enabled with MTV
    oc patch forkliftcontrollers.forklift.konveyor.io forklift-controller \
      --type merge \
      -p '{"spec": {"feature_copy_offload": "true"}}' \
      -n openshift-mtv
    
  2. Create the Forklift Project (or use an existing project if desired, in the GUI example the openshift-mtv project is used)
    oc new-project migration-project
  3. Define the Source Provider:
    • Using the OCP GUI

      Navigate to Migration for Virtualization -> Providers. Then click on "Create Provider".

      As we will be leveraging xcopy or vol copy offload to the FlashArray, we did not configure the VDDK.

      Provider the provider credentials and then configure the certificate validation or choose to skip.

      Review the provider to ensure that everything looks correct.

    • Using CLI:

      # Create vCenter credentials secret
      oc create secret generic "vcenter-source-creds" \
      --from-literal=user="user_name@vsphere.local" \
      --from-literal=password="super_secret_password" \
      --from-literal=insecureSkipVerify=true \
      -n "migration-project" --dry-run=client -o yaml | oc apply -f -
      # Define the Provider CR
      # Note: vddkInitImage is omitted — not required for XCopy Offload
      cat << EOF | oc apply -f -
      apiVersion: forklift.konveyor.io/v1beta1
      kind: Provider
      metadata:
        name: vcenter-source
        namespace: migration-project
      spec:
        type: vsphere
        url: https://<vcenter-ip-or-fqdn>
        secret:
          name: vcenter-source-creds
          namespace: migration-project
      EOF
      
  4. Define Network and Storage Maps:
    • Using the OCP GUI

      Create the FlashArray Storage Credential Secret

      First you need to retrieve the prefix for the px cluster. In this example a Pod is being used for the destination. From the FlashArray GUI, navigate to Storage => Pods => Select the Pod => Find a volume in the pod.

      Looking at the volume, here is the prefix that will be used in the storage provider credentials to leverage xcopy and vol copy offload.

      Next the secret needs to be created. Navigate to the Workloads => Secrets and then create from yaml

      Use the following YAML with the environment for the FlashArray and vCenter

      apiVersion: v1
      kind: Secret
      metadata:
        name: pure-storage-creds
        namespace: openshift-mtv
      Data:
        GOVMOMI_HOSTNAME: prod-vcsa.alex.purestorage.com
        GOVMOMI_USERNAME: carver@alex.purestorage.com
        GOVMOMI_PASSWORD: super-secret-password
        PURE_CLUSTER_PREFIX: "openshift-03-b24-29-local-pod-01::px_90f5c7e8"
        STORAGE_HOSTNAME: 10.21.147.60
        STORAGE_USERNAME: pureuser
        STORAGE_PASSWORD: super-secret-password
        STORAGE_SKIP_SSL_VERIFICATION: true
      type: Opaque
      
      Here is an example of the secret being created.

      Create the Storage Map

      From Migration for Virtualization => Storage Maps => Create storage map - choose to create with the form.

      The form outlines the required information for creating the storage map. Use the vSphere xcopy offload, the secret that was just created and then select the Pure FlashArray.

      Create the Network Map

      From Migration for Virtualization => Network Maps => Create network map - select to create from form.

      Provide the required information and ensure that the source network maps correct to the network on the subnet for the VM.

    • Using CLI and YAML:

      # FlashArray Secret Storage Map — creates credentials for FlashArray for migration
      oc create secret generic pure-storage-creds \
      --from-literal=STORAGE_HOSTNAME="<redacted-storage-endpoint>" \
      --from-literal=STORAGE_USERNAME="pureuser" \
      --from-literal=STORAGE_PASSWORD="<redacted-password>" \
      --from-literal=GOVMOMI_HOSTNAME="<redacted-hostname>" \
      --from-literal=GOVMOMI_USERNAME="<redacted-username>" \
      --from-literal=GOVMOMI_PASSWORD="<redacted-password>" \
      -from-literal=PURE_CLUSTER_PREFIX="openshift-03-b24-29-local-pod-01::px_90f5c7e8
      --from-literal=STORAGE_SKIP_SSL_VERIFICATION="true" \
      -n "openshift-mtv" --dry-run=client -o yaml | oc apply -f -
      # NetworkMap — maps VMware port group to OpenShift pod network
      apiVersion: forklift.konveyor.io/v1beta1
      kind: NetworkMap
      metadata:
      name: default-network-map
      spec:
      map:
      - destination:
      name: pod
      type: pod
      source:
      id: <vm-network-id> # Retrieve from vCenter API
      name: <vm-network-name>
      provider:
      source:
      name: vcenter-source
      namespace: ${FORKLIFT_NAMESPACE}
      destination:
      name: host
      namespace: openshift-mtv
      # StorageMap — maps VMware datastore to Portworx + FlashArray StorageClass
      # offloadPlugin section enables XCopy Offload
      apiVersion: forklift.konveyor.io/v1beta1
      kind: StorageMap
      metadata:
      name: pure-storage-map
      spec:
      map:
      - destination:
      accessMode: ReadWriteOnce
      storageClass: px-pure-iscsi-sc # or fc StorageClass
      offloadPlugin:
      vsphereXcopyConfig:
      secretRef: pure-storage-creds
      storageVendorProduct: pureFlashArray
      source:
      id: <source-datastore-id>
      name: <source-datastore-name>
      provider:
      source:
      name: vcenter-source
      namespace: ${FORKLIFT_NAMESPACE}
      destination:
      name: host
      namespace: openshift-mtv
      # Apply both maps
      oc apply -f network-map.yaml -n ${FORKLIFT_NAMESPACE}
      oc apply -f storage-map.yaml -n ${FORKLIFT_NAMESPACE}
  5. Define the Migration Plan:
    • Using the OCP GUI

      From Migration for Virtualization => Migration Plans => Create Plan

      Provide the plan name, project, source provider, target provider and target project.

      Provide the network map

      Provide the storage map

      Select Cold Migration - Everpure has done testing with Warm vs Cold and we have validated that warm migration works, but it will require the VDDK to be configured and at the time of this article there was a longer migration time and VM downtime during warm migration vs cold migration with storage offload. At this time the recommended migration type is Cold Migration.

      From the other settings, select the ones that apply for the VM

      Review the plan details

    • Using CLI:

      apiVersion: forklift.konveyor.io/v1beta1
      kind: Plan
      metadata:
      name: standard-vm-plan
      spec:
      pvcNameTemplateUseGenerateName: true
      targetNamespace: ${FORKLIFT_NAMESPACE}
      warm: false
      provider:
      source:
      name: vcenter-source
      namespace: ${FORKLIFT_NAMESPACE}
      destination:
      name: host
      namespace: openshift-mtv
      map:
      network:
      name: default-network-map
      namespace: ${FORKLIFT_NAMESPACE}
      storage:
      name: pure-storage-map
      namespace: ${FORKLIFT_NAMESPACE}
      vms:
      - id: vm-1001 # VMware managed object reference ID
      name: my-test-vm
  6. Execute and Monitor:
    • From the OCP GUI

      To execute the migration select "Start" this can be done from the migration plan main view or from clicking on the migration plan itself.

      Once the migration has started you can monitor the migration process from the Virtual Machines view on the migration plan details.

      Once the migration has completed you can review or debug each of the steps.

    • From the CLI

      # Create Migration CR to start execution
      apiVersion: forklift.konveyor.io/v1beta1
      kind: Migration
      metadata:
      name: standard-vm-migration
      spec:
      plan:
      name: standard-vm-plan
      namespace: ${FORKLIFT_NAMESPACE}
      # Apply the plan
      oc apply -f migration-plan.yaml -n ${FORKLIFT_NAMESPACE}
      # Monitor migration status
      oc get migration standard-vm-migration -n ${FORKLIFT_NAMESPACE} \
      -o jsonpath='{.status.conditions[?(@.type=="Succeeded")].status}'
      Note: For a Windows 10 VM with 100 GB disk (50 GB used): XCopy Offload completes in 4m 07s. VDDK takes 15m 07s. No difference between disk provisioning modes.

Migration of Multi-Disk Virtual Machines

Multi-disk VMs - VMs with more than one attached VMDK - follow the same workflow as standard VMs. Forklift handles multiple disks automatically within a single migration plan. Each disk is mapped independently to the configured StorageClass and migrated using XCopy Offload.

Batch Size VMFS / VDDK VMFS / XCopy vVols / VDDK vVols / Vol Copy
1 VM 10m 36s 4m 56s 11m 10s 4m 44s
20 VMs 32m 23s 11m 35s 1h 08m 50s 7m 21s
100 VMs 2h 19m 51s 53m 05s 5h 24m 40s 45m 30s

Forklift's default maximum concurrent VM migrations is 20.The concurrency limit is tunable, but higher values require validation, especially for VDDK migrations where host CPU and network are the bottleneck. With XCopy Offload, the bottleneck shifts to FlashArray controller resources rather than host resources.

Migration of Large Disk Workloads

XCopy Offload yields the most considerable benefits for substantial disk workloads, especially those encompassing virtual machines (VMs) with disk capacities spanning from several hundred gigabytes up to a terabyte. This advantage is unequivocally demonstrated by the Large-Disk Linux profile (featuring a 500 GB disk and 305 GB utilization), which clearly exhibits the noteworthy performance differential.

Transfer Method Source Datastore Migration Time Network Data Transferred
VDDK VMFS 1h 25m 31s ~305 GB (full used disk content)
XCopy Offload VMFS 5m 10s < 1 MB (metadata only)
VDDK vVols 1h 29m 13s ~305 GB
Vol Copy vVols 3m 57s < 1 MB