Contents
Overview
Green Cloud Scheduler (GCS) consolidates the virtual machines in the cloud such that as few servers as possible are used to run the current workload while the unused servers are shut down. The controller dynamically monitors, analyzes the current cloud context and plans actions to turn on servers as needed, turn off the unused servers, deploy and migrate virtual machines targeting to free up servers.Behavior
GCS behavior is described in the following four steps.- Reads servers's characteristics by using the Java OCA API HostPool class.
- Reads the OpenNebula managed virtual machines by using the Java OCA API VirtualMachinePool class.
- Updates the energy-aware cloud context model.
- Whenever a new VM is submitted to OpenNebula or an existing VM is deleted (see Figure 1), an OpenNebula Hook event is triggered. GCS will react to the event and will start analyzing the cloud context for finding the optimum virtual machine distribution.
- In the Monitoring phase the GCS context is updated with new cloud information.
- In the Analysis phase, GCS analyzes the context and evaluates the cloud greenness level and decides if new actions are necessary for improving the cloud's energy efficiency.
- In the Planning phase the GCS uses a learning algorithm for generating an adaptation plan consisting of deploying/migrating virtual machines and turning on/off servers actions.
- In the Execution phase, GCS uses the following tools to enforce the adaptation plan defined in the planning phase:
- OpenNebula Java OCA API for deployment and migration of virtual machines
- wakeonlan for turning ON servers
- ssh for turning off servers: ssh hostname sudo /sbin/shutdown –h now
Interaction with OpenNebula
Cloud Monitoring
The GCS uses the JAVA OCA API for accessing the OpenNebula servers pool and virtual machines pool.
Retrieving Servers Information
For finding most of the information regarding servers the GCS uses the Java OCA API (memory, number of cores,etc.). Specific tools are used for retrieving other server related information.
-
Maximum CPU frequency retrieval
For finding the maximum CPU frequency for a server the cpufreq-utils tool is used, due to the fact that JAVA OCA API reports only the current CPU frequency. If cpufreq-utils is not installed on the OpenNebula nodes, the info from OCA is used instead.
-
MAC address retrieval
To retrieve the MAC addresses for each server defined in OpenNebula servers pool, the GCS reads the data from ./config/arpTable and if the MAC for a server is not defined, GCS pings the server, issues an arp and parses the output. The retrieved MAC address is then stored in the ./config/arpTable for later use.
Retrieving Virtual Machines Information
The GCS uses OpenNebula Java OCA API to interact with OpenNebula for retrieving information about pending virtual machines from the OpenNebula VM Pool
and enforcing adaptation actions like Deploy VM, Migrate VM, Delete VM.
- Virtual Machine Requirements Information
One issue with the VM information is that the CPU field from the VM template contains only the number of CPUs the virtual machine has requested,
while the required CPU frequency is only an optional value in the REQUIREMENTS portion of the VM template (see Figure 2).
Figure 2: VM template example
If the REQUIREMENTS portion contains information about the required CPU frequency, this information is collected for futher use.
If no CPU frequency info is specified in the virtual machine template, the data from the entry VM_DEFAULT_CPU_FREQUENCY in the /config/config.properties is used instead (See Table 1).
- Virtual Machine Creation/Deletion Information
The GCS is notified when virtual machines are created/deleted in/from the
OpenNebula VM Pool by using OpenNebula hooks mechanism. The OpenNebula hooks are
defined in the /etc/one/oned.conf file by entering the lines presented in the Figure 3.
Figure 3: OpenNebula Hooks Configuration
Download the GCS hooks configuration /etc/one/oned.conf excerpt here.
Tools used by GCS
- Wakeonlan
The GCS uses the wakeonlan tool to remotely wake up the data center servers. The following command is used: wakeonlan_tool MAC_Address .
-
Cpufreq-utils
The GCS uses the cpufreq-utils package to retrieve the maximum frequency of the target server .The following command is used: cpufreq-info -l .
-
OpenSSH and Shutdown
The GCS uses the OpenSSH to turn off the data center servers remotely. The following
command is used for turning off servers: ssh hostname sudo /sbin/shutdown –h now.
To enable the remote execution of /sbin/shutdown, on each server the following configuration steps are required:
- Execute : sudo chmod u+s /sbin/shutdown
- Add “oneadmin ALL = NOPASSWD: /sbin/shutdown” in /etc/sudoers to allow oneadmin to use sudo without password on /sbin/shutdown. If the Green Cloud Scheduler is run by an other user, replace oneadmin with the proper username.
Deployment
- Install wakeonlan on the control node
- Optionally (but strongly recommended), install cpufreq-utils on the OpenNebula nodes
- Setup passwordless shutdown for OpenNebula Nodes
- Execute sudo chmod u+s /sbin/shutdown
- Add "oneadmin ALL = NOPASSWD: /sbin/shutdown" in /etc/sudoers to allow oneadmin to execute sudo /sbin/shutdown without password. If you run the OpenNebula client from other user than oneadmin, replace oneadmin with your user in the previous command.
- Edit the /etc/one/oned.conf file to enter the vm creation and deletion hooks. Restart the one deamon.
- Install Ant on the OpenNebula controller node. Enter the java JDK location in the ./build.xml file by changing the jdk.home property. Issue ant in the GreenCloudScheduler directory to compile the software.
- Kill the Default OpenNebula Scheduler process: sudo killall mm_sched
- Run the GreenCloudScheduler.jar from the directory where it is located : java –jar ./GreenCloudScheduler.jar or use ant ant run
For finding the maximum CPU frequency for a server the cpufreq-utils tool is used, due to the fact that JAVA OCA API reports only the current CPU frequency. If cpufreq-utils is not installed on the OpenNebula nodes, the info from OCA is used instead.
To retrieve the MAC addresses for each server defined in OpenNebula servers pool, the GCS reads the data from ./config/arpTable and if the MAC for a server is not defined, GCS pings the server, issues an arp and parses the output. The retrieved MAC address is then stored in the ./config/arpTable for later use.
One issue with the VM information is that the CPU field from the VM template contains only the number of CPUs the virtual machine has requested, while the required CPU frequency is only an optional value in the REQUIREMENTS portion of the VM template (see Figure 2).
The GCS is notified when virtual machines are created/deleted in/from the OpenNebula VM Pool by using OpenNebula hooks mechanism. The OpenNebula hooks are defined in the /etc/one/oned.conf file by entering the lines presented in the Figure 3.
The GCS uses the wakeonlan tool to remotely wake up the data center servers. The following command is used: wakeonlan_tool MAC_Address .
The GCS uses the cpufreq-utils package to retrieve the maximum frequency of the target server .The following command is used: cpufreq-info -l .
The GCS uses the OpenSSH to turn off the data center servers remotely. The following command is used for turning off servers: ssh hostname sudo /sbin/shutdown –h now. To enable the remote execution of /sbin/shutdown, on each server the following configuration steps are required:
- Execute : sudo chmod u+s /sbin/shutdown
- Add “oneadmin ALL = NOPASSWD: /sbin/shutdown” in /etc/sudoers to allow oneadmin to use sudo without password on /sbin/shutdown. If the Green Cloud Scheduler is run by an other user, replace oneadmin with the proper username.
- Execute sudo chmod u+s /sbin/shutdown
- Add "oneadmin ALL = NOPASSWD: /sbin/shutdown" in /etc/sudoers to allow oneadmin to execute sudo /sbin/shutdown without password. If you run the OpenNebula client from other user than oneadmin, replace oneadmin with your user in the previous command.
Configuration options
The next table contains the basic configuration options which need to be addressed when deploying the Green Cloud Scheduler (see Table 1). The configuration options are set from the /config/config.properties file.
Green Cloud Scheduler configuration | Explanation |
---|---|
openNebulaRCPAPIAddress = http://localhost:2633/RPC2 | Address and port of the OpenNebula XML RCP API |
openNebulaCredentials = oneadmin:oneadmin | Username and password for accessing the OpenNebula API |
resourceLoadOptimalValue = 80 | Optimal load for server’s computing resources in percentage % |
resourceLoadVariation = 20 | Accept load variation from the defined optimal load value in % |
pingLocation = /bin/ping | Path to the ping executable |
arpLocation = /usr/sbin/arp | Path to the arp executable |
sshLocation = /usr/sbin/ssh | Path to the arp executable |
nodesWakeUpMechanism = wakeonlan | wol | Path of the wake-up mechanism executable |
vmMigrationMechanism = live | offline | Live or offline virtual machines migration method |
migrationIsEnabled | Disables the VM migration. The scheduler will only consider deployment of VMs and turning on/off servers in this case. |
vmDefaultCPUFrequency | Default CPU frequency for a VM. |