[Linux-cluster] CLVM, iSCSI and naming rules

Pierre-Alain RIVIERE pariviere at ippon.fr
Wed Oct 24 10:09:04 UTC 2007


Hello,

I'm working on a Xen solution where Xen's DomU are stored on iSCSI 
volumes (a LV on Dom0 is a partition on DomU) to allow live migration 
between hosts and to make DomU's partitions resizing easier.

iSCSI volumes -> LVM on Dom0 -> LV on Dom0 -> partition on DomU

As far as I know, I need CLVM in order to propagate automatically LVM 
changes between host. So I've installed Ubuntu Gutsy on my server and 
configured CMAN, CLVM and Open-ISCSI. Things seems to work fine.
I've also added some udev custom rules to have the same device name on 
each box

----------------- udev rule
KERNEL=="sd*", BUS=="scsi", PROGRAM="iscsidev 
%b",SYMLINK+="iscsi/%c{1}/lun%c{2}/part%n"
------------------

------------------ iscsidev
#!/bin/sh

BUS=${1}
HOST=${BUS%%:*}

# This was the first thing I thought of, I'm sure it can be done better:
LUN=`echo ${BUS} | cut -d":" -f4`

[ -e /sys/class/iscsi_host ] || exit 1

file="/sys/class/iscsi_host/host${HOST}/device/session*/iscsi_session*/targetname"

#target_name=$(cat ${file})
target_name=`cut -d":" -f2 ${file}`

# This is not an open-scsi drive
if [ -z "${target_name}" ]; then
    exit 1
fi

echo "${target_name} ${LUN}"
--------------------------------------


Using these scripts my iSCSI devices have a symlink under /dev/iscsi/, 
/dev/iscsi/IpponData.xen01/lun0/part is an example.

Next step, LVM initialization.

      # pvcreate /dev/iscsi/IpponData.xen02/lun0/part
      # pvdisplay /dev/iscsi/IpponData.xen02/lun0/part

        --- NEW Physical volume ---
        PV Name               /dev/sdj
        VG Name             
        PV Size               10.00 GB
        Allocatable           NO
        PE Size (KByte)       0
        Total PE              0
        Free PE               0
        Allocated PE          0
        PV UUID               ecfUIs-4mnP-sKhq-mK8s-mICm-rUvt-2o8E8g


As you can see pvdisplay doesn't care about 
/dev/iscsi/IpponData.xen02/lun0/part symlink and instead use the target 
device.

This is a normal behavior? And when I will deploy CMAN, CLVM and iSCSI 
on another box what will be LVM behaviours? I can't guarantee that 
/dev/sdj will be accessible on the other box, only the symlink will be 
the same.




More information about the Linux-cluster mailing list