OCCI Service Configuration Guide 1.4

Overview

The OpenNebula OCCI is a web service that enables you to launch and manage virtual machines in your OpenNebula installation using the latest draft of the OGF OCCI API specification. The OpenNebula OCCI service is implemented upon the new OpenNebula Cloud API (OCA) layer that exposes the full capabilities of an OpenNebula private cloud; and Sinatra, a widely used light web framework.

TODO update image

The current implementation includes all the resource referenced in the latest draft of the OGF OCCI API specification, namely:

  • Compute: launching, retrieve, update and deletion
  • Network: creation, retrieve and deletion
  • Storage: upload, retrieve and deletion

The following sections explain how to install and configure the OCCI service on top of a running OpenNebula cloud.

:!: The OpenNebula OCCI service provides an OCCI interface to your cloud instance, that can be used alongside the native OpenNebula CLI, the libvirt interface or even the EC2 Query API

:!: The OpenNebula distribution includes the tools needed to use the OpenNebula OCCI service

Requirements & Installation

You must have an OpenNebula site properly configured and running to install the OpenNebula OCCI service, be sure to check the OpenNebula Installation and Configuration Guides to set up your private cloud first. This guide also assumes that you are familiar with the configuration and use of OpenNebula.

The OpenNebula OCCI service was installed during the OpenNebula installation, so you just need to install the following packages to meet the runtime dependencies:

  • The Sinatra web framework and the thin web server:

<xterm>$ sudo gem install thin $ sudo gem install sinatra $ sudo gem install crack</xterm>

  • The libraries for the Storage Repository and Client Tools:

<xterm>$ sudo gem install uuid $ sudo gem install sequel $ sudo gem install curb $ apt-get install ruby-sqlite3</xterm>

Configuration

The service is configured through the $ONE_LOCATION/etc/occi-server.conf file, where you can set up the basic operational parameters for the OCCI service, namely:

  • Administration Account, the web server need to perform some operation using the oneadmin account, mainly to check the identity of the cloud users. You have to specify the USER and PASSWORD of oneadmin.
  • Connection Parameters, the xml-rpc service of the oned daemon; and the server and port for the OpenNebula OCCI service web server. This will be the URL of your cloud.
  • Storage Repository, the storage repository provides an easy-to-use repository to store Compute images. You need to specify the DATABASE and IMAGE_DIR for this service.
  • Computes, the name of the bridge that the VM needs to connect to in the physical host to get network conneciton. See the http://opennebula.org/doku.php?id=documentation:rel1.4:vgg for more details.
  • Filesystem format, the default format in which the empty filesystems (needed for certain Computes) will be formatted in. In case of ommission, by default is ext3.
  • Compute Types, a VM_TYPE defines the name and the OpenNebula templates for each type of Compute, to enable different sizes of Computes.

The following table summarizes the available options:

VARIABLE VALUE
USER name for the oneadmin account
PASSWORD oneadmin password
ONE_XMLRPC oned xmlrpc service, http://localhost:2633/RPC2
SERVER FQDN for your cloud
PORT for incoming connections
DATABASE for the Storage repository
IMAGE_DIR to store cloud images
BRIDGE Name of the bridge needed to create Networks
FS_FORMAT to store cloud images
VM_TYPE The Computes types for your cloud

:!: The SERVER must be a FQDN, do not use IP's here

:!: IMAGE_DIR must be an existing directory

:!: Preserve bash syntax in the occi-server.conf file

Example:

# OpenNebula administrator user
USER=oneadmin
PASSWORD=mypass

# OpenNebula sever contact information
ONE_XMLRPC=http://localhost:2633/RPC2

# Host and port where OCCI service will run
SERVER=cloud.opennebula.org
PORT=4567

# Configuration for the image repository
DATABASE=/srv/cloud/one/var/occi.db
IMAGE_DIR=/srv/cloud/images/

# Configuration for OpenNebula's Virtual Networks
BRIDGE=eth0

# Default format for FS
FS_FORMAT=ext3

# VM types allowed and its template file (inside templates directory)
VM_TYPE=[NAME=small,  TEMPLATE=small.erb]
VM_TYPE=[NAME=medium, TEMPLATE=medium.erb]
VM_TYPE=[NAME=large,  TEMPLATE=large.erb]

Defining Compute types

You can define as many Compute types as you want, just:

  • Create a template for the new type and place it in $ONE_LOCATION/etc/occi_templates. This template will be completed with the data for each cloud occi-vm create request, and then submitted to OpenNebula. You can start by modifying the small.erb example, to adjust it to your cloud:
NAME   = <%= @vm_info['NAME']%>

CPU    = 1
MEMORY = 1024

OS = [ kernel     = /vmlinuz,
       initrd     = /initrd.img,
       root       = sda1,
       kernel_cmd = "ro xencons=tty console=tty1"]
<% @vm_info['STORAGE'].each do |key, image| 
   
case key
    
    when "SWAP" 
%>
DISK = [ type = "swap", 
         size=<%= image['size']%>, 
         dev=<%= image['dev']%> ]
<% 
    when "DISK"  
%>
DISK = [ type = "disk", 
         dev=<%= image['dev']%>, 
         source=<%= image['source']%>, 
         image_id=<%= image['image']%> ]
<% 
    when "FS"  
%>
DISK = [ type = "fs", 
         dev=<%= image['dev']%>, 
         size=<%= image['size']%>,
         format=<%= CONFIG[:fs_format]||"ext3"%>  ]   
<% end %>
<% end %>
<% @vm_info['NETWORK']['NIC'].each do |nic| %>
NIC = [ 
<% if nic['ip'] %>
        IP=<%= nic['ip'] %>,
<% end %>
        NETWORK=<%= nic['network']%>, 
        NETWORK_ID=<%= nic['network_id'] %>      
]
<% end %>
OCCI_SIZE_TYPE = <%= @vm_info[:instance_type ]%>

:!: The templates are processed by the OCCI service to include specific data for the instance, you should not need to modify the <%= … %> compounds. Start by adjusting the OS, CPU and MEMORY to your needs

Starting the Cloud Service

To start the OCCI service just issue the following command <xterm> $ $ONE_LOCATION/bin/occi-server </xterm> You can find the econe server log file in $ONE_LOCATION/var/occi-server.log.

Cloud Users

The cloud users have to be created in the OpenNebula system by oneadmin using the oneuser utility. Once a user is registered in the system, using the same procedure as to create private cloud users, they can start using the system. The users will authenticate using the HTTP basic authentication with user-ID their OpenNebula's username and password their OpenNebula's password.