VMware Driver Guide

:!: To use this functionality you need to install the VMware Driver Addon

The VMware Drivers Addon enables the management of an OpenNebula cloud based on VMware ESX, vCenter and/or VMware Server hypervisors. It uses libvirt to invoke the Virtual Infrastructure SOAP API exposed by the VMware hypervisors, and it entails a much better integration and performance than the java based drivers traditionally found in the OpenNebula distribution.

It features a simple installation process that will leverage the stability, performance and feature set of any existing VMware based OpenNebula cloud.

Prerequisites

In order to install the VMware Drivers Addon, some software dependencies have to be met:

  • libvirt

LibVirt is used to access the VMware hypervisors , so it needs to be installed with ESX support. We recommend version 0.8.3 or higher, which enables interaction with the vCenter VMware product.

To install libvirt with ESX support, download, untar the latest version and execute the following inside the libvirt directory

<xterm>

$ ./configure --with-esx
$ make
$ make install

</xterm>

  • ESX, VMware Server, vCenter

At least one VMware hypervisor needs to be installed. Further configuration for the DATASTORE is needed, and it is explained in the TM part of the Configuration section. A user needs to be created in the hypervisor (Users & Group tab in the VI Client) with the same UID and username as the oneadmin user executing OpenNebula in the front-end. Please remember to give full permissions to this user (Permissions tab).

  • OpenNebula

A working OpenNebula installation is needed. Due to the need of having the $ONE_LOCATION/var exported, the default DB backend is not supported, so OpenNebula should be using MySQL. The only requisite in terms of environment variables is that ONE_LOCATION needs to be pointing to the OpenNebula installation directory.

Installation

Download the addon, untar and execute install.sh as the oneadmin user.

If the installer succeeds, it will print the needed sections that must be included in the $ONE_LOCATION/etc/oned.conf file to use the VMware Drivers Addon. After this is performed, restart the OpenNebula daemon and the installation is complete.

Configuration

1) OpenNebula main configuration file needs to be edit to include the VMware Drivers. The following must be added to $ONE_LOCATION/etc/oned.conf:

#-------------------------------------------------------------------------------
#  VMware Driver Addon Virtualization Driver Manager Configuration
#-------------------------------------------------------------------------------
VM_MAD = [
  name       = "vmm_vmware",
  executable = "one_vmm_sh",
  arguments  = "vmware",
  default    = "vmm_sh/vmm_sh_vmware.conf",
  type       = "vmware" ]
  
      
#-------------------------------------------------------------------------------
#  VMware Driver Addon Information Driver Manager Configuration
#-------------------------------------------------------------------------------
IM_MAD = [
    name       = "im_vmware",
    executable = "one_im_sh",
    arguments  = "vmware" ]
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# VMware Driver Addon Transfer Manager Driver Configuration
#-------------------------------------------------------------------------------
TM_MAD = [
  name       = "tm_vmware",
  executable = "one_tm",
  arguments  = "tm_vmware/tm_vmware.conf" ]
#-------------------------------------------------------------------------------

2) The VMM and IM driver needs to know the credentials of the ESX user in order to access the hypervisor. Please input this information in

$ONE_LOCATION/etc/vmwarerc

:!: Please be aware that the above rc file, in stark contrast with other rc files in OpenNebula, uses ruby syntax, therefore please input the values as ruby strings, i.e., between quotes.

:!: When using VMware Server, the connection string set under LIBVIRT_URI needs to have its prefix changed from esx to gsx.

3) To ensure the proper working of the Image Catalog, a script that sets the proper ownership of the file needs to be run after each VM gets executed. The installer already modifies the Image hook to perform this requirement, and a few extra configuration details needs to be done. First, sudo needs to be configured:

oneadmin ALL=NOPASSWD:/FULL/ONE/LOCATION/PATH/share/hooks/fix_owner_perms.sh ""

Afterwards, edit $ONE_LOCATION/share/hooks/fix_owner_perms.sh and set:

  • IMAGE_REPOSITORY_PATH: Must be set at the same value as in $ONE_LOCATION/etc/oned.conf
  • USERNAME: Must be changed to the name of the user that runs OpenNebula, if that is not <oneadmin> (the default value)

4) Specific needed configuration for each driver belonging to the VMware Drivers Addon follows:

  • Virtual Machine Manager (VMM)

The name of the DATASTORE (see the Transfer Manager section) needs to be set in

$ONE_LOCATION/etc/vmm_sh/vmm_sh_vmware.conf
  • Transfer Manager (TM)

The storage configuration needs the $ONE_LOCATION/var folder to be exported as a NFS share, and this to be mounted as a DATASTORE in the VMware hypervisor. The name of the datastore needs to be set in the VMM configuration.

The Image Repository path in $ONE_LOCATION/etc/oned.conf must be empty (defaulting to $ONE_LOCATION/var/images), or it must be pointing to a path contained in $ONE_LOCATION/var, which is the folder exported as NFS. This will effectively deal with the special VMware storage requirements. If these requirements are meet, no further configuration is needed in the TM.

For the old, traditional method of setting manually the SOURCE attribute in the disk section of the VM template, a few things need to be considered. First, the .vmdk files need to reside inside $ONE_LOCATION/var, in the Image Repository path (which needs to be set in the variable $IMAGE_REPO_PATH in $ONE_LOCATION/etc/oned.conf, even if the Image Catalog functionality is not used. Second, the descriptor .vmdk file needs to be renamed to disk.0, and the other flat .vmdk files needs to be left untouched (see the User's Guide section).

User's Guide

The VMware Driver Addons greatly improves the support of the VMware hypervisors with OpenNebula. Tight integration is achieved, among others, in the following areas:

  • Network

Networks can be defined in OpenNebula, and VMs can use leases from these networks, being FIXED or RANGED. The only requisite is to input the name of the VMware hypervisor defined vSwitch as the bridge of the Virtual Network in OpenNebula. The default name for the vSwitch in the ESX family is “VM Network”.

  • Storage

The Image Catalog introduced in OpenNebula v2.0 can also be used with the VMware Drivers Addon. A new “onevmware” command is installed that allows the upload of VMware disks, which are formed by a disk descriptor (.vmdk file) and the actual disk data files. To register vmware disks “onevmware” command introduces two flags (–disk-vmdk <path-to-the-descriptor-.vmdk-file>) and –disk-flat <path-to-the-flat-.vmdk-files-comma-separated>). THe PATH attribute in the xml template will be ignored. For all other image related operations, use “oneimage”.

The direct managing of files (traditional method) is also supported, but the following need to be considered: the source attribute of the disk section of the virtual machine template needs to be pointing to a directory inside $ONE_LOCATION/var (see the Configuration section), containing both the .vmdk (that must be named disk.vmdk), and the flat files (which needs to have its filename untouched).

  • Virtualization

Following the two last sections, we can use a template for a VMware VM like:

NAME=myVMwareVM
DISK=[IMAGE="VMware Win 7 Disk"]
NIC=[NETWORK="public"]

The onevm command will control the lifecycle of the VM as with other hypervisors natively supported by OpenNebula.

:!: The hook functionality is restricted to the local hooks, since there is no ssh connection to the VMware ESX hypervisors to perform remote scripts.