Bookmark this page

Guided Exercise: Importing and Exporting Virtual Machine Images

In this exercise, you will export and import a virtual machine.

Outcome

You should be able to export and import a virtual machine using an Export Domain.

Log in to workstation as the student user with student as the password.

On workstation, run the lab snapimex-virtual start command. This command runs a start script that determines if the Red Hat Virtualization environment is configured and working.

[student@workstation ~]$ lab snapimex-virtual start
  1. Add a new export domain to the development datacenter using the 172.24.0.8:/exports/data2 NFS share as a back-end.

    1. On workstation, open Firefox, and then navigate to https://rhvm.lab.example.com.

      Click Administration Portal. Log into the RHV-M Administration Portal as admin in the internal profile. Use redhat as the password.

    2. In the menu, click Storage, and then click Domains.

    3. Click New Domain to create a new storage domain. In the New Domain window, enter the following configuration settings:

      • Choose development for Data Center.

      • Choose Export for Domain Function.

      • Choose NFS for Storage Type.

      • Use the default value of Host to Use.

      • Enter nfs-move in the Name box.

      • Enter 172.24.0.8:/exports/data2 in the Export Path box.

      Click OK to create the nfs-move storage domain.

    4. Verify that the Cross Data Center Status is Active for the nfs-move storage domain. It may take up to a minute to become active.

  2. Export the rhel-vm3 virtual machine to the nfs-move export domain.

    1. In the menu, click Compute, and then click Virtual Machines.

    2. Verify that the value of the Status field for rhel-vm3 is Down.

    3. Click on the line containing the rhel-vm3 virtual machine.

    4. Click on the three vertical dots next to the Create Snapshot button. A menu displays. In that menu click on Export to Export Domain. The Export Virtual Machine window opens. Ignore the two check boxes and click on OK.

    5. Click on Events in the menu bar. Note the latest entry in Events window. The export process may take some time.

      Vm rhel-vm3 was exported successfully to nfs-move
  3. Detach the nfs-move export domain from the development data center and attach it to the Default data center.

    1. In the menu click on Compute, then click on Data Centers.

    2. In the Storage tab for the development data center, select nfs-move and click Maintenance. The window titled Storage Domain maintenance displays. Click OK to confirm your intention of marking nfs-move for maintenance. Wait for the status of nfs-move to transition to Maintenance. It may take a minute for the status to transition from Active to Maintenance.

    3. In the Compute >> Data Centers >> development page, select nfs-move and click Detach to detach it from the development data center. Click on OK.

    4. From the menu, navigate to ComputeData Centers to access the Compute >> Data Centers page.

    5. In the Compute >> Data Centers page, click on the name of the Default data center.

    6. In the Storage tab for the Default data center, click Attach Export. The window titled Attach Export Domain displays. In the Attach Export Domain window, click the radio button next to nfs-move. Click OK to confirm attaching the export domain. Wait for the activation of nfs-move to be complete. It may take a minute for the status to transition from Locked to Active.

  4. Import the rhel-vm3 virtual machine to the Default data center as a new virtual machine.

    1. In the menu, click Storage, and then click on Domains.

    2. Click on the nfs-move name. Then click on VM Import.

    3. Click on the rhel-vm3 virtual machine. Click on the Import button.

    4. The Import Virtual Machine(s) window displays. Click on OK. Note that next to the name of the virtual machine there is a Warning. Using the mouse, hover over the warning. The following message displays: Invalid name.

    5. Click on the name of the virtual machine. A new window displays. Change the name of the virtual machine to rhel-vm4. Click on OK. The Import Virtual Machine(s) pop-up box opens with a message. Click on Close.

    6. Click on Compute, and then click on Virtual Machines. The rhel-vm4 virtual machine is imported. Once the import is complete, the virtual machine is in a status of Down.

  5. The network configuration of an exported virtual machine must be updated. Add a logical network to rhel-vm4.

    1. In the Compute >> Virtual Machines window click on rhel-vm4. Click on Network Interfaces. Click on Edit. The Edit Network Interface window displays.

    2. In Profile, select ovirtmgmt(ovirtmgmt). Click on OK. Click on Run to start the virtual machine.

    3. In the Compute >> Virtual Machines window verify that the value of the Status field for the rhel-vm4 virtual machine is Up. It may take up to a minute for the rhel-vm4 virtual machine to start.

    4. To confirm that rhel-vm4 has an IP address. Click on console. Log in to the virtual machine using root as the username and redhat as the password. Run the ip a command to confirm the IP address of eth0.

      rhel-test login: root
      Password: redhat
      [root@rhel-test ~]# ip a
      ...output omitted...
        inet 172.25.250.21/24 brd 172.25.250.255 scope global noprefixroute dynamic eth0
      ...output omitted...
  6. Delete the rhel-vm4 virtual machine to cleanup resources.

    1. Click on Compute, and then click on Virtual Machines. Right-click the row for the rhel-vm4 virtual machine, and then select Power Off. The Power Off Virtual Machine(s) window appears. Click OK to power off rhel-vm4.

    2. Verify that the value of the Status field for the rhel-vm4 virtual machine is Down. It may take some time for RHV-M to mark the rhel-vm4 virtual machine as Down.

    3. Right-click the row for the rhel-vm4 virtual machine, and then select Remove. The Remove Virtual Machine(s) window displays. Verify that the Remove Disk(s) checkbox is selected. Click OK to delete rhel-vm4.

    4. Verify that RHV-M removes the rhel-vm4 virtual machine from the virtual machine listing.

Finish

On workstation, run the lab snapimex-virtual finish script to complete this exercise.

[student@workstation ~]$ lab snapimex-virtual finish

This concludes the guided exercise.

Revision: rh318-4.3-c05018e