The iSCSI Datastore 4.0
The iSCSI datastore driver provides OpenNebula with the possibility of using block-devices for VM images instead of the default file form. The use of the iSCSI datastores presents several benefits, especially regarding performance.
It is developed to work with tgtd, the Linux SCSI target framework. However this driver is written in a way it can be easily hacked into working with specific SAN systems or other iSCSI target softwares.
There are some limitations that you have to consider, though:
tgt-setup-lun-one
script, This script will be installed under the share
directory of OpenNebula (/usr/share/one
or /usr/share/opennebula
depending on the distribution). This script script should be installed in the iSCSI target somewhere in the PATH, e.g. /usr/sbin/tgt-setup-lun-one
and it should belong to root.tgtadm
, tgt-setup-lun-one
, lvcreate
, lvremove
and dd
.
To use iSCSI drivers, you must configure the system datastore as shared
. 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 iSCSI 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=iscsi
and TM_MAD=iscsi
for the transfer mechanism, see below.
Attribute | Description |
---|---|
NAME | The name of the datastore |
DS_MAD | The DS type, use iscsi for the iSCSI datastore |
TM_MAD | Transfer drivers for the datastore, use iscsi , see below |
DISK_TYPE | Type for the VM disks using images from this datastore. Supported values are: block , file |
HOST | The tgt server host. Defaults to localhost |
VG_NAME | The LVM volume group name. Defaults to vg-one |
BASE_IQN | The base IQN for iSCSI target. Defaults to iqn.2012-02.org.opennebula |
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. |
NO_DECOMPRESS | Do not try to untar or decompress the file to be registered. Useful for specialized Transfer Managers |
LIMIT_TRANSFER_BW | Specify the maximum transfer rate in bytes/second when downloading images from a http/https URL. Suffixes K, M or G can be used. |
For example, the following examples illustrates the creation of a iSCSI datastore using a configuration file. In this case we will use the host iscsitarget
as our iSCSI target server.
<xterm>
cat ds.conf
NAME = production DS_MAD = iscsi TM_MAD = iscsi VG_NAME = vg-one HOST = iscsitarget
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 iscsi shared
</xterm>
You can check more details of the datastore by issuing the onedatastore show
command.
The default values can be modified in /var/lib/one/remotes/datastore/iscsi/iscsi.conf
:
HOST
: Default iSCSI target host. Default: localhost
BASE_IQN
: Default IQN path. Default: iqn.2012-02.org.opennebula
VG_NAME
: Default volume group. Default: vg-one
NO_ISCSI
: Lists of hosts (separated by spaces) for which no iscsiadm login or logout is performed.. Default: “$HOSTNAME”
TARGET_CONF
: File where the iSCSI configured is dumped to (tgt-admin –dump). If it poings to /dev/null, iSCSI targets will not be persistent. Default: /etc/tgt/targets.conf
The iSCSI transfer driver will issue a iSCSI discover command in the target server with iscsiadm
. Once the block device is available in the host, the driver will login, mount it and link it to disk.i
.
The hosts must have Open-iSCSI installed, which provides iscsiadm
.
In order for iscsiadm
to work, it needs to be able to make a connection on the default iSCSI port (3260) with the iSCSI target server. Firewalls should be adjusted to allow this connection to take place.
The oneadmin
user must have sudo
permissions to execute iscsiadm
.
System administrators and integrators are encouraged to modify these drivers in order to integrate them with their iSCSI SAN/NAS solution. To do so, the following is a list of files that may be adapted:
Under /var/lib/one/remotes/
:
tgt-setup-lun-one
is installed in host. It creates a file to avoid further ssh connections if it's installed.tgt-setup-lun-one
script.iscsiadm discovery
.iscsiadm discover
and logs in.
/var/lib/one/remotes/datastore/iscsi/iscsi.conf
.