Image Repository 3.2

The image repository is the on in charge to store and manage registered images. You can get more information on its usage from a user perspective in the Managing Virtual Machine Images guide.

The way the image repository accomplishes these tasks is through a driver that knows how to perform these actions:

All these actions have an script associated that knows how to perform this. By default OpenNebula comes with a driver that execute the associated actions to the repository backend.

inlinetoc

Configuration of the Image Repository

The generic attributes of the image repository are configured in /etc/one/oned.conf:

  • DEFAULT_IMAGE_TYPE: this will be the type of image created if we don't specify this when creating it. Possible values are:
    • OS, Image file holding an operating system
    • CDROM, Image file holding a CDROM
    • DATABLOCK, Image file holding a datablock always created as an empty block
  • DEFAULT_DEVICE_PREFIX: this variable will be used when generating the devices the images will be attached. You can change it to sd if you want to use SCSI devices or xvd to use xen devices.

Example:

DEFAULT_IMAGE_TYPE    = "OS"
DEFAULT_DEVICE_PREFIX = "hd"

The FileSystem (FS) Image Repository

The fs driver is used to handle image repositories based in a standard filesystem. VM images are stored as files that are copied to an special directory in the filesystem hierarchy.

To load this driver check that the following lines are included in your /etc/one/oned.conf file:

IMAGE_MAD = [
    executable = "one_image",
    arguments  = "fs -t 15" ]

fs in the arguments tells the set of scripts to use and -t 15 is the number of threads that can run concurrently (the number of actions at the same time).

:!: Only one image driver can be loaded.

Configuration

The behavior of the fs driver can be tuned through its configuration file /etc/one/image/fs.conf. In particular you can set:

  • IMAGE_REPOSITORY: The Path where the images will be stored. If not defined defaults to /var/lib/one/images or $ONE_LOCATION/var/images
  • RESTRICTED_DIRS: Paths that can not be used to register images. A space separated list of paths. This will prevent users registering important files as VM images and accessing them thourgh their VMs. OpenNebula will automatically add its configuration directories: /var/lib/one, /etc/one and oneadmin's home ($HOME). If users try to register an image from a restricted directory, they will get the following error message: “Not allowed to copy image file”.
  • SAFE_DIRS: If you need to un-block a directory under one of the RESTRICTED_DIRS

:!: The syntax for this file is BASH. $HOME or any other variable refers to oneadmin environment.

Example:

#IMAGE_REPOSITORY_PATH=/var/lib/one/images

RESTRICTED_DIRS="/etc/"

SAFE_DIRS="$HOME/public/"