iSCSI - Libvirt Datastore
This Datastore is used to register already existing iSCSI volume available to the hypervisor Nodes.
Front-end Setup
No additional configuration is needed
Node Setup
The Nodes need to meet the following requirements:
- The devices you want to attach to a VM should be accessible by the hypervisor.
- QEMU needs to be compiled with libiscsi support.
iSCSI CHAP Authentication
In order to use CHAP authentication, you will need to create a libvirt secret in all the hypervisors. Follow this Libvirt Secret XML format guide to register the secret. Take the following into consideration:
incominguserfield on the iSCSI authentication file should match the Datastore’sISCSI_USERparameter.<target>field in the secret XML document will contain theISCSI_USAGEparemeter.- Do this in all the hypervisors.
OpenNebula Configuration
Once the Node storage setup is ready, the OpenNebula configuration comprises two steps:
- Create System Datastore
- Create Image Datastore
Create System Datastore
The iSCSI Datastore can work with the following System Datastores:
Note that the System Datastore is only used for volatile disks and context devices.
Create an Image Datastore
To create an Image Datastore you just need to define the name and set the following:
| Attribute | Description |
|---|---|
NAME | Name of datastore |
TYPE | IMAGE_DS |
DS_MAD | iscsi_libvirt |
TM_MAD | iscsi_libvirt |
DISK_TYPE | ISCSI |
ISCSI_HOST | iSCSI Host. Example: host or host:port. |
If you need to use CHAP authentication (optional) add the following attributes to the Datastore:
| Attribute | Description |
|---|---|
ISCSI_USAGE | Usage of the secret with the CHAP Auth string. |
ISCSI_USER | user the iSCSI CHAP authentication. |
An example template of Datastore:
> cat iscsi.ds
NAME = iscsi
DISK_TYPE = "ISCSI"
DS_MAD = "iscsi_libvirt"
TM_MAD = "iscsi_libvirt"
ISCSI_HOST = "the_iscsi_host"
ISCSI_USER = "the_iscsi_user"
ISCSI_USAGE = "the_iscsi_usage"
> onedatastore create iscsi.ds
ID: 101
Datastore Usage
New images can be added like any other image by specifying the path. If you are using the CLI do not use the shorthand parameters as the CLI check if the file exists and the device most probably won’t exist in the Front-end.
As an example here is an image template to add a Node disk iqn.1992-01.com.example:storage:diskarrays-sn-a8675309:
NAME = iscsi_device
PATH = iqn.1992-01.com.example:storage:diskarrays-sn-a8675309
PERSISTENT = YES
To meet your specific requirements, configure any of the following: ISCSI_HOST, ISCSI_USER, ISCSI_USAGE and ISCSI_IQN parameters in the image template. These overridden parameters are reflected in new VMs.
Here is an example of an iSCSI LUN template that uses the iSCSI transfer manager.
oneadmin@onedv:~/exampletemplates$ more iscsiimage.tpl
NAME=iscsi_device_with_lun
PATH=iqn.2014.01.192.168.50.61:test:7cd2cc1e/0
ISCSI_HOST=192.168.50.61
PERSISTENT=YES
Note the explicit /0 at the end of the IQN target path. This is the iSCSI LUN ID.
GIVE FEEDBACK
Was this resource helpful?
Glad to hear it
Sorry to hear that