The virtual disk of a virtual machine is the HDD image. Virtual disks are stored in a local or network storage. A network LVM-storage is similar to a common lvm except for some details. However, the physical volume where a group of volumes is located is a network device.
This article describes how to configure the network LVM-storage. For more information please refer to the article Network storages.
Peculiarities
When creating a virtual machine, on the same cluster node a virtual disk is created, and it will be accessible on all the cluster node. It will be active only on one node.
When migrating a virtual machine, the virtual disk will not copy but will activate on the target node. On the source node, the disk will be disabled.
Example of configuration using open-iscsi
Network storage configuration
Install iSCSI:
# yum install scsi-target-utils
BASH
Configure lvm:
# pvcreate /dev/sda2
Physical volume "/dev/sda2" successfully created
# vgcreate vg0 /dev/sda2
Volume group "vg0" successfully created
BASH
Configure the tgtd configuration file:
# cat /etc/tgt/targets.conf
...
<target iqn.2014-04.net.ispsystem.nlvm:storage.nlvm>
backing-store /dev/sda2
initiator-address 10.1.1.1 #cluster node IP address
initiator-address 10.1.1.2
initiator-address 10.1.1.3
</target>
...
BASH
Restart tgtd:
# service tgtd restart
Stopping SCSI target daemon: [ OK ]
Starting SCSI target daemon: [ OK ]
BASH
Add iptables rules, if needed:
iptables -I INPUT 1 -p tcp --dport 3260 -j ACCEPT
service iptables save
BASH
Connecting to cluster nodes
Connect the disk on each cluster node
iscsiadm -m discovery -t st -p 10.1.2.1
iscsiadm -m node --login -p 10.1.2.1
BASH
Once completed you can add a "network LVM" storage named vg0 into VMmanager.