Overview

The OpenNebula vCloud Service is a web service that enables you to launch and manage virtual machines in your OpenNebula installation through the vCloud Express API. The vCloud web 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.

The vCloud Express API in which this implementation is based, is the one specified by Terremark [1]. This API consists of a subset of standard vCloud API v0.8 calls that have been customized for a Terremark installation as well as Terremark-specific API calls.

The calls implemented in this prototype are:

  • Inventory Listing
    • GET <org-uri>
    • GET <vDC-uri>
    • GET <vAppTemplate-uri>
    • GET <net-uri>
    • GET <vApp-uri>
  • Catalog Management
    • GET <catalog-uri>
    • GET <catalog-item-uri>
  • Provisioning Operations
    • POST <vDC-uri>/action/instantiateVAppTemplate
  • Resource Entities Operations
    • DELETE <resourceEntity-uri>
  • vApp State Operations
    • POST <vapp-uri>/action/deploy
    • POST <vapp-uri>/action/undeploy
    • POST <vapp-uri>/power/action/powerOn
    • POST <vapp-uri>/power/action/powerOff
    • POST <vapp-uri>/power/action/suspend
    • POST <vapp-uri>/power/action/shutdown
  • Miscellaneous Operations
    • GET <tasks-list-uri>
    • GET <task-uri>
    • GET <vcloud_base_url>/versions
    • POST <api-uri>/login

For proof of concept, you can use Libcloud [2] or Deltacloud [3] switching between OpenNebula or vCloud driver to interact with OpenNebula. In both cases you have to change the host to the one where the OpenNebula vCloud Server is deployed.

Requirements & Installation

You must have an OpenNebula site properly configured and running to install the vCloud service. This guide also assumes that you are familiar with the configuration and use of OpenNebula.

You just need to install the following packages to meet the runtime dependencies:

$ sudo gem install nokogiri
$ sudo gem install builder
$ sudo gem install sinatra
$ sudo gem install thin

To download the latest code you can issue this command:

$ git clone git://opennebula.org/one-vcloud.git

OpenNebula vCloud can be installed in two modes: system-wide, or in self-contained directory. In either case, you do not need to run OpenNebula as root. These options can be specified when running the install script:

$ ./install.sh <install_options>
where <install_options> can be one or more of:
  • -u user that will run OpenNebula, defaults to user executing install.sh
  • -g group of the user that will run OpenNebula, defaults to user executing install.sh
  • -k keep current configuration files, useful when upgrading
  • -d target installation directory. If defined, it will specified the path for the self-contained install. If not defined, the installation will be performed system wide
  • -h prints installer help

Configuration

The service is configured through the $ONE_LOCATION/etc/vcloud-server.conf file, where you can set up the basic operational parameters for the vCloud web 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; the server and port where OCA server will run; and SSL proxy that serves the API
  • vApp Templates, the vApp templates allowed in the cloud and its file.

Example:

# OpenNebula administrator user
USER=oneadmin
PASSWORD=mypass

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

# Host and port where OCA server will run
SERVER=127.0.0.1
PORT=4567

# SSL proxy that serves the API 
SSL_SERVER=cloud.server

VM_TYPE=[NAME=one, TEMPLATE=one.erb]
DATABASE=/srv/cloud/one/var/vcloud.db

# vAppTemplates allowed and its template file (inside templates directory)
VAPP_TEMPLATE=[ID=1, NAME=template1, file=template1.erb]
VAPP_TEMPLATE=[ID=2, NAME=template2, file=template2.erb]
VAPP_TEMPLATE=[ID=3, NAME=template3, file=template3.erb]

Configuring a SSL proxy

For the extra security provided by SSL , a proxy must be set up to handle the SSL connection that forwards the petition to the vCloud Service and takes back the answer to the client.

This set up needs:

  • A server certificate for the SSL connections
  • An HTTP proxy that understands SSL

Defining vApp Templates

In this prototype the vApp Templates are considered as OpenNebula Virtual Machines types, instead of being based on a OVF archive.

You can define as many Virtual Machine types as you want, just:

  • Create a template for the new type and place it in $ONE_LOCATION/etc/vcloud_templates. This template will be completed with the data for each cloud instantiatevAppTemplate request, and then submitted to OpenNebula. You can start by modifying the template1.erb example, to adjust it to your cloud:
    NAME   = <%=erb_vm_info[:name] %>
    
    CPU    = <%= erb_vm_info[:cpu] %>
    MEMORY = <%= erb_vm_info[:memory] %>
    
    OS = [ kernel     = /vmlinuz,
           initrd     = /initrd.img,
           root       = sda1,
           kernel_cmd = "ro xencons=tty console=tty1"]
    
    # --- 2 disks ---
    
    DISK = [
      source   = "/srv/cloud/images/ttylinux/ttylinux.img",
      target   = "sda",
      readonly = "no" ]
    
    DISK = [
      type     = swap,
      size     = 1024,
      target   = "sdb",
      readonly = "no" ]
    
    NIC = [ 
            NETWORK = "<%= erb_vm_info[:network_name] %>",
            NETWORK_ID = <%= erb_vm_info[:network_id] %>]
    
  • Add a VM_TYPE attribute to $ONE_LOCATION/etc/vcloud-server.conf with the ID and NAME for the new type and the TEMPLATE that should be use:
    VAPP_TEMPLATE=[ID=1, NAME=template1, file=template1.erb]
    

The templates are processed by the vCloud server to include specific data for the instance, you should not need to modify the < % = … % > compound.

Starting the Cloud Service

To start the vCloud service just issue the following command

$ $ONE_LOCATION/bin/vcloud-server start

You can find the vcloud server log file in $ONE_LOCATION/var/vcloud-server.log if OpenNebula has been installed in standalone, or in /var/log/one/vcloud-server.log if installed in system-wide.

To stop the vCloud service:

$ $ONE_LOCATION/bin/vcloud-server stop

References

[1] Terremark vCloud Express API
[2] Libcloud
[3] Deltacloud

vCloudDiagram.pdf (103.5 kB) Daniel Molina, 05/27/2010 02:44 pm