VMmanager: ISCSI storage

From ISPWiki
Jump to: navigation, search
Hierarchy: VMmanager KVM -> Cluster configuration
VMmanager Cloud -> Cluster configuration

iSCSI (open-iscsi)

  • VMmanager manages the server-storage through ssh
  • VMmanager uses open-iscsi; all required packages should be installed, and the tgtd service must be up and running. Make sure tgtd starts automatically upon restart.

If you run Centos:

yum install scsi-target-utils
service start tgtd
chkconfig tgtd on

Also you need check if necessary ports are available and if not to add rules:

iptables -I INPUT 1 -p tcp --dport 3260 -j ACCEPT
service iptables save

Once you have configured the storage server, go to VMmanager -> Storage templates and add an iSCSI storage.

Principles of operation

Creating a storage

While creating a VMmanager storage, a target named iqn.YYYY-MM.<hostname-reverse>.<storage>_ID, where ID - unique identifier is created on the server running iscsi.

The <storage>_ID pool is created in libvirt. Libvirt imports the target and all LUNs from that target.

Thus, the storage is a set of pools with different IDs.

Example: let's create an iscsi-storage named NetStorage.

  • NetStorage_001 will be created in libvirt
  • The iqn.2013-04.org.our-dc.stor1.NetStorage_001 target will be created on the server running iscsi
  • The target will be added to the /etc/tgt/vmmgr/<target_name>.conf file, therefore the targets wont't be deleted upon restart. For each target separate file configuration will be created in the directory /etc/tgt/vmmgr/

The above procedure enables VMmanager to create more than 256 virtual disks on one storage. If you want to create more virtual disks, new targets NetStorage_002, NetStorage_003, etc. will be created.

Creating a virtual disk

In the iscsi-storage disks are created as files in the directory specified by the iSCSITargetDir parameter in the VMmanager configuration file, by default in /iscsivolumes

Creation of a new virtual disk includes the following steps:

  • a file is created in the /iscsivolumes directory on the iscsi-server. The file has the same name as the virtual disk.
  • VMmanager defines ID of the target, where LUN will be created. If the target has more than 150 LUNs, a newiqn.YYYY-MM.<hostname-reverse> target will be created .<storage>_ID, where the ID is greater by 1.
  • A new libvirt pool named <storage>_ID will be created on the cluster nodes.
  • A new LUN will be created in that target and added into the /etc/tgt/vmmgrtargets.conf file. Its id will be kept in the database.
  • Information about the libvirt pools will be updated on all the cluster nodes (run the virsh pool-refresh <storage>_ID command)

Once completed, the newly created virtual disk will be available on all the cluster nodes. You can locate the unit:0:0:LUN_ID virtual disk in the <storage>_ID pool.