How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

vemurirajesh10
How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

I am trying to configure mhVTL 1.5.4 in RHEL 7.5.  Whether mhVTL 1.5.4 supports in RHEL 7.5?  And I am stuck at configuring iscsi tartgets for tape devices?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

Mark Harvey
Administrator
This is really a question for the iSCSI target driver you are using...

mhVTL by itself has no idea about iSCSI

Two common target drivers are stgt & scst

Sent from my iPad

On Aug 16, 2018, at 20:38, vemurirajesh10 [via mhVTL - A Linux Virtual Tape Library] <[hidden email]> wrote:

How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

I am trying to configure mhVTL 1.5.4 in RHEL 7.5.  Whether mhVTL 1.5.4 supports in RHEL 7.5?  And I am stuck at configuring iscsi tartgets for tape devices?

Thanks in advance.


To start a new topic under mhVTL - A Linux Virtual Tape Library, email [hidden email]
To unsubscribe from mhVTL - A Linux Virtual Tape Library, click here.
NAML
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

vemurirajesh10
Hi Mark,

Thank you for the update.

whether mhvtl 1.5.4 supports RedHat Linux 7.5?

In Linux 6.5 I have added LUN ids for all the tape devices and confiugred /etc/tgt/targets.conf

<target iqn.2018-06.com.example:mhvtl.target1>
        backing-store /dev/sg7
        backing-store /dev/sg3
        backing-store /dev/sg4
        backing-store /dev/sg5
        backing-store /dev/sg6
        bs-type sg
        device-type pt
</target>

But this is not the case in Linux 7.5. Do you have document for configuring mhvtl in Linux 7.5?

Rajesh
Reply | Threaded
Open this post in threaded view
|

Re: How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

Mark Harvey
Administrator
Have you checked / confirmed the iSCSI target you are using is installed on the RHEL 7.5 box ?

i.e. Check the RHEL 7.5 isn't using LIO SCSI target rather than the 'STGT' target you have provided the config for.

I have to state again, this has nothing to do with the mhVTL itself. The questions are best asked to the RedHat 7.5.

What is the output of :
# lsscsi -g (once you start the mhVTL daemons ?)
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

vemurirajesh10
Hi Mark,

Below are the outputs for lsscsi and targetcli commands:

[root@linuxmhvtl ~]# lsscsi -g
[0:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda   /dev/sg0
[2:0:0:0]    cd/dvd  NECVMWar VMware SATA CD00 1.00  /dev/sr0   /dev/sg1
[33:0:0:0]   mediumx STK      L700             0105  /dev/sch0  /dev/sg6
[33:0:1:0]   tape    IBM      ULT3580-TD5      0105  /dev/st0   /dev/sg2
[33:0:2:0]   tape    IBM      ULT3580-TD5      0105  /dev/st1   /dev/sg3
[33:0:3:0]   tape    IBM      ULT3580-TD5      0105  /dev/st2   /dev/sg4
[33:0:4:0]   tape    IBM      ULT3580-TD5      0105  /dev/st3   /dev/sg5
[34:0:0:0]   disk    LIO-ORG  shareddata       4.0   /dev/sdb   /dev/sg7
[root@linuxmhvtl ~]#


[root@linuxmhvtl ~]# targetcli
targetcli shell version 2.1.fb46
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/iscsi/iqn.20...l1:mhvtl/tpg1>
/iscsi/iqn.20...l1:mhvtl/tpg1> ls
o- tpg1 ................................................. [no-gen-acls, no-auth]
  o- acls ............................................................ [ACLs: 1]
  | o- iqn.2018-08.com.linuxmhvtl:mhvtl ................... [Mapped LUNs: 1]
  |   o- mapped_lun0 ............................. [lun0 fileio/shareddata (rw)]
  o- luns ............................................................ [LUNs: 1]
  | o- lun0 ....... [fileio/shareddata (/opt/shareddata.img) (default_tg_pt_gp)]
  o- portals ...................................................... [Portals: 1]
    o- 0.0.0.0:3260 ....................................................... [OK]
/iscsi/iqn.20...l1:mhvtl/tpg1>

Reply | Threaded
Open this post in threaded view
|

Re: How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

vemurirajesh10
Hi Mark,

Finally I was able to configure mhVTL in Linux 7.5 also.

Thank you for your support.

Rajesh
Reply | Threaded
Open this post in threaded view
|

Re: How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

Mark Harvey
Administrator
I managed to find time and test out LIO and pass-thru backend (pscsi):

The Initiator IQN will need adjusting to suit your iSCSI initiator (INIT_IQN)

A simple for loop which adds all mhVTL devices to the one iSCSI target.. Lots of things which could be expanded on.
Such as :
- Split each tape library out as it's own iSCSI target
- Perhaps split tape drives into one target, and another for the library.

#!/bin/bash

# Reference:
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=880576

IQN="iqn.2019-03.com.mhvtl:target"
INIT_IQN="iqn.1994-05.com.redhat:e284d58153b4"

HBA=`lsscsi -H | awk '/mhvtl/ {print $1}' | sed -e 's/\[//' -e 's/\]//'`

# Extract SCSI h:b:t:l of each dev
SCSI_ADDR=`lsscsi $HBA | awk '{print $1}'`

targetcli /iscsi/ create $IQN

# Setup LIO backing store - Walk each device, extract /dev/sg path
for dev in $SCSI_ADDR
do
 	read -r hba channel id lun <<< `echo $dev | awk -F: '{print $1,$2,$3,$4}' | sed -e 's/\[//' -e 's/\]//g'`

	# Extract the SCSI Passthru device (/dev/sg) of this h:b:t:l
	TAPE_DEV=`lsscsi -g $hba $channel $id $lun | awk '{print $7}'`

	echo "hba: $hba, Channel: $channel, SCSI ID: $id, SCSI LUN: $lun - scsi passthru path: $TAPE_DEV"
	MHVTL=$(printf "h%db%dt%dl%d" $hba $channel $id $lun)

	TLD="/sys/kernel/config/target/core/pscsi_0/mhVTL${MHVTL}"
	mkdir -p $TLD
	uuidgen > $TLD/wwn/vpd_unit_serial
	echo scsi_host_id=$hba,scsi_channel_id=$channel,scsi_target_id=$id,scsi_lun_id=$lun >  $TLD/control
	echo $TAPE_DEV > $TLD/udev_path
	echo 1 > $TLD/enable

	# Map LIO backing store to mhVTL /dev/sgXX path
	targetcli /iscsi/$IQN/tpg1/luns/ create /backstores/pscsi/mhVTL${MHVTL}
done

targetcli /iscsi/$IQN/tpg1/acls/ create $INIT_IQN

targetcli ls
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

tsunami_liao

Hi Mark,

I just run a quick test in my VM which running with RHEL7.3. It will cause system reboot unexpectedly.
I tried to run it step by step and found that I've got permission denied during uuidgen command.
Am I did something wrong?

Thanks in advance!
Reply | Threaded
Open this post in threaded view
|

Re: How to configure iscsi targets in RHEL 7.5 for vtl tape deivces?

Mark Harvey
Administrator
Interesting..

I took the steps out from the 'Debian' bug report (in the reference: at top of script)..

As LIO is a kernel implementation - I'd guess that it's likely a bug with LIO implementation with the kernel you are running.

I was using a CentOS7.6 + yum upgrade..

I can't see the point in setting a UUID -> vpd_unit_serial as this will be retrieved from the pscsi (passthru) device anyway..

I just did an early post (with the hope of getting feedback) both good and bad. With some tweaks - I'll add it to the 'scripts' dir.
Regards from Australia
Mark Harvey