Product SiteDocumentation Site

3. Define Cluster Policy

Until now, you have worked without a specific cluster policy. The virtual machines were started on a host selected on round robin logic — as long as there are available resources on the host, virtual machines can be migrated onto it. Furthermore, there was no load balancing of running virtual machines. For example, a virtual machine will remain on the host it was run initially unless it is specifically moved, either by user triggered migration (maintenance mode or manual virtual machine migration) or by a system high availability event (this will be explained in the advanced High Availability lab). Cluster policy allows you to better control the scheduling of virtual machines and to perform load balancing.
Two types of policies are available:
  • Even Distribution: You can set a maximum service level threshold for the hosts in the cluster. If a host is above the threshold, then the Red Hat Enterprise Virtualization Manager will live migrate virtual machines off this host to other hosts in the cluster, as long as the other hosts' loads are below this threshold. This affects the scheduling of running new machines in a similar manner.
  • Power Saving: This is a superset of the even distribution policy. A low threshold is set for consolidating virtual machines. If a server in the cluster drops below the threshold, then the virtual machines on this server are live migrated to other servers in the cluster, as long as the other servers are not above the maximum service level threshold.
In the following example you will set and test both thresholds.
To configure cluster load and power management policies
  1. Navigate to the Tree pane and click Expand All. Click the Default cluster icon, the Clusters tab displays in the results list. Select the Default cluster to display its details pane.
  2. On the General subtab, you can see that the policy is set to None. Click Edit Policy. The Edit Policy dialog displays.
  3. Use the slider to set the thresholds. In this example, you will select the Power Saving policy, and set the minimum and maximum levels to 30% and 70% respectively.
    Define power saving policy for host cluster
    Figure 28. Define power saving policy for host cluster

  4. You can also set the time (in minutes) that a host should remain under or above the specified thresholds before the policy is applied. This is to prevent a transient load from triggering unnecessary load balancing. Set this according to the desired response time, this example retains the defaults.
  5. Click OK to set the policy for the cluster.
Now you can test these new settings. After the maintenance lab you now have a host (Atlantic) that does not have any virtual machines running. Select one of the Red Hat Enterprise Linux virtual machines and load it, then watch as the hosts in the cluster balance the virtual machines' workloads.
To test cluster policies
  1. Select one of your Red Hat Enterprise Linux virtual machines and click the Console icon.
  2. Load it. This example uses multiple threads of the dd command each copying 1G of data. You can use any other methods to load your virtual machine.
    # dd if=/dev/vda of=tmp bs=32 count 30000000 &
    # dd if=/dev/vda of=tmp1 bs=32 count 30000000 &
    # dd if=/dev/vda of=tmp2 bs=32 count 30000000 &
    # dd if=/dev/vda of=tmp3 bs=32 count 30000000 &
    # dd if=/dev/vda of=tmp4 bs=32 count 30000000 &
    
    Depending on your host resources, you may need to load more than one virtual machine in order to load the host. Alternatively, change the number of cores assigned to the loaded virtual machine so that it is equal to the number of cores available on the host, then increase the number of concurrent threads.
  3. On the administration portal, click Hosts on the Tree pane. On the Hosts tab, you can see the number of virtual machines on each host.
    Hosts balancing virtual machine load
    Figure 29. Hosts balancing virtual machine load

    Wait until the wait time expires while the threshold is exceeded. You will see the unloaded virtual machines migrate to the vacant host trying to reduce the load.
    Virtual machines migrating to vacant host
    Figure 30. Virtual machines migrating to vacant host

  4. After the load reduces wait again, and make sure all the virtual machines are unloaded. You will see that virtual machines consolidate to a single host (as long as there is enough memory resources to accommodate all the virtual machines).