LVM 3.0

The LVM TM driver is an alternative to tm_shared and tm_ssh driver. It features instantaneous image deployment through LVM snapshots.

inlinetoc

Requirements

LVM must be available in the Hosts. The oneadmin user should be able to execute several LVM related commands with sudo passwordlessly.

The oneadmin Unix account must be able to ssh passwordlessly between the front-end and the hosts, and also from the hosts to the front-end,

The easiest way to have this kind of configuration is the one explained in the installation guide, to copy the ~/.ssh directory to all the machines.

Considerations & Limitations

The idea behind this TM driver is not to provide a full-blown LVM solution, but a basic example which can be tailored to fit a more specific scenario.

This driver assumes that all clonable images (block devices) already exist in all the Hosts. See the Usage section for more information.

Persistent Images & Save Images

Saving disk images is supported by dumping the device to a file and scp'ing the disk image back to the frontend.

Save Images

The 'onevm saveas' functionality works as expected, see the considerations above.

Stop, Migrate & Resume

This driver does not support these operations since the depend strongly on each particular environment.

Configuration

External Component Configuration

  • Enable passwordless sudo for the oneadmin user for the following commands: lvremove, lvcreate, lvs and dd.
  • Create an LVM volume group and populate it with block devices (LVs) that will be cloned.

OpenNebula Configuration

Activating the driver

The LVM TM driver is named “tm_lvm”. It is not enabled by default, and has to be uncommented in oned.conf. After that, OpenNebula has to be restarted.

TM_MAD = [
    name       = "tm_lvm",
    executable = "one_tm",
    arguments  = "tm_lvm/tm_lvm.conf" ]

Configuring the driver

Before using this driver the administrator must set the proper VG_NAME that will hold all the source LVM block devices that will be cloned by the Virtual Machines.

VG_NAME=<The LVM Volume Group>

Usage

When deploying a new Virtual Machine, this driver will create a new snapshot if the PATH parameter of the DISK section is set to a block device (/dev/*). Consider the scenario where the DISK section is:

DISK = [ PATH="/dev/vg-one/ubuntu-10.04", ...]

The following command will run in the OpenNebula Host. <xterm> $ lvcreate -L20G -n lv-one-<vm_id>-<disk_id> /dev/vg-one/ubuntu-10.04 </xterm> This commands creates a new block device lv-<one-vm_id>-<disk_id> as a 20G snapshot of /dev/vg-one/ubuntu-10.04. For this command to work /dev/vg-one/ubuntu-10.04 MUST exist in the OpenNebula Host. In other words, this driver requires that every LVM block device that will be cloned should exist in all the OpenNebula Hosts. This must be achieved outside of OpenNebula, either by a custom script that syncs all the LVM block devices, or by specific tools such as CLVM.

Tuning & Extending

Depending on your scenario you might want to reimplement specific TM actions to enable features like stopping, resuming and migrating:

  • /usr/lib/one/tm_commands/lvm/tm_mkimage.sh
  • /usr/lib/one/tm_commands/lvm/tm_ln.sh
  • /usr/lib/one/tm_commands/lvm/tm_context.sh
  • /usr/lib/one/tm_commands/lvm/tm_delete.sh
  • /usr/lib/one/tm_commands/lvm/tm_clone.sh
  • /usr/lib/one/tm_commands/lvm/tm_mkswap.sh
  • /usr/lib/one/tm_commands/lvm/tm_mv.sh