6.12. Exporting and Importing Virtual Machines and Templates

Virtual machines and templates stored in Open Virtual Machine Format (OVF) can be exported from and imported to data centers in the same or different Red Hat Enterprise Virtualization environment.
To export or import virtual machines and templates, an active export domain must be attached to the data center containing the virtual machine or template to be exported or imported. An export domain acts as a temporary storage area containing two directories for each exported virtual machine or template. One directory contains the OVF files for the virtual machine or template. The other directory holds the disk image or images for the virtual machine or template.
There are three stages to exporting and importing virtual machines and templates:
  1. Export the virtual machine or template to an export domain.
  2. Detach the export domain from one data center, and attach it to another. You can attach it to a different data center in the same Red Hat Enterprise Virtualization environment, or attach it to a data center in a separate Red Hat Enterprise Virtualization environment that is managed by another installation of the Red Hat Enterprise Virtualization Manager.

    Note

    An export domain can only be active in one data center at a given time. This means that the export domain must be attached to either the source data center or the destination data center.
  3. Import the virtual machine or template into the data center to which the export domain is attached.
When you export or import a virtual machine or template, properties including basic details such as the name and description, resource allocation, and high availability settings of that virtual machine or template are preserved. Specific user roles and permissions, however, are not preserved during the export process. If certain user roles and permissions are required to access the virtual machine or template, they will need to be set again after the virtual machine or template is imported.
You can also use the V2V feature to import virtual machines from other virtualization providers, such as Xen or VMware, or import Windows virtual machines. V2V converts virtual machines so that they can be hosted by Red Hat Enterprise Virtualization. There are two stages to import virtual machines from a VMware provider:
  1. Add one or more VMware vCenter providers in the Add Provider window. See Adding a VMware Instance as a Virtual Machine Provider for more information.
  2. Install virt-v2v on a Red Hat Enterprise Linux 7.2 host in the destination data center. This package is available in the base rhel-7-server-rpms repository.
  3. Import virtual machines from the VMware provider in the Import Virtual Machine(s) window. See Section 6.12.4, “Importing a Virtual Machine from a VMware Provider” for more information.
For more information on installing and using V2V, see Converting Virtual Machines from Other Hypervisors to KVM with virt-v2v.

6.12.1. Graphical Overview for Exporting and Importing Virtual Machines and Templates

This procedure provides a graphical overview of the steps required to export a virtual machine or template from one data center and import that virtual machine or template into another data center.

Procedure 6.21. Exporting and Importing Virtual Machines and Templates

  1. Attach the export domain to the source data center.
    Attach Export Domain

    Figure 6.6. Attach Export Domain

  2. Export the virtual machine or template to the export domain.
    Export the Virtual Resource

    Figure 6.7. Export the Virtual Resource

  3. Detach the export domain from the source data center.
    Detach Export Domain

    Figure 6.8. Detach Export Domain

  4. Attach the export domain to the destination data center.
    Attach the Export Domain

    Figure 6.9. Attach the Export Domain

  5. Import the virtual machine or template into the destination data center.
    Import the virtual resource

    Figure 6.10. Import the virtual resource

6.12.2. Exporting a Virtual Machine to the Export Domain

Export a virtual machine to the export domain so that it can be imported into a different data center. Before you begin, the export domain must be attached to the data center that contains the virtual machine to be exported. The virtual machine must be stopped.

Procedure 6.22. Exporting a Virtual Machine to the Export Domain

  1. Click the Virtual Machines tab and select a virtual machine.
  2. Click Export.
  3. Optionally select the following check boxes:
    • Force Override: overrides existing images of the virtual machine on the export domain.
    • Collapse Snapshots: creates a single export volume per disk. This option removes snapshot restore points and includes the template in a template-based virtual machine, and removes any dependencies a virtual machine has on a template. For a virtual machine that is dependent on a template, either select this option, export the template with the virtual machine, or make sure the template exists in the destination data center.

      Note

      When you create a virtual machine from a template, two storage allocation options are available under New Virtual MachineResource AllocationStorage Allocation.
      • If Clone was selected, the virtual machine is not dependent on the template. The template does not have to exist in the destination data center.
      • If Thin was selected, the virtual machine is dependent on the template, so the template must exist in the destination data center or be exported with the virtual machine. Alternatively, select the Collapse Snapshots check box to collapse the template disk and virtual machine disk into a single disk.
      To check which option was selected, select a virtual machine and click the General tab in the details pane.
  4. Click OK.
The export of the virtual machine begins. The virtual machine displays in the Virtual Machines results list with an Image Locked status while it is exported. Depending on the size of your virtual machine hard disk images, and your storage hardware, this can take up to an hour. Use the Events tab to view the progress. When complete, the virtual machine has been exported to the export domain and displays on the VM Import tab of the export domain's details pane.

6.12.3. Importing a Virtual Machine into the Destination Data Center

You have a virtual machine on an export domain. Before the virtual machine can be imported to a new data center, the export domain must be attached to the destination data center.

Procedure 6.23. Importing a Virtual Machine into the Destination Data Center

  1. Click the Storage tab, and select the export domain in the results list. The export domain must have a status of Active.
  2. Select the VM Import tab in the details pane to list the available virtual machines to import.
  3. Select one or more virtual machines to import and click Import.
    Import Virtual Machine

    Figure 6.11. Import Virtual Machine

  4. Select the Default Storage Domain and Cluster.
  5. Select the Collapse Snapshots check box to remove snapshot restore points and include templates in template-based virtual machines.
  6. Click the virtual machine to be imported and click on the Disks sub-tab. From this tab, you can use the Allocation Policy and Storage Domain drop-down lists to select whether the disk used by the virtual machine will be thinly provisioned or preallocated, and can also select the storage domain on which the disk will be stored. An icon is also displayed to indicate which of the disks to be imported acts as the boot disk for that virtual machine.
  7. Click OK to import the virtual machines.
    The Import Virtual Machine Conflict window opens if the virtual machine exists in the virtualized environment.
    Import Virtual Machine Conflict Window

    Figure 6.12. Import Virtual Machine Conflict Window

  8. Choose one of the following radio buttons:
    • Don't import
    • Import as cloned and enter a unique name for the virtual machine in the New Name field.
  9. Optionally select the Apply to all check box to import all duplicated virtual machines with the same suffix, and then enter a suffix in the Suffix to add to the cloned VMs field.
  10. Click OK.

Important

During a single import operation, you can only import virtual machines that share the same architecture. If any of the virtual machines to be imported have a different architecture to that of the other virtual machines to be imported, a warning will display and you will be prompted to change your selection so that only virtual machines with the same architecture will be imported.

6.12.4. Importing a Virtual Machine from a VMware Provider

Import virtual machines from a VMware vCenter provider to your Red Hat Enterprise Virtualization environment. You can import from a VMware provider by entering its details in the Import Virtual Machine(s) window during each import operation, or you can add the VMware provider as an external provider, and select the preconfigured provider during import operations. To add an external provider, see Adding a VMware Instance as a Virtual Machine Provider.
Red Hat Enterprise Virtualization uses V2V to convert VMware virtual machines to the correct format before they are imported. You must install the virt-v2v package on a least one Red Hat Enterprise Linux 7.2 host in a data center with version 3.6 compatibility before proceeding. This package is available in the base rhel-7-server-rpms repository.

Warning

When importing a virtual machine from a VMware provider, do not power on the virtual machine through VMware during the import process as this can result in data corruption.

Procedure 6.24. Importing a Virtual Machine from VMware

  1. In the Virtual Machines tab, click Import to open the Import Virtual Machine(s) window.
    The Import Virtual Machine(s) Window

    Figure 6.13. The Import Virtual Machine(s) Window

  2. Select VMware from the Source list.
  3. If you have configured a VMware provider as an external provider, select it from the External Provider list. Verify that the provider credentials are correct. If you did not specify a destination data center or proxy host when configuring the external provider, select those options now.
  4. If you have not configured a VMware provider, or want to import from a new VMware provider, provide the following details:
    1. Select from the list the Data Center in which the virtual machine will be available.
    2. Enter the IP address or fully qualified domain name of the VMware vCenter instance in the vCenter field.
    3. Enter the IP address or fully qualified domain name of the host from which the virtual machines will be imported in the ESXi field.
    4. Enter the name of the data center in which the specified ESXi host resides in the Data Center field.
    5. Optionally, select the Verify Credentials check box to verify the ESXi host's certificate.
    6. Enter the Username and Password for the VMware vCenter instance. The user must have access to the VMware data center and ESXi host on which the virtual machines reside.
    7. Select a host in the chosen data center with virt-v2v installed to serve as the Proxy Host during virtual machine import operations. This host must also be able to connect to the network of the VMware vCenter external provider.
  5. Click Load to generate a list of the virtual machines on the VMware provider.
  6. Select one or more virtual machines from the Virtual Machines on Source list, and use the arrows to move them to the Virtual Machines to Import list.
  7. Click Next.
    The Import Virtual Machine(s) Window

    Figure 6.14. The Import Virtual Machine(s) Window

  8. Select the Cluster in which the virtual machines will reside.
  9. Select a CPU Profile for the virtual machines.
  10. Select the Collapse Snapshots check box to remove snapshot restore points and include templates in template-based virtual machines.
  11. Select the Clone check box to change the virtual machine name and MAC addresses, and clone all disks, removing all snapshots. If a virtual machine appears with a warning symbol beside its name or has a tick in the VM in System column, you must clone the virtual machine and change its name.
  12. Click on each virtual machine to be imported and click on the Disks sub-tab. Use the Allocation Policy and Storage Domain lists to select whether the disk used by the virtual machine will be thinly provisioned or preallocated, and select the storage domain on which the disk will be stored. An icon is also displayed to indicate which of the disks to be imported acts as the boot disk for that virtual machine.

    Note

    The target storage domain must be a filed-based domain. Due to current limitations, specifying a block-based domain causes the V2V operation to fail.
  13. If you selected the Clone check box, change the name of the virtual machine in the General sub-tab.
  14. Click OK to import the virtual machines.

Important

During a single import operation, you can only import virtual machines that share the same architecture. If any of the virtual machines to be imported have a different architecture to that of the other virtual machines to be imported, a warning will display and you will be prompted to change your selection so that only virtual machines with the same architecture will be imported.