Image Template

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

Template Attributes

The following attributes can be defined in the template:

AttributeKVMValueDescription
NAMEMandatoryAny stringName that the image will get. Every image must have a unique name.
DESCRIPTIONOptionalAny stringHuman readable description of the image for other users.
TYPEOptionalOS, CDROM, DATABLOCK for VM disks; KERNEL, RAMDISK, CONTEXT for File DatastoresType 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)
PERSISTENTOptionalYES, NOPersistence of the image. If omitted, the default value is NO.
PERSISTENT_TYPE





Optional





IMMUTABLE, SHAREABLE





IMMUTABLE - A special persistent image, that will not be modified.


SHAREABLE - Persistent image shareable by multiple VMs. Requires raw image FORMAT and shared datastore. Virtualization driver needs SUPPORT_SHAREABLE = "yes"


This attribute should only be used for special storage configurations.

DEV_PREFIXOptionalAny string e.g sd, hdPrefix for the emulated device this image will be mounted at. For instance, hd, sd, or vd for KVM virtio. If omitted, the default value is the one defined in oned.conf (installation default is hd).
TARGETOptionalAny stringTarget for the emulated device this image will be mounted at. For instance, hdb, sdc. If omitted, it will be assigned automatically.
FORMATOptionalraw or qcow2Format of the image backing file.
FSOptionalFile system name (e.g ext4, xfs, …)Specific file system type. It is used for formatting datablocks and volatile disks.
PATHMandatory (if no SOURCE)Any stringPath 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. Note that gzipped files are supported and OpenNebula will automatically decompress them. Bzip2 compressed files is also supported, but it’s strongly discouraged since OpenNebula will not calculate its size properly.
SOURCE\*Mandatory (if no PATH)Any stringSource to be used in the DISK attribute. Useful for non file-based images.
DISK_TYPEOptionalBLOCK, CDROM or FILE (default).This is the type of the supporting media for the image: a block device (BLOCK) an ISO-9660 file or readonly block device (CDROM) or a plain file (FILE).
READONLYOptionalYES, NOThis attribute should only be used for special storage configurations. It sets how the image is going to be exposed to the hypervisor. Images of type CDROM and those with PERSISTENT_TYPE set to IMMUTABLE will have READONLY set to YES. Otherwise, by default it is set to NO.
MD5OptionalAn MD5 hashMD5 hash to check for image integrity.
SHA1OptionalAn SHA1 hashSHA1 hash to check for image integrity.
LUKS_SECRETOptionalUUID valueThis attribute needs to be set for LUKS-encrypted images. Its value is UUID registered on hypervisor nodes as an identifier for the LUKS secret.
SERIALOptionalauto, any stringIf present, a serial number will be added to virtual hard drive. If set to auto, the serial number will be generated automatically. (<vm_id>-<disk_id>) If set to a specific value, that value will be used as the serial number.

Mandatory attributes for DATABLOCK images with no PATH set:

AttributeValueDescription
SIZEAn integerSize in MB.

Template Examples

Example of an OS image:

NAME          = "Ubuntu Web Development"
PATH          = /home/one_user/images/ubuntu_desktop.img
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"
TYPE          = DATABLOCK
# No PATH set, this image will start as a new empty disk
SIZE          = 3.08
DESCRIPTION   = "Storage for my Thesis experiments."

Restricted Attributes

All the default restricted attributes to users in the oneadmin group are summarized in the following list:

  • SOURCE

These attributes can be configured in oned.conf.