Image Definition Template 2.2

This page describes how to define a new image template. An image template follows the same syntax as the VM template.

If you want to learn more about the image repository, you can do so here.

:!: The template described here is the one expected by the oneimage command. If you are a developer and want to submit an image template using our OCA or XML-RPC interface, please take a look at the developers section.

Template Attributes

The following attributes can be defined in the template.

Attribute M / O Value Description
NAME Mandatory Any string Name that the Image will get. Every image must have a unique name.
DESCRIPTION Optional Any string Human readable description of the image for other users.
TYPE Optional OS, CDROM, DATABLOCK Type of the image, explained in detail in the following section. If omitted, the default value is the one defined in oned.conf (install default is OS).
PUBLIC Optional YES, NO Public scope of the image. If omitted, the default value is NO.
PERSISTENT Optional YES, NO Persistence of the image. If omitted, the default value is NO.
DEV_PREFIX Optional Any string Prefix for the emulated device this image will be mounted at. For instance, “hd”, “sd”. If omitted, the default value is the one defined in oned.conf (installation default is “hd”).
BUS Optional IDE, SCSI, virtio (KVM) Type of disk device to emulate.
PATH Mandatory (if no SOURCE) Any string Path to the original file that will be copied to the image repository. If not specified for a DATABLOCK type image, an empty image will be created.
SOURCE Mandatory (if no PATH) Any string Source to be used in the DISK attribute. Useful for not file-based images.

Mandatory attributes for DATABLOCK images with no PATH set:

Attribute Value Description
SIZE An integer Size in MB.
FSTYPE String Type of file system to be built. This can be any value understood by mkfs unix command.

Template Examples

Example of an OS image:

NAME          = "Ubuntu Web Development"
PATH          = /home/one_user/images/ubuntu_desktop.img
PUBLIC        = YES
DESCRIPTION   = "Ubuntu 10.04 desktop for Web Development students.
Contains the pdf lessons and exercises as well as all the necessary
programming tools and testing frameworks."

Example of a CDROM image:

NAME          = "MATLAB install CD"
TYPE          = CDROM
PATH          = /home/one_user/images/matlab.iso
DESCRIPTION   = "Contains the MATLAB installation files. Mount it to install MATLAB on new OS images."

Example of a DATABLOCK image:

NAME          = "Experiment results"
# No PATH set, this image will start as a new empty disk
SIZE          = 2048
FSTYPE        = ext3
PUBLIC        = NO
DESCRIPTION   = "Storage for my Thesis experiments."

Notes for Developers

This section is relevant for developers who want to submit image templates directly to the OpenNebula Core using one of our OCA bindings or XML-RPC interface.

The actual file copy, or creation, is performed by the oneimage command. The core will only request the NAME attribute as mandatory.

When a new image template is allocated, the core will insert the image in the system in DISABLED state. The developer has to request the extended information for the new image, and copy (or create) the file to the SOURCE attribute (added by the core). After the file is copied (or created), the image has to be enabled.