OpenNebula Linux VM Contextualization.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
Vlastimil Holer 71ed25b578
Add Alpine 3.8, remove Ubuntu 17.10 into/from tested platforms
7 years ago
pkg gh-106: Post install/upgrade package scrips 7 years ago
src gh-113: Create new users with * in encrypted password 7 years ago
.gitignore Import of the Alpine scripts 7 years ago
LICENSE Move context packages to its own repository 11 years ago
PKGBUILD Restructure, logging, initial systemd support, pre/post network scripts 8 years ago
README.md Add Alpine 3.8, remove Ubuntu 17.10 into/from tested platforms 7 years ago
generate-all.sh Git based revisions for builds without git tags 7 years ago
generate.sh Bump version to 5.6.0 7 years ago
one-context.install Remove Arch from postinstall and added PKGBUILD and one-context.install 9 years ago
targets.sh gh-96: Arch Linux support packaging WIP 7 years ago

README.md

Linux VM Contextualization

These are the source of the contextualization packages used by VM to be configured with the information generated by OpenNebula. This add-on is compatible with OpenNebula >= 4.6.

Get packages

Latest versions can be downloaded from the release page.

Tested platforms

Platform Versions
CentOS 6, 7
Fedora 27, 28
openSUSE 42.3, 15
SUSE Linux Enterprise Server (SLES) 12 SP3
Debian 8, 9
Devuan 1, 2
Ubuntu 14.04, 16.04, 18.04
Alpine Linux 3.6, 3.7, 3.8
Amazon Linux 2

Development

To contribute bug patches or new features, you can use the github Pull Request model. It is assumed that code and documentation are contributed under the Apache License 2.0.

More info:

Repository structure

All code is located under src/ and structure follows the installation directory structure. Files for different environments/targets are picked by the tag, tags are part of the filename separated from the installation name by 2 hashes (##). Tags are dot-separated.

Examples:

  • script - non-tagged file for all targets
  • script##systemd - file tagged with systemd
  • script##systemd.rpm - file tagged with systemd and rpm

Contextualization scripts

Contextualization scripts, which are executed on every boot and during the reconfiguration, are located in src/etc/one-context.d/. Scripts are divided into following 2 parts:

  • local - pre-networking, prefixed with loc-
  • post-networking, prefixed with net-

All other scripts, which are not prefixed with loc- or net-, are executed as a first during the post-networking contextualization stage.

Build own package

Package contains following parts:

  • main control scripts (/usr/sbin/one-context*)
  • contextualization scripts (/etc/one-context.d/*)
  • init scripts to start the contextualization
  • OneGate scripts (/usr/bin/one-gate*)
  • udev rules to trigger reconfiguration on NIC hotplug

Other actions include:

  • delete persistent cd and net rules from /etc/udev/rules.d
  • delete network configuration files

Requirements

  • Ruby >= 1.8.7
  • gem fpm >= 1.8.1
  • dpkg utils for deb package creation
  • rpm utils for rpm package creation

On Ubuntu/Debian you can install the package rpm and you will be able to generate both rpm and deb packages.

Steps

The script generate.sh is able to create both deb and rpm packages and can be configured to include more files in the package or change some of its parameters. Package type and content are configured by the env. variable TARGET, the corresponding target must be defined in target.sh. Target describes the package format, name, dependencies, and files. Files are selected by the tags. Set of required tags is defined for the target (in targets.sh), each file has a list of corresponding tags right in its filename (divided by the regular name by 2 hashes ##, dot-separated).

On start it creates a temporary directory and copies there:

  • All files tagged with no, some (but only from TARGET set) or all tags.
  • Any file or directory from the arguments.

The default parameters to create a package are as follows:

VERSION=1.0.1
RELEASE=1
MAINTAINER="OpenNebula Systems <support@opennebula.systems>"
LICENSE="Apache 2.0"
VENDOR="OpenNebula Systems"
DESCRIPTION="
This package prepares a VM image for OpenNebula:
  * Disables udev net and cd persistent rules
  * Deletes udev net and cd persistent rules
  * Unconfigures the network
  * Adds OpenNebula contextualization scripts to startup

To get support use the OpenNebula mailing list:
  http://OpenNebula.org
"
URL=http://opennebula.org

A target contains following parameters, e.g. el7 target:

NAME=one-context
RELSUFFIX=.el7
TYPE=rpm
TAGS="rpm systemd one"
DEPENDS="util-linux bind-utils cloud-utils-growpart ruby rubygem-json"
REPLACES="cloud-init"
POSTIN=postinstall.one
PREUN=preuninstall.one

You can change any parameter setting an environment variable with the same name. For example, to generate an el7 rpm package with a different package name:

$ TARGET=el7 NAME=my-one-context ./generate.sh

You can also include new files. This is handy to include new scripts executed to contextualize an image. For example, we can have a script that installs a user ssh key. We will create the file hierarchy that will go inside the package in a directory:

$ mkdir -p ssh/etc/one-context.d
$ cp <our-ssh-script> ssh/etc/one-context.d/loc-01-ssh-key
$ TARGET=el7 ./generate.sh ssh/etc

NOTE: The generator must be executed from the same directory it resides.

Authors