Converting VMware virtual machines to import to Red Hat OpenStack Platform with the glance option
This article demonstrates how to use the virt-v2v command-line tool in Red Hat Enterprise Linux 7 or 8 to retrieve an existing VMware vCenter virtual machine (VM), and then convert and upload it directly to the Image Service in Red Hat OpenStack Platform.
Note that virt-v2v is optimal for converting small numbers of VMware VMs. For converting large deployments of VMs, Red Hat recommends using the This content is not included.Migration Toolkit for Virtualization.
For an overview of the virt-v2v tool, supported conversions, and links to other types of VM conversions, see Converting Virtual Machines from Other Hypervisors to KVM with virt-v2v.
Prerequisites
-
virt-v2v must be run on a Red Hat Enterprise Linux 64-bit host system.
-
Administrative credentials and network access to a VMware vCenter hypervisor
-
Ensure that the virtual machine is stopped prior to running the conversion process.
-
Reliable, low-latency network bandwidth of Gigabit speeds or better.
-
Higher amounts of memory on VMware and Red Hat Enterprise Linux hosts alleviate slow copying issues.
-
For multiple parallel conversions, consider allocating one CPU core and at least 1GB memory for each running conversion instance.
Procedure
Step 1
On the Red Hat Enterprise Linux host, install the *virt-v2v* package and its dependencies:
# yum install virt-v2v virtio-win
Step 2
Install the Image Service client binary and tools:
# yum install python3-glanceclient
Step 3
Log in to your Red Hat OpenStack Platform machine.
Step 4
On the OpenStack system, ensure TCP port 5000 is open:
# firewall-cmd --permanent --add-port=5000/tcp
# firewall-cmd --reload
Step 5
Normally there is a file called *overcloudrc* or *keystonerc_admin* on OpenStack system that you can copy to the *virt-v2v* server and simply "source" to set everything up. Or check values from the file below:
OS_USERNAME
OS_PASSWORD
OS_AUTH_URL
OS_PROJECT_NAME
OS_USER_DOMAIN_NAME
OS_PROJECT_DOMAIN_NAME
OS_IDENTITY_API_VERSION
Step 6
In the Red Hat Enterprise Linux host, add those variables and their values into the */root/.bashrc* file, substituting your settings. For example:
export OS_USERNAME=admin
export OS_PASSWORD=97ea7049b1e94a65
export OS_AUTH_URL=http://192.0.2.1:5000
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_DOMAIN_NAME=default
export OS_IDENTITY_API_VERSION=3
Step 7
Use the *source* command to apply the environment variables.
# source /root/.bashrc
You are now ready to run the virt-v2v command to retrieve, convert and upload the VM to the Image Service.
Step 8 [Optional]
Connect to your VMware vCenter server and list the available VMs using the following command. Substitute *vcenterhost1.example.com* with the appropriate VMware vCenter host name, and *esxihost1.example.com* with the VMware ESX(i) host name.
# virsh -c 'vpx://vcenter1.example.com/datacentername/esxiclustername/esxihost1.example.com?no_verify=1' list --all
Note: The 'no_verify=1' string is only required if you have invalid/self-signed SSL configured on your VMware host(s).
Select the VM you intend to convert from the displayed list.
Step 9
Use the following command to retrieve, convert and upload it with the following command, substituting your VMware host names and VM name:
# virt-v2v -ic 'vpx://DOMAINNAME%5CUSERNAME@vcenter1.example.com/datacentername/esxihost1.example.com?no_verify=1' "guestvm1" -o glance
In this command, substitute:
- vcenterhost1.example.com with the appropriate VMware vCenter host name
- datecentername with the name of the data center
- esxihost1.example.com with the VMware ESX(i) host name
- guestvm1 with the name of the VM intended for conversion and migration
Note: You can also specify a different VM name to be used after conversion with the '-on different_name' option.
See the virt-v2v manual page for further details and examples.
Step 10
Observe the conversion progress. This process can take a long time. A successful conversion output looks similar to the following:
[ 14.0] Creating an overlay to protect the source from being modified
[ 16.0] Opening the overlay
[ 77.0] Initializing the target -o glance
[ 77.0] Inspecting the overlay
[ 677.0] Checking for sufficient free disk space in the guest
[ 677.0] Estimating space required on target for each disk
[ 677.0] Converting Red Hat Enterprise Linux release 6 (Update 6) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[1139.0] Mapping filesystem data to avoid copying unused and blank areas
[1158.0] Closing the overlay
[1158.0] Copying disk 1/1 to /var/tmp/glance.9jLwLB/sda (raw)
(0.00/100%)
(1.03/100%)
(2.05/100%)
(3.08/100%)
[...output truncated...]
(100.00/100%)
[49643.0] Creating output metadata
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 675bab2875fc027f33b2f881afa86272 |
| container_format | bare |
| created_at | 2014-11-08T13:29:24 |
| deleted | False |
| deleted_at | None |
| disk_format | raw |
| id | 98b0f3c4-86a0-4daa-baef-878cb7610cb4 |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | guestvm1 |
| owner | b33d23bd5ab94a1fa35522e0c0677381 |
| protected | False |
| size | 8589934592 |
| status | active |
| updated_at | 2014-11-08T13:33:24 |
| virtual_size | None |
+------------------+--------------------------------------+
+----------------------------+--------------------------------------+
| Property | Value |
+----------------------------+--------------------------------------+
| Property 'architecture' | x86_64 |
| Property 'hw_disk_bus' | virtio |
| Property 'hw_vif_model' | virtio |
| Property 'hypervisor_type' | kvm |
| Property 'os_distro' | rhel |
| Property 'os_type' | linux |
| Property 'os_version' | 6.6 |
| Property 'vm_mode' | hvm |
| checksum | 675bab2875fc027f33b2f881afa86272 |
| container_format | bare |
| created_at | 2014-11-08T13:29:24 |
| deleted | False |
| deleted_at | None |
| disk_format | raw |
| id | 98b0f3c4-86a0-4daa-baef-878cb7610cb4 |
| is_public | False |
| min_disk | 0 |
| min_ram | 512 |
| name | guestvm1 |
| owner | b33d23bd5ab94a1fa35522e0c0677381 |
| protected | False |
| size | 8589934592 |
| status | active |
| updated_at | 2014-11-08T13:33:26 |
| virtual_size | None |
+----------------------------+--------------------------------------+
[9886.0] Finishing off
Step 11
Log in to your OpenStack Dashboard and confirm that the image has been uploaded in *Project* > *Compute* > *Images*.
If the VM's name appears in the list of images, the VM has been successfully converted, and the image can now be used to launch instances.
For information on managing the VM image further, see Manage Images in the Instances and Images Guide
Further Resources
For more information on using virt-v2v to convert virtual machines, you can see the following articles:
- Converting a VMware vCenter Linux virtual machine to KVM
- Converting a VMware vCenter Windows virtual machine to KVM
- Exporting a virtual machine from VMware as an OVA file and importing it into KVM
- Converting a Xen Linux virtual machine to KVM
In addition, you can refer to the virt-v2v man page and Content from libguestfs.org is not included.the virt-v2v upstream documentation.