Bookmark this page

Importing and Exporting Virtual Machine Images

Objective

After completing this section, you should be able to import and export virtual machine images between data centers in a Red Hat Virtualization environment.

Managing Virtual Machine Images

RHV-M stores virtual machine disk images in data domains. A data domain can be attached to only one data center at a time. However, a single data center can have multiple data domains attached simultaneously.

A disk image is stored in a single data center, but it can be relocated to another. There are multiple relocation methods available, including:

  • Moving a disk image for a virtual machine from one data domain to another data domain.

  • Exporting virtual machines from one data center and importing them into another data center.

  • Importing an existing QCOW2 image from outside RHV into a data domain, and then attaching it to a virtual machine.

The current RHV version can import images directly into data domains, and move data domains from one data center to another. Previous versions of RHV used an export domain to export and import images between data domains. Export domains are being deprecated, but are still available for use when needed.

Importing Virtual Machine Images into RHV

The latest RHV version uses the Administration Portal, or the API, to directly import QCOW2 formatted disk images into a data domain. Disk images can then be attached to existing virtual machines in the data center.

To import images with this method, RHV-M must be configured to provide the Image I/O Proxy. When importing, the Administration Portal, or the API, must be able to validate the request. Your browser must import the RHV-M CA certificate, which must be configured to trust its usage for web sites, and also support the necessary HTML5 APIs. The browsers that support specific RHV versions are found in the Red Hat documentation.

To import a virtual machine image using the Administration Portal, click Storage, and then click on Disks . Select UploadStart.

The Upload Image window displays. In the window, click Choose File, and then select the image to upload from your local system. Specify a size to make the image, an Alias for its name, and the Data Center and Storage Domain to store it in. Click OK to start the import.

The image appears on the list in the Disks tab. A progress bar displays underneath it as it uploads. When RHV-M finishes the image upload, its status changes to OK. Note that it is not yet attached to any virtual machine.

To attach a disk image to an existing virtual machine using the Administration Portal, select Compute in the menu bar, and then click on Virtual Machines tab. Click on the name of the virtual machine to which you want to attach the image. Select the Disks tab for that virtual machine at the bottom of the interface. This lists all disk images attached to the virtual machine.

If the virtual machine has any disks already attached that you want to delete, click Remove. A window opens asking you to confirm the disk removal. If you want the disk deleted from the data domain entirely, select the Remove permanently check box.

To add the imported disk image, click Attach. A window opens, listing all disk images. Select the check box next to the disk image you want to attach. Adjust its Interface to use the desired connection protocol. Finally, if this is the boot disk for the system, select the check box under the circled letters OS (Operating System). Click OK to attach the disk to your virtual machine.

Importing VM Images using Export Domains

An older method to import virtual machine images used export domains to import and export virtual machines in Open Virtualization Format (OVF). Export domains were also used to transfer images from one data domain to another in different data centers.

Note

Export domains have been deprecated in Red Hat Virtualization 4.1, but are currently still available and supported, as they may have practical use cases. For example, the guided exercise following this lecture uses an export domain.

First, an export domain must be created and attached to the data center for the new virtual machine. To create an Export domain, click on the Storage menu, and then click on Domains. Select Export as the domain function.

To upload an image to the Export domain, click on the domain name, and then click on VM Import. A list of all available virtual machines to import displays. Click on the virtual machine to import, and then click on Import.

The Import Virtual Machine(s) window opens. Name the new virtual machine, and then click OK to import it into the data domain and the data center.

Exporting VM Images using Export Domains

When RHV-M exports a virtual machine into an export domain, it puts the OVF Package for the virtual machine in a directory structure in that export domain. This directory structure includes two subdirectories: images and master. The directories which comprise the OVF Package include an "OVF file" which is named with the .ovf file extension. This is a descriptor file that specifies the virtual hardware configuration for the virtual machine. The directories also include virtual disk image files for that virtual machine. An OVA file or package is just a TAR archive of the OVF Package directory structure.

If you can directly access the storage for the export domain, this provides an unsupported way to extract virtual machines from Red Hat Virtualization.

The official way to extract images from Red Hat Virtualization is to use its API, which is beyond the scope of this course. For more information, see the Red Hat Virtualization REST API Guide.

Virtual-2-Virtual Migration

Virtual-2-Virtual migration, or V2V, is a tool to move virtual machines from one data center to another. The virt-v2v tool is included in Red Hat Enterprise Linux 7 and Red Hat Enterprise Linux 8. This tool can convert virtual machines for use with Red Hat Virtualization Platform, as well as Red Hat OpenStack Platform and KVM.

Virtual-2-Virtual migration is discussed in more detail in a later chapter.

Moving VM Disks to a New Data Domain

If a particular data domain is getting full or its usage is high, you may want to move some virtual machine disks to another data domain in the data center. You can also export virtual machines to a new data center by moving them into a new data domain, and then moving the data domain to another data center.

Red Hat Virtualization supports the manual migration of virtual machine disks from one data domain to another.

To move virtual machine disks to a new data domain using the Administration Portal, click on the Storage menu item, then click on Disks. Select the disk(s) associated with the virtual machine and click Move.

The Move Disk(s) window opens. For each disk, select the destination data domain in the Target and the Disk profile fields. Click OK to move the virtual machine disks to the destination data domain. It may take up to a minute for the virtual machine disks to move.

In the Disks window, click on each disk entry. A new window displays providing information about the disk. Click on the Storage tab, and then verify that the destination data domain is listed.

Exporting Virtual Machines to a Different Data Center

RHV-M supports the usage of data domains to move virtual machine images between data centers. A data domain must store the virtual machine images. To export a virtual machine between data centers using a data domain in the Administration Portal, click on Storage, and then click on Domains. Select the row for the data domain. A new window opens with the data domain configuration.

In the new window, go to the Data Center tab, and then click Maintenance to move the data domain into maintenance mode in the source data center. All virtual machines using the data domain should be powered off to move a data domain into maintenance mode.

A Storage Domain maintenance window opens, asking you to confirm that you want to move the data domain into maintenance mode. Click OK. When the value of the Domain status in Data Center field for the source data center displays Maintenance, click Detach to detach the data domain from the source data center.

A window titled Detach Storage opens. Click OK to detach the data domain from the source data center. Once detached, the source data center no longer appears in the Data Center tab for the data domain configuration details section. In the same tab, click Attach.

The Attach to Data Center window opens. Select the radio button for the destination data center. Click OK to attach the data domain to the destination data center.

In the data domain configuration details section, go to the VM Import tab. This tab includes a list of virtual machine images stored in the data domain. Select a virtual machine and click Import.

The Import Virtual Machine(s) window opens. Select the cluster of the destination data center. Click OK to import the virtual machine.

Click Compute in the left navigation pane, and then select Virtual Machines. Verify that the imported virtual machine is listed, and that its status is Down.

References

Further information is available in the "Administrative Tasks" chapter of the Virtual Machine Management Guide for Red Hat Virtualization; at https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/html-single/virtual_machine_management_guide/index#chap-Administrative_Tasks

Further information is available in the "Virtual Disks" chapter of the Administration Guide for Red Hat Virtualization; at https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/html-single/virtual_machine_management_guide/index#sect-Virtual_Disks

Revision: rh318-4.3-c05018e