Installation guide

Removable media: No
Readonly: No
Backing store type: rdwr
Backing store path: /var/lib/tgtd/kvmguest/shareddata.img
Backing store flags:
Account information:
ACL information:
4. Allo w clien t access t o t h e t arg et
Finally, this example command allows access to all clients without any authentication:
# tgtadm --lld iscsi --op bind --mode target --tid 1 --initiator-address ALL
Note
The two most common problems encountered when configuring the iSCSI target are related to
SELinux and iptables. If adding plain files as LUNs in an iSCSI target, ensure the files are
labeled system_u:object_r:tgtd_var_lib_t:s0. TCP port 3260 must be open in your
iptables configuration.
24 .1.2. How t o configure iSCSI on a libvirt KVM host and provision a guest
using virt -inst all
The previous section described how to set up an iSCSI target. This section demonstrates how to
configure iSCSI on a libvirt KVM instance using virsh, and then how to provision a guest using
virt-install.
1. Def in in g t h e st orag e po o l
All libvirt storage is managed through storage pools, of which there are many possible types:
SCSI, NFS, ext4, plain directory and iSCSI. All libvirt objects are configured via XML
description files, and storage pools are no different in this regard. For an iSCSI storage pool
there are three important pieces of information to provide:
The target path - this determines how libvirt will expose device paths for the pool. Paths like
/dev/sda and /dev/sdb are not an ideal choice as they can change between reboots,
and can change across machines within a cluster; in other words, the names are
assigned on a first come, first served basis by the kernel. It is strongly recommended to
use the /dev/disk/by-path format. This results in a consistent naming scheme across
all machines.
The host name - this is the fully-qualified DNS name of the iSCSI server.
The source path - this is the iSCSI qualified name (IQN) seen in the previous setup
procedure (iqn.2004-04.rhel:rhel5:iscsi.kvmguest).
Although your environment will likely be different, the following text is what an iSCSI
configuration will look like:
<pool type='iscsi'>
<name>kvmguest</name>
<source>
<host name='myiscsi.example.com'/>
<device path='iqn.2004-04.rhel:rhel5:iscsi.kvmguest'/>
Chapt er 2 4 . Using shared st orag e wit h virt ual disk images
251