PDA

View Full Version : iscsitarget configuration



epretorious
04-Dec-2012, 05:53
I've created a very simple configuration for iscsitarget (i.e., IET):

Target iqn.2012-11.com.example.san1:sda
Lun 0 Path=/dev/drbd7,Type=blockio
Lun 1 Path=/dev/drbd8,Type=blockio
Lun 2 Path=/dev/drbd9,Type=blockio
Lun 3 Path=/dev/drbd10,Type=blockio
Target iqn.2012-11.com.example.san1:sdb
Lun 0 Path=/dev/drbd107,Type=blockio
However, none of the LUN's appear on the initiator:

xen1:~ # iscsiadm -m session -P3
iSCSI Transport Class version 2.0-870
version 2.0-872.suse
Target: iqn.2012-11.com.example.san1:sdb
Current Portal: 192.168.1.1:3260,1
Persistent Portal: 192.168.1.1:3260,1
**********
Interface:
**********
Iface Name: default
Iface Transport: tcp
Iface Initiatorname: iqn.1996-04.de.suse:01:2441bbdc6224
Iface IPaddress: 192.168.1.3
Iface HWaddress: <empty>
Iface Netdev: <empty>
SID: 1
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
*********
Timeouts:
*********
Recovery Timeout: 120
Target Reset Timeout: 30
LUN Reset Timeout: 30
Abort Timeout: 15
*****
CHAP:
*****
username: <empty>
password: ********
username_in: <empty>
password_in: ********
************************
Negotiated iSCSI params:
************************
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 8192
FirstBurstLength: 65536
MaxBurstLength: 262144
ImmediateData: Yes
InitialR2T: Yes
MaxOutstandingR2T: 1
************************
Attached SCSI devices:
************************
Host Number: 6 State: running
Target: iqn.2012-11.com.example.san1:sda
Current Portal: 192.168.1.1:3260,1
Persistent Portal: 192.168.1.1:3260,1
**********
Interface:
**********
Iface Name: default
Iface Transport: tcp
Iface Initiatorname: iqn.1996-04.de.suse:01:2441bbdc6224
Iface IPaddress: 192.168.1.3
Iface HWaddress: <empty>
Iface Netdev: <empty>
SID: 2
iSCSI Connection State: LOGGED IN
iSCSI Session State: LOGGED_IN
Internal iscsid Session State: NO CHANGE
*********
Timeouts:
*********
Recovery Timeout: 120
Target Reset Timeout: 30
LUN Reset Timeout: 30
Abort Timeout: 15
*****
CHAP:
*****
username: <empty>
password: ********
username_in: <empty>
password_in: ********
************************
Negotiated iSCSI params:
************************
HeaderDigest: None
DataDigest: None
MaxRecvDataSegmentLength: 262144
MaxXmitDataSegmentLength: 8192
FirstBurstLength: 65536
MaxBurstLength: 262144
ImmediateData: Yes
InitialR2T: Yes
MaxOutstandingR2T: 1
************************
Attached SCSI devices:
************************
Host Number: 7 State: running
Why aren't the LUN's visible to the initiator?

Eric P.
Truckee, CA

epretorious
04-Dec-2012, 06:36
Reloading iscsitarget on the SAN...

> san1:~ # /etc/init.d/iscsitarget reload
> Stopping iSCSI target service: done
> Starting iSCSI target service: done
...and then clearing the initiator database..

xen1:~ # iscsiadm -m discovery --op=delete -p 192.168.1.1
>
> xen1:~ # iscsiadm -m discovery -t st -p 192.168.1.1
> 192.168.1.1:3260,1 iqn.2012-11.com.example.san1:sdb
> 192.168.0.1:3260,1 iqn.2012-11.com.example.san1:sdb
> 192.168.1.1:3260,1 iqn.2012-11.com.example.san1:sda
> 192.168.0.1:3260,1 iqn.2012-11.com.example.san1:sda
>
> xen1:~ # iscsiadm -m node -p 192.168.1.1 -l
> Logging in to [iface: default, target: iqn.2012-11.com.example.san1:sdb, portal: 192.168.1.1,3260] (multiple)
> Logging in to [iface: default, target: iqn.2012-11.com.example.san1:sda, portal: 192.168.1.1,3260] (multiple)
> Login to [iface: default, target: iqn.2012-11.com.example.san1:sdb, portal: 192.168.1.1,3260] successful.
> Login to [iface: default, target: iqn.2012-11.com.example.san1:sda, portal: 192.168.1.1,3260] successful.
>
> xen1:~ # dmesg | tail
> [16159.158419] sd 9:0:0:3: [sdf] Write cache: disabled, read cache: disabled, doesn't support DPO or FUA
> [16159.158978] sd 8:0:0:0: [sdb] Attached SCSI disk
> [16159.180750] sdc: unknown partition table
> [16159.182476] sd 9:0:0:0: [sdc] Attached SCSI disk
> [16159.196576] sdd: unknown partition table
> [16159.198112] sd 9:0:0:1: [sdd] Attached SCSI disk
> [16159.229768] sde: unknown partition table
> [16159.231276] sd 9:0:0:2: [sde] Attached SCSI disk
> [16159.238949] sdf: unknown partition table
> [16159.240762] sd 9:0:0:3: [sdf] Attached SCSI disk
>
> xen1:~ # lsscsi
> [0:0:0:0] disk ATA HDS728080PLA380 PF2O /dev/sda
> [4:0:1:0] cd/dvd HL-DT-ST RW/DVD GCC-4244N 1.00 /dev/sr0
> [8:0:0:0] disk IET VIRTUAL-DISK 0 /dev/sdb
> [9:0:0:0] disk IET VIRTUAL-DISK 0 /dev/sdc
> [9:0:0:1] disk IET VIRTUAL-DISK 0 /dev/sdd
> [9:0:0:2] disk IET VIRTUAL-DISK 0 /dev/sde
> [9:0:0:3] disk IET VIRTUAL-DISK 0 /dev/sdf
...seems to have fixed the problem.

Could this be an issue of timing? i.e., Could iscsitarget be trying to export the block devices before DRBD is ready?

Eric P.
Truckee, CA

epretorious
04-Dec-2012, 06:54
I left out a very important step (above): I realized afterwards that the exported devices were DRBD devices and that none of the DRBD devices were ready:

> san1:/usr/share/doc # cat /proc/drbd
> version: 8.4.1 (api:1/proto:86-100)
> GIT-hash: 91b4c048c1a0e06777b5f65d312b38d47abaea80 build by phil@fat-tyre, 2011-12-20 12:43:15
>
> 7: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
> ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
> 8: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
> ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
> 9: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
> ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
> 10: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
> ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
>
> 107: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
> ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
So, after promoting SAN1 to become the primary, I reloaded iscsitarget on the SAN. i.e., drbd{7,8,9,10} had been read-only because SAN1 was not the primary.

I expect that if/when I figure out why SAN1 didn't automatically become the primary the problem will be resolved.

Eric P.
Truckee, CA