Blog Article:

New Contextualization Packages

Javier Fontan

Jun 15, 2015

A new version of OpenNebula context packages is out. Don’t be fooled by its version number. Even if it’s 4.14 is compatible with previous versions. There’s only one feature that needs OpenNebula 4.14 support.

In this release we a couple of contributions:

The other nice feature that you can use is that you can add start scripts without registering a file. To use this feature there are two new variables:

  • START_SCRIPT: the commands to run when the VM starts
    START_SCRIPT_BASE64: the same as START_SCRIPT but in base64
  • When context finds one of these variables it creates a new file that contains its value. Sets the executable bit, changes the directory to the context CD mount point and starts it. As it is executed by the context scripts all the variables in the context section are set in the environment.

The script does not need to be shell script, you can add a shebang and execute python, ruby or even binaries! (not recommended).

Some examples:

START_SCRIPT="yum update; yum install epel-release"
START_SCRIPT="
yum install nginx
systemctl start nginx
systemctl enable nginx
curl --data IP=$NIC[IP, NETWORK=\"public net\"] http://myserver/i_am_alive
"
START_SCRIPT="#!/usr/bin/env ruby

require 'open-uri'

open('http://myserver/configuration') do |s|
  conf = s.read
end
"

The other feature that requires the next version of OpenNebula is a new command to make the usage of OpenNebula gate easier. But we will talk about this in other post.

Go and download the new version while it’s fresh!

https://github.com/OpenNebula/addon-context-linux/releases/tag/v4.14.0

1 Comment

  1. Ranjith Kumar

    I have tried this contextualization method its not working properly

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *