Migrating existing virtual machines with Red Hat OpenShift Virtualization
In addition to creating virtual machines (VMs), Red Hat® OpenShift® Virtualization enables users to import existing VMs from other environments. In the following example, we will import machines from a VMware vSphere 8 setup, but you may import from other hypervisors. These migrations can be done cold (all source VMs are shutdown) or warm (incremental copying while VMs are running).
What will you learn?
- How to import a VM from an existing environment
What you need before starting:
- Red Hat account
- OpenShift cluster running with bare metal nodes
- OpenShift Virtualization Operator installed on your node
Importing a virtual machine
The above video is a visual walkthrough of the steps below.
- Navigate to your web console and select Operators in the left hand menu. From the dropdown, click OperatorHub.
- In the new page, search and find the Migration Toolkit for Virtualization Operator operator and install it.
Once installed, there will be a new Migration option in the left hand menu. Select this option and click Overview from the dropdown to see completed migrations for your environment. - Click Providers for virtualization under the Migration dropdown, then click Create Provider in the upper right.
- In the new page that appears, select your provider. For this example scenario, select vSphere.
- Under Provider resource name enter in “vmware”
- Under URL enter in the SDK for the provider. In this example it would be “http://portal.vc.opentlc.com/sdk”
- For VDDK init image, this is if you wish to convert vmware disk images to KubeVirt format. Paste in the path here if so desired. Example: “quay.io/aa-bb-name/demo-path”
- Then for username and password, enter in your credentials for vSphere itself.
- Under SSHA-1 fingerprint, provide the TLS certification for vCenter.
- Once done adding all relevant information, click Create provider in the lower left.
- The page will refresh and show the inventory populated with the virtual machines from vSphere.
Once finished, OpenShift Virtualization will need a migration plan to migrate the machines.
- From the Migration dropdown, click Plans for virtualization.
- Click Create plan.
- The migration plan screen will have several fields to fill out:
- Plan name - vm-import (you may change this however you desire)
- Source provider - vmware
- Target provider - host
- Target namespace - imported-vms
- Proceed to VM Selection and click the SDDC-Datacenter checkbox.
- Under Select VMs click to check the boxes for each VM you wish to migrate.
- Proceed to Network mapping and click Create a network mapping under the selection dropdown.
- Using the default source networks, select the Pod network option under the Target namespaces/networks dropdown.
- Proceed to Storage mapping and click Create a storage mapping under the selection dropdown.
- Each VM will be assigned their own PVC and volume. For Target storage classes, select the (default) option.
Under Type, select the Cold or Warm migration option as needed for your VMs.
- Each VM will be assigned their own PVC and volume. For Target storage classes, select the (default) option.
- Proceed to Hooks and add any as desired for your virtual machines before they are migrated.
- Continue to the Review screen and click Finish.
- The screen will refresh to show the migration plan and ready status. Click Start to begin your migration.
Once the migration is started, the page will refresh to show each VM’s details,including the status and amount of data copied. Each option can be expanded to track the steps for full data copy and migration. This will take several minutes to complete depending on your environment and number of VMs.
After the process is complete, you can view your machines under the VirtualMachines option in the Virtualization menu. From this screen, you may right-click on any machine and click Start to boot them. Clicking on the name of any VM will direct you to its status page where you can access the web console to access the machine.
Now that your machines have been successfully booted, you have completed your virtual machine migration.