The VMware Datastore 3.4

Overview

The VMware datastore lets you store VM images to be used with the VMware hypervisor family. The VMware datastore is an specialized version of the Filesystem datastore that deals with the vmdk format. Considerations are also need to be taken into account regarding the system datastore, since compatibility must be ensured between the system datastore and all the registered datastores.

Requirements

OpenNebula Front-end

Most of the datastore operations are performed remotely on the ESX servers, but there are some actions that are performed in the OpenNebula front-end. Most of these operations use standard filesystem commands, with the exception of:

  • qemu-img tool: needed for the creation of datablocks

VMware ESX servers

In order to use the VMware datastore, the ESX servers need to have the SSH access configured for the oneadmin account. There are no other requirements for any of the transfer methods described below.

Configuration

Configuring the System Datastore

There are two possible choices of transfer drivers for the system datastore:

  • shared drivers: this is the value by default on a fresh OpenNebula install for the system datastore . The only configuration needed is to mount the system datastore exported by the front-end on all the ESX nodes. The created ESX datastore needs to mount the system datastore (/var/lib/one/datastores/0), under the name “0”.
  • ssh drivers: the system datastore needs to be updated in OpenNebula (onedatastore update 0) to set the TM_MAD drivers to ssh. The ESX nodes need to mount a local datastore with the name “0”.

If the system datastore wants to be mounted under any other name, this must be changed in /etc/one/vmm_exec/vmm_exec_vmware.conf. More details in the System Datastore Guide.

Configuring VMware Datastores

The first step to create a VMware 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=vmware.

The other important attribute to configure the datastore is the transfer drivers. These drivers determine how the images are accessed in the hosts. The VMware datastore can use shared, ssh and vmware. See below for more details.

Attribute Description
NAME The name of the datastore
DS_MAD The DS type, use vmware for the VMware datastore
TM_MAD Transfer drivers for the datastore: shared, ssh or vmware, see below
DISK_TYPE Type for the VM disks using images from this datastore. Supported values are: block, file
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.
UMASK Default mask for the files created in the datastore. Defaults to 0007

:!: This will prevent users registering important files as VM images and accessing them through their VMs. OpenNebula will automatically add its configuration directories: /var/lib/one, /etc/one and oneadmin's 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”.

For example, the following illustrates the creation of a VMware datastore using the shared transfer drivers. <xterm>

cat ds.conf

NAME = production DS_MAD = vmware TM_MAD = shared

onedatastore create ds.conf

ID: 100

onedatastore list
ID NAME            CLUSTER  IMAGES TYPE   TM    
 0 system          none     0      fs     shared
 1 default         none     3      fs     shared

100 production none 0 vmware shared

</xterm>

You can check more details of the datastore by issuing the onedatastore show command.

Finally, you have to prepare the storage for the datastore and configure the hosts to access it. This depends on the transfer mechanism you have chosen for your datastore.

:!: Note that datastores are not associated to any cluster by default, and they are supposed to be accessible by every single host. If you need to configure datastores for just a subset of the hosts take a look to the Cluster guide.

Using the shared transfer driver

For a general description of how this transfer mechanism works, please refer to the Filesystem Datastore guide.

The datastore should be exported with the appropriate flags so the files created by the VMware hypervisor can be managed by OpenNebula. An example of a configuration line in /etc/exports of the NFS server:

/var/lib/one 192.168.1.0/24(rw,sync,no_subtree_check,root_squash,anonuid=9001,anongid=9001)

where 9001 is the UID and GID of “oneadmin” user in the front-end.

Host Configuration

Each ESX server has to register an NFS datastore using the <datastore_id> as datastore name. For example to make use of the VMware datastore 100, exported by the server san.opennebula.org you should add network filesystem as:

You also have to mount the datastore in the front-end in /var/lib/one/datastores/<datastore_id>.

Using the SSH Transfer Driver

Since the VMware virtualization drivers require passwordless ssh connection from the front-end to the ESX nodes using the oneadmin user (see this for more information), using a SSH Transfer Driver based VMware Datastore.

Using the VMware transfer driver

The vmware driver is a specialization of the shared drivers to work with the VMware vmdk filesystem tools. The same features/restrictions and configuration applies so be sure to read the shared driver section.

The difference with the shared drivers is that the “vmkfstool” command is used, which specializes in VMFS. This comes with a number of advantages, like FS locking, easier VMDK cloning, format management, etc.

Tuning and Extending

Drivers can be easily customized please refer to the specific guide for each datastore driver or to the Storage substystem developer's guide.

However you may find the files you need to modify here:

  • /var/lib/one/remotes/datastore/<DS_DRIVER>
  • /var/lib/one/remotes/tm/<TM_DRIVER>