The LVM Datastore 3.6
The LVM datastore driver provides OpenNebula with the possibility of using LVM volumes instead of plain files to hold the Virtual Images.
It is assumed that the OpenNebula hosts using this datastore will be configured with CLVM, therefore modifying the OpenNebula Volume Group in one host will reflect in the others.
LVM must be available in the Hosts. The oneadmin
user should be able to execute several LVM related commands with sudo passwordlessly.
lvremove
, lvcreate
, lvs
and dd
.
To use LVM drivers, the system datastore will work both with shared
or as ssh
. This sytem datastore will hold only the symbolic links to the block devices, so it will not take much space. See more details on the System Datastore Guide
It will also be used to hold context images and Disks created on the fly, they will be created as regular files.
The first step to create a LVM datastore is to set up a template file for it. In the following table you can see the supported configuration attributes. The datastore type is set by its drivers, in this case be sure to add DS_MAD=lvm
and TM_MAD=lvm
for the transfer mechanism, see below.
Attribute | Description |
---|---|
NAME | The name of the datastore |
DS_MAD | The DS type, use lvm for the LVM datastore |
TM_MAD | Transfer drivers for the datastore, use lvm , see below |
DISK_TYPE | Type for the VM disks using images from this datastore. Supported values are: block , file |
HOST | Any LVM server host (any of them since it assumes they have CLVM). Defaults to localhost |
VG_NAME | The LVM volume group name. Defaults to vg-one |
RESTRICTED_DIRS | Paths that can not be used to register images. A space separated list of paths. |
SAFE_DIRS | If you need to un-block a directory under one of the RESTRICTED_DIRS. A space separated list of paths. |
For example, the following examples illustrates the creation of an LVM datastore using a configuration file. In this case we will use the host host01
as one of our OpenNebula LVM-enabled hosts.
<xterm>
cat ds.conf
NAME = production DS_MAD = lvm TM_MAD = lvm VG_NAME = vg-one HOST = host01
onedatastore create ds.conf
ID: 100
onedatastore listID NAME CLUSTER IMAGES TYPE TM 0 system none 0 fs shared 1 default none 3 fs shared100 production none 0 lvm shared
</xterm>
You can check more details of the datastore by issuing the onedatastore show
command.
The hosts must have LVM2 and have the Volume-Group used in the VG_NAME
attributed of the datastore template. CLVM must also be installed and active accross all the hosts that use this datastore.
It's also required to have password-less sudo permission for: lvremove
, lvcreate
, lvs
and dd
.
The default snapshot size is 512Mb. However this can be changed globally in:
/var/lib/one/remotes/datastore/lvm/lvm.conf
or in a per-vm basis by adding a SIZE attribute inside the disk section of a VM template:
<xterm> … DISK = [ IMAGE_ID = 6, SIZE = 2048 ] … </xterm>
The above code will create a new snapshot of size 2048M.
System administrators and integrators are encouraged to modify these drivers in order to integrate them with their datacenter:
Under /var/lib/one/remotes/
: