User Guide for ONE 1.0

OpenNebula is a VM manager that is executed and configured by a cluster administrator. This cluster administrator would be also the ONE administrator, and therefore he should be the holder of the <oneadmin> account. This guide assumes that the cluster administrator is the only user for oned, although the system has been designed to support several users.

ONE is able to assign, deploy, monitor and control VMs. This guide explains how to describe the wanted-to-be-ran Virtual Machine, and how users typically interact with the system.

Virtual Machine Model

A Virtual Machine within the OpenNebula system consists of:

  • A description file or VM template
  • A set of disk images. In general it could be necessary to transfer some of these image files to/from the execution host. However in this guide we will assume that the disk images are accessible through a shared filesystem.
  • A recovery file, that contains the memory image of a running VM plus some hypervisor specific information.

Each VM in OpenNebula is identified by an unique number, the <VID>. Also, the user can assign it a name in the VM template, the default name for each VM is one-<VID>. This name is used to start the the Xen domains.

Virtual Machine Life-cycle

The life-cycle of a virtual machine within the system includes the following stages (note that this is a simplified version):

  • Pending (pend): By default a VM starts in the pending state, waiting for a resource to run on.
  • Hold (hold): The owner has held the VM and it will not be scheduled until it is released.
  • Prolog (prol): The system is transferring the VM files (disk images and the recovery file). No actual transfers are performed within a shared file-system.
  • Running (runn): The VM is running (note that this stage includes booting and shutting down phases). In this state, the virtualization driver will periodically monitor it.
  • Migrate (migr): The VM is migrating from one resource to another. This can be a life migration or cold migration (the VM is saved and VM files are transferred to the new resource).
  • Epilog (epil): In this phase the system transfers the output disk images.
  • Stopped (stop): The VM is stopped. VM state has been saved and it has been transferred back along with the disk images.
  • Suspended (susp): Same as stopped, but the files are left in the remote resource to later restart the VM there (i.e. there is no need to re-schedule the VM).
  • Failed (fail): The VM failed.
  • Done (done): The VM is done. VMs in this state wont be shown with “onevm list” but are kept in the database for accounting purposes.

Environment

In order to use OpenNebula, you need to set the following variables in your environment (place them in the .bashrc of the <oneadmin> account for commodity):

ONE_LOCATION pointing to <destination_folder>
ONE_XMLRPC http://localhost:2633/RPC2
PATH $ONE_LOCATION/bin:$PATH


Virtual Machine Template

A template file consists of a set of attributes that defines a Virtual Machine. The syntax of the template file is as follows:

  • Anything behind the pound sign (#) is a comment.
  • Strings can be delimited with double quotes (“), if the a double quote is part of the string you can use single quotes (').
  • Single Attributes are in the form:
NAME=VALUE
  • Vector Attributes that contain several values can be defined as follows:
NAME=[NAME1=VALUE1,NAME2=VALUE2...]

ONE templates were designed to be hypervisor-agnostic, but still there are some peculiarities to be taken into account, and mandatory attributes change depending on the target hypervisor. Hypervisor specific information for this attributes can be found in the drivers configuration files, listed in here.

OpenNebula has been designed to be easily extended, so any attribute name can be defined for later use in any ONE module. There are some pre-defined attributes, though:

Name Description
NAME Name that the VM will get, for description purposes. If NAME is not supplied a name generated by one will be in the form of one-vm_id.
CPU Percentage of CPU divided by 100 required for the Virtual Machine. Half a processor is written 0.5.
MEMORY Amount of RAM required for the VM, in Megabytes.
OS Booting information. Possible attributes:
- KERNEL: path to OS kernel
- INITRD: path to initrd image
- KERNEL_CMD: kernel command line arguments
- ROOT: device to be mounted as root
- BOOT: device to boot from
DISK Image file to be used to deploy the Virtual Machine. Disk attributes:
- TYPE: {floppy,disk,cdrom}.
- SOURCE: {path to disk image file,physical device}.
- TARGET: device to map disk.
- BUS:{ide,scsi,virtio,xen}
- READONLY:{yes,no}.
NIC Network interface, attributes:
- MAC. HW address associated with the network interface.
- BRIDGE: Name of the bridge the network device is going to be attached to.
- TARGET: Device name inside the VM to map the network interface onto
- SCRIPT: path to a script to bring up the network interface
INPUT Define input devices.
- TYPE: {mouse,tablet}
- BUS: {usb,ps2,xen}
GRAPHICS Wether the VM should export its graphical display, and how.
- TYPE: {vnc,sdl}
- LSITEN: IP to listen on.
- PORT: port for the VNC server
- PASSWD: password for the VNC server
REQUIREMENTS Boolean expression that rules out provisioning hosts from list of machines suitable to run this VM.
RANK This field sets which attribute will be used to sort the suitable hosts for this VM. Basically, it defines which hosts are more suitable than others.

For example, the following template defines a VM with 512MB of memory and one CPU. The VM has two disks: sda supported by an image file; and sdb (an iso image) that will be used to boot the VM. Only one NIC is defined with a predefined MAC address. In this case, between all the suitable hosts (those that meets CPU and MEMORY requirements, and also CPUSPEED > 1000 requirement), ONE will pick the host with more free CPU.

#---------------------------------------
# VM definition example
#---------------------------------------

NAME = vm-example 

CPU    = 1
MEMORY = 512

# --- kernel & boot device ---

OS = [
  kernel   = "/vmlinuz",
  initrd   = "/initrd.img",
  root     = "sda" ]

# --- 2 disks ---

DISK = [
  source   = "/local/xen/domains/etch/disk.img",
  target   = "sda",
  readonly = "no" ]

DISK = [
  source   = "/local/xen/domains/etch/swap.img",
  target   = "sdb",
  readonly = "no" ]

# --- 1 NIC ---

NIC = [ mac="00:ff:72:17:20:27"]

# --- VNC server ---

GRAPHICS = [ 
  type    = "vnc",              
  listen  = "127.0.0.1",
  port    = "5"]

# Scheduling Attributes for the rank policy

REQUIREMENTS="CPUSPEED > 1000"
RANK= FREECPU

:!: Note that you can add as many DISK and NIC attributes as you need

Requirement Expression Syntax

The syntax of the requirement expressions is defined as:

stmt::= expr';'
expr::= VARIABLE '=' INTEGER
      | VARIABLE '>' INTEGER
      | VARIABLE '<' INTEGER
      | VARIABLE '=' STRING
      | expr '&' expr
      | expr '|' expr
      | '!' expr
      | '(' expr ')'

Each expression is evaluated to 1 (TRUE) or 0 (FALSE). Only those hosts for which the requirement expression is evaluated to TRUE will be considered to run the VM.

Logical operators are as expected ( less '<', greater '>', '&' AND, '|' OR, '!' NOT), '=' means equals with integers. When you use '=' operator with strings, it performs a shell wildcard pattern matching.

:!: Any variable defined by the Information Manager driver can be used in the requirements. Check the configuration guide to find out how to extend the information model

:!: There are some predefined variables that can be used: HOSTNAME, TOTALCPU, TOTALMEMORY, FREEMEMORY, FREECPU, USEDMEMORY, USEDCPU

Examples:

REQUIREMENTS = 'HOSTNAME = "aquila*"' #Only aquila nodes, note the quotes
REQUIREMENTS = FREECPU > 0.6 #Only those resources with more than 60% of free CPU

Rank Expression Syntax

The syntax of the rank expressions is defined as:

stmt::= expr';'
expr::= VARIABLE
      | INTEGER
      | expr '+' expr
      | expr '-' expr
      | expr '*' expr
      | expr '/' expr
      | '-' expr
      | '(' expr ')'

Rank expressions are evaluated using each host information. '+', '-', '*', '/' and '-' are arithmetic operators, so only integer values should be used in rank expressions.

:!: The rank expression is evaluated for each host, those hosts with a higher rank are used first to start the VM. The rank policy must be implemented by the scheduler. Check the configuration guide to configure the scheduler.

:!: Similar to the requirements attribute, any integer attribute defined for the host can be used in the rank attribute

Examples:

RANK = FREECPU # First those resources with a higher Free CPU
RANK = FREECPU * 100 - TEMPERATURE # Consider also the CPU temperature

Command Line Interface

ONE comes with a rich command line interface intended for users and sysadmins fond of consoles. A complete reference can be found here.

Usage Scenarios

OpenNebula can be used to deploy different solutions for on-demand execution of services. We have prepared the following use cases to illustrate its functionality in typical computing scenarios: