Bookmark this page

Lab: Migrating Virtual Machines Between Hosts

Performance Checklist

In this lab, you will configure a virtual machine to migrate to another host in the cluster when certain conditions are met.

Outcomes

You should be able to configure a scheduling policy that automatically migrates virtual machines when certain conditions are met.

This exercise uses the development data center, which contains the clusterone cluster, and the hostb and hostd hosts. This exercise also uses the rhel-vm1, rhel-vm2, and rhel-vm3 virtual machines, running on either the hostb or the hostd host.

Log in as the student user on workstation and run the lab migration-review start command. This command ensures that the hosts, clusters, data centers, and networks of the Red Hat Virtualization environment are configured appropriately.

[student@workstation ~]$ lab migration-review start
  1. Clone the rhel-vm1 virtual machine, and create a new virtual machine named rhel-vm3. Run rhel-vm1 and rhel-vm3 in the same host as rhel-vm2. All the virtual machines are located in the development data center.

    1. Using the https://rhvm.lab.example.com URL log in to the Administration Portal of the Red Hat Virtualization (RHV) Manager as admin in the internal profile. Use redhat as the password.

    2. From the menu bar, click Compute, and then select Virtual Machines.

    3. Confirm that the value of the Status field of the rhel-vm1 virtual machine is Down.

      If its status is Up, right-click the row for the rhel-vm1 virtual machine, and then select Power Off to stop the rhel-vm1 virtual machine. A window titled Power Off Virtual Machine(s) displays. Click OK to stop the rhel-vm1 virtual machine. Wait until the value of the Status field of the rhel-vm1 virtual machine transitions to Down.

    4. On the Compute >> Virtual Machines page, select the rhel-vm1 virtual machine. Click on the three vertical dots next to the Create Snapshot button. From the menu that displays, click Clone VM. The Clone Virtual Machine window displays.

    5. Enter rhel-vm3 in the Clone Name field as the name for the new virtual machine. Click OK to confirm your intention of cloning the rhel-vm1 virtual machine as rhel-vm3.

      It may take up to a couple of minutes to clone the rhel-vm1 virtual machine and create the rhel-vm3 virtual machine.

    6. From the menu bar, click Events. Wait until the VM rhel-vm3 creation has been completed log message displays. This message displays when the cloning operation is finished.

    7. From the menu bar, click Compute, and then select Virtual Machines. View the value of the Host field for the rhel-vm2 virtual machine to determine the RHV Host containing the virtual machine. If rhel-vm2 is not running, start it.

    8. On the Compute >> Virtual Machines page, select the rhel-vm1 virtual machine, and then click the drop-down menu next to the Run button. From the menu that displays, click Run Once.

      The Run Virtual Machine(s) window displays. Click the + sign to expand the Host section. Select the Specific Host(s) radio button. From the menu, select the host on which rhel-vm2 is running. Click OK to start the rhel-vm1 virtual machine.

      Apply these instructions for both rhel-vm1 and rhel-vm3.

    9. Verify that the value of the Status field of both rhel-vm1 and rhel-vm3 is Up. It may take up to a couple of minutes for them to boot.

    10. Verify that the value of the Host field is the same for rhel-vm1, rhel-vm2, and rhel-vm3.

  2. Modify the scheduling policy for the clusterone cluster to migrate virtual machines to other hosts in the cluster when more than two virtual machines are running on a host. Configure this scheduling policy to avoid slot reservation on the Storage Pool Manager (SPM) host, and configure a migration threshold of 2.

    1. From the menu bar, click Compute, and then select Clusters.

    2. Right-click the row for the clusterone cluster, and then select Edit. The Edit Cluster window displays.

    3. In the Scheduling Policy section, click the drop-down menu for Select Policy. From the menu that displays, select vm_evenly_distributed.

    4. In the Properties section, modify the HighVmCount property value to 2, the SpmVmGrace property value to 0, and the MigrationThreshold property value to 2. Leave the other properties and configuration parameters with the default values. Click OK to update the scheduling policy for the clusterone cluster.

  3. Verify that one of the three virtual machines running on the same host has migrated to the other available host in the clusterone cluster. It may take up to a minute for this migration to be triggered.

    1. From the menu bar, click Compute, and then select Virtual Machines.

    2. Verify that the RHV Manager migrates either rhel-vm1, rhel-vm2, or rhel-vm3 to the other available host in the clusterone cluster. It may take up to a minute for the migration to complete.

    3. After the virtual machine is migrated to the other available host in the clusterone cluster, click Events in the menu bar.

    4. Verify that the message associated with the virtual machine migration includes the string Migration initiated by system (...).

Evaluation

On workstation, run the lab migration-review grade command to confirm success of this exercise.

[student@workstation ~]$ lab migration-review grade

Finish

On workstation, run the lab migration-review finish script to complete this lab.

[student@workstation ~]$ lab migration-review finish

This concludes the lab.

Revision: rh318-4.3-c05018e