OpenNebula Catalog

:!: Development version of OpenNebula 3.0. The material on this page needs to be reviewed for completeness and accuracy.

Overview

The OpenNebula Catalog is a new tool that will allow us to import disk images from external storage providers. In addition, this tool will adapt the image so it will benefit from the OpenNebula contextualization. In this first version we have included an Amazon S3 driver, therefore you will be able to import your EC2 amis into OpenNebula.

Installation and Configuration

The OpenNebula Catalog is included in the OpenNebula distribution and is installed with it.

There is a configuration file that can be found inside the etc directory in the installation tree (catalog.conf) where we can define the following settings:

  • The directory where the images will be temporarily downloaded
    download_dir: /tmp/one
  • The drivers configuration for external storage providers
    • Name of the provider (ec2dev), this name has to be unique.
    • Credentials of the provider account. This file includes specific information for each provider account.
    • Scripts: folder relative to the scripts path that contains the specific files that will be run for that provider
    catalogs:
      ec2dev:
         credentials: /srv/cloud/one/.ec2devrc
         scripts: ec2
      ec2prod:
         credentials: /srv/cloud/one/.ec2prodrc
         scripts: ec2

This tool will mount the image to make some modifications on it and also will need to run some chroot commands. In order to achieve this task the oneadmin user must be included in the sudoers file. The command that will perform this process is “contextualize”. This file can be found inside the scripts/common directory.

Usage

In order to interact with the external storage providers a command line interface is provided with the distribution.

Adding a new Catalog

You have to add a new section to the catalogs collection inside the catalog.conf file, as explained in the configuration guide. <xterm> $ cat /srv/cloud/one/etc/catalog.conf download_dir: /tmp/one catalogs:

ec2dev:
  credentials: /home/oneadmin/.ec2devrc
  scripts: ec2

</xterm>

Listing the available resources from all the Catalogs

<xterm> $ onize list Catalog Resource Id Location


ec2dev ami-d4e91abd 196331178428/Windows-demo ec2dev ami-40f50b29 centos/centos.manifest.xml ec2dev ami-48ce3121 debian/debian2gbk.manifest.xml ec2dev ami-78ae5111 ubuntu/ubuntu-10.04-amd64-raw.img.manifest.xml ec2prod ami-3053b459 sge-wn/image.manifest.xml ec2prod ami-8a56b1e3 sge-wn/image.manifest.xml ec2prod ami-7f51b716 sgejt-us/sgejt-us.manifest.xml ec2prod ami-d551b7bc sgejt64-us/sgejt64-us.manifest.xml ec2prod ami-23a5444a sgejtus-new/sgejtus-new.manifest.xml ec2prod ami-25a5444c sgejtus64-new/sgejtus64-new.manifest.xml </xterm>

Importing an external resource into OpenNebula

In order to import a disk image in to OpenNebula we have to specify three parameters:

  • Catalog Id
  • Resource Id
  • Template

The Template file contains information for building the OpenNebula Virtual Machine template. In this file we can define the kernel and initrd that will be used to deploy the Virtual Machine. Also we can define specific information for a provider (i.e.: EC2 User Data and SSH public key)

:!: Remember that the path to these file (kernel/initrd) is relative to the host in which the Virtual Machine will be deployed

    KERNEL=/boot/vmlinuz
    INITRD=/boot/initrd

You can also use the following options when running this command:

  • -v, –verbose: The command will display more information about the process
  • -n, –nocontext: Use this option if the Image is already OpenNebula contextualized.

<xterm> $ onize import ec2dev ami-40f50b29 /home/oneadmin/templates/ctemplate Working directory: /tmp/one/ec2dev/1306139035ami-40f50b29/ Downloading ami-40f50b29 from ec2dev Contextualizing /tmp/one/ec2dev/1306139035ami-40f50b29/centos Generating Image template Generating Virtual Machine template New Image created: 12 New Template created: /tmp/one/ec2dev/1306139035ami-40f50b29/template.one </xterm>

After running that a command you will find a new Image in your OpenNebula repository. Also you Virtual Machine template will be generated, you can edit it to fit your requirements (CPU, MEMORY) before creating a new Virtual Machine instance with it (onevm create /tmp/one/ec2dev/1306139035ami-40f50b29/template.one)

Amazon S3 Driver

Requirements

This driver interacts with Amazon S3 using the EC2 AMI Tools. If you don't have it already installed, you can check the following link: http://aws.amazon.com/developertools/368

:!: You can define the EC2_HOME path in the ec2rc file inside the scripts/ec2 directory

Configuration

If you want to access to your Amazon account to import your existing amis stored in S3, you will have to add the following section to the catalog.conf file:

    catalogs:
      ec2prod:
         credentials: /srv/cloud/one/.ec2prodrc
         scripts: ec2

Credentials

The credentials file will contain the following information specific to your Amazon account:

    EC2_PRIVATE_KEY="/home/oneadmin/.ec2/pk-VPLK2YPX000000000000000000000.pem"
    EC2_CERT="/home/oneadmin/cert-VPLK2YPX4PP5P000000000000000000.pem"
    EC2_ACCESS_KEY="18QCQSTQ000000000"
    EC2_SECRET_ACCESS_KEY="d1caydS00000000000000000000000000000"

Template

In addition to the Kernel and Initrd files, you can also define User Data for that Virtual Machine or even the SSH Public Key to access that Instance.

    KERNEL=/boot/vmlinuz
    INITRD=/boot/initrd
    USER_DATA=/srv/cloud/one/ec2/userdata
    PUBLIC_KEY= /srv/cloud/one/.ssh/id_dsa.pub

:!: Unlike the Kernel and Initrd files (relative to the host) the User Data and Publick Key paths are relative to the Front End