Home » Disco de fibra emulado con SCST

Disco de fibra emulado con SCST

En éste post se detallará un procedimiento mediante el  cual  un servidor linux con una HBA  ofrecerá almacenamiento sobre fibra a través del proyecto SCST. Para esta ocasión se ha usado una HBA QLA2340 con el propósito de integrar sus drivers en modo target  con el módulo SCST.

Hemos usado un PC con las siguientes características:

Placa: ASRock ALiveNF7G-GLAN

RAM: 4 GB DDR 800 HHz Mushkin Extreme

Micro: AMD Athlon64 X2 4600+ 2.4 Ghz AM2 Box

SO: Centos 5.5 en su versión de 64 bits

HBA: QLogic QLA 2340

HD: Western Digital Caviar GP 750GB 5400 rpm SATA2 MAESTRO

HBA: QLogic QLA2340 PCI/PCI-X

 

PC usado como target

 

 

 

 

 

 

 

 

PC usado como target

HBA QLA2340

Fases que consta el procedimiento:

1 – Cargar firmware de HBA

2 – Compilar un Kernel vanilla

3 – Compilar proyecto  SCST y drivers de QLogic

4- Configurar una lun accesible en modo target

1.- Cargar firmware de HBA

Se aconseja que la HBA  tenga un firmware de versión igual o superior a versión 5.xx para versiones de QLOGIC 24/25XX. Para la versión de HBA usada en el laboratorio, QLA2340, hemos descargado  ql2300_fw.bin.3.03.20 desde el siguiente link. Para otra versiones de HBAs QLogic aquí.

Se copia el archivo de firmware en la carpeta  /lib/firmware. Así el módulo qla2xxx(drivers de QLogic) que lleva por defecto la distribución lo cargará en la tarjeta en tiempo de arranque. El éxito de la carga del firmware se observará en la salida del comando dmesg de la siguiente forma :

qla2xxx 0000:01:0a.0: Found an ISP2312, irq 82, iobase 0xffffc20000028000
qla2xxx 0000:01:0a.0: Configuring PCI space…
qla2xxx 0000:01:0a.0: Configure NVRAM parameters…
qla2xxx 0000:01:0a.0: Verifying loaded RISC code…
qla2xxx 0000:01:0a.0: Allocated (412 KB) for firmware dump…
scsi4 : qla2xxx
qla2xxx 0000:01:0a.0:
QLogic Fibre Channel HBA Driver: 8.03.01.04.05.05-k
QLogic QLA2340 – 133MHz PCI-X to 2Gb FC, Single Channel
ISP2312: PCI (33 MHz) @ 0000:01:0a.0 hdma+, host#=4, fw=3.03.26 IPX

 

2 – Compilar un kernel vanilla

La versión inicial del kernel de partida en Centos 5.5 es:

# uname -a

Linux unknown001966cb53eb 2.6.18-194.3.1.el5 #1 SMP Thu May 13 13:08:30 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

Se descarga una versión vanilla (mainline)  desde kernel.org, versión 2.6.26:

#cd /usr/src

# wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.tar.bz2

# bunzip2 /usr/src/linux-2.6.26.tar.bz2

# tar -xvf /usr/src/linux-2.6.26.tar

Se crean los enlaces simbólicos linux y kernel :

#ln -s /usr/src/linux-2.6.26 linux

#ln -s /usr/src/linux-2.6.26 kernel

Se descargan las fuentes del proyecto de SCST de su Subversion:

#cd  /root

#svn co https://scst.svn.sourceforge.net/svnroot/scst/trunk

(…)

A    trunk/nightly/bin

A    trunk/nightly/bin/nightly

A    trunk/nightly/README.txt

U   trunk

Revisión obtenida: 1792

Desde la carpeta /root/scst/trunk/src  parchear las fuentes del kernel que nos hemos descargado:



# cd /root/scst/trunk/

# cp /root/scst/trunk/scst/kernel/scst_exec_req_fifo-2.6.26.patch /usr/src

# cp /root/scst/trunk/scst/kernel/scst_exec_req_fifo-2.6.26.patch /usr/src

# cd /usr/src

# patch -p0 < scst_exec_req_fifo-2.6.26.patch

Eliminar los drivers de las fuentes del kernel vanilla y sustituir por su homólogo modificado que proporciona las fuentes de SCST:

# mv /usr/src/linux/drivers/scsi/qla2xxx /usr/src/linux/drivers/scsi/qla2xxx_orig

Incluir el driver de Qlogic en modo target  previo a la compilación del kernel:

#  ln -s /root/scst/trunk/qla2x00t /usr/src/linux/drivers/scsi/qla2xxx

Procedemos a configurar la compilación del kernel y sus módulos:

#cd /usr/src/linux

#make menuconfig

Desde el menú de configuración del kernel activar "Device Drivers->SCSI device support->SCSI low level drivers->Qlogic 2xxx target mode support":

Modificar el fichero Makefile y cambiar la entrada EXTRAVERSION de "-prep"  a "-scst":

#vi Makefile

(…)

VERSION = 2

PATCHLEVEL = 6

SUBLEVEL = 18

EXTRAVERSION = -scst

RHEL_MAJOR = 5

RHEL_MINOR = 5

NAME=Avast! A bilge rat!

(…)

Procedemos a compilar el kernel y módulos:

#make bzImage
(…)

Setup is 11384 bytes (padded to 11776 bytes).

System is 2783 kB

CRC 5f0d96a4

Kernel: arch/x86/boot/bzImage is ready (#1)

#make modules

 

(…)

Building modules, stage 2.

MODPOST 3 modules

CC drivers/net/s2io.mod.o

LD [M] drivers/net/s2io.ko

CC drivers/scsi/qla2xxx/qla2xxx.mod.o

LD [M] drivers/scsi/qla2xxx/qla2xxx.ko

CC drivers/scsi/scsi_wait_scan.mod.o

LD [M] drivers/scsi/scsi_wait_scan.ko

#make modules_install
#make install

Si el proceso ha ido bien, tendremos una entrada en el grub para el nuevo kernel creado preparado para levantar el modo target de la HBA:

#cat /boot/grub/menu.lst

(…)

title CentOS (2.6.26)
root (hd0,2)
kernel /vmlinuz-2.6.26 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.26.img

(…)

Hacemos un reinicio del sistema y arrancamos desde grub en CentOS (2.6.26) o el que se haya creado.

3 – Compilar proyecto  SCST y drivers de QLogic

Después del reinicio se comprueba que se ha cargado el nuevo kernel creado:

#uname -a
Linux unknown001966cb53eb 2.6.26 #1 SMP Sun Jun 27 19:42:12 CEST 2010 x86_64 x86_64 x86_64 GNU/Linux

Sobre el que compilaremos el módulo SCST que nos permitirá crear aquellos dispositivos visibles a través del target de fibra.

#cd /root/scst/trunk/scst/src

#make all

(…)

CC /root/scst/trunk/scst/src/scst.mod.o

LD [M] /root/scst/trunk/scst/src/scst.ko

make[1]: se sale del directorio `/usr/src/linux-2.6.26'

#make install

install -m 644 ../include/scst_const.h /usr/local/include/scst
rm -f /usr/local/include/scst/Modules.symvers
install -m 644 Module.symvers /usr/local/include/scst
/sbin/depmod -a 2.6.26
mkdir -p /var/lib/scst/pr
****************************************************************
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
*!!                                                          !!*
*!!  Now don't forget to rebuild and reinstall all your      !!*
*!!  target drivers, custom dev handlers and necessary user  !!*
*!!  space applications. Otherwise, because of the versions  !!*
*!!  mismatch, you could have many problems and crashes.     !!*
*!!  See IMPORTANT note in the "Installation" section of     !!*
*!!  SCST's README file for more info.                       !!*
*!!                                                          !!*
*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*
****************************************************************

# cd /root/scst/trunk/qla2x00t/qla2x00-target/

# make

(…)

target/qla2x00tgt.mod.o

LD [M] /root/scst/trunk/qla2x00t/qla2x00-target/qla2x00tgt.ko

make[1]: se sale del directorio `/usr/src/linux-2.6.26'

# make install

(…)

INSTALL /root/scst/trunk/qla2x00t/qla2x00-target/qla2x00tgt.ko

DEPMOD 2.6.26

make[1]: se sale del directorio `/usr/src/linux-2.6.26'

/sbin/depmod -a 2.6.26

Los binarios recién compilados se encuentran como módulos en /lib/modules/linux-2.6.26/extra:

# ls /lib/modules/2.6.26/extra/
dev_handlers  qla2x00tgt.ko  scst.ko

# ls -l /lib/modules/`uname -r`/extra/dev_handlers

/lib/modules/`uname -r`/extra/dev_handlers
total 224
-rw-r–r– 1 root root 13792 jun 27 19:55 scst_cdrom.ko
-rw-r–r– 1 root root 11375 jun 27 19:55 scst_changer.ko
-rw-r–r– 1 root root 15209 jun 27 19:55 scst_disk.ko
-rw-r–r– 1 root root 15366 jun 27 19:55 scst_modisk.ko
-rw-r–r– 1 root root 11391 jun 27 19:55 scst_processor.ko
-rw-r–r– 1 root root 11351 jun 27 19:55 scst_raid.ko
-rw-r–r– 1 root root 15142 jun 27 19:55 scst_tape.ko
-rw-r–r– 1 root root 51965 jun 27 19:55 scst_user.ko
-rw-r–r– 1 root root 62807 jun 27 19:55 scst_vdisk.ko

¿ que es cada módulo?

– scst – SCST itself
– scst_disk – device handler for disks (type 0)
– scst_tape – device handler for tapes (type 1)
– scst_processor – device handler for processors (type 3)
– scst_cdrom – device handler for CDROMs (type 5)
– scst_modisk – device handler for MO disks (type 7)
– scst_changer – device handler for medium changers (type 8)
– scst_raid – device handler for storage array controller (e.g. raid) (type C)
– scst_vdisk – device handler for virtual disks (file, device or ISO CD image).
– scst_user – user space device handler

4- Configurar una lun accesible en modo target

Para éste propósito se usará el módulo scst_vdisk a través del cual se ofrecerá un fichero de tamaño definido como una lun tipo disco en la SAN.

Cargamos los módulos, que para este caso sólo se necesitarían qla2xxx, qla2x00tgt y scst_vdisk, pero ya estamos pensando en el futuro 😉

# for _mod in scst qla2xxx qla2x00tgt scst_vdisk scst_disk scst_changer scst_tape; do modprobe $_mod; done

# lsmod

Module Size Used by

scst_tape 10368 0

scst_changer 7936 0

scst_disk 10368 0

scst_vdisk 40556 0

qla2x00tgt 51480 0

scst 192628 5 scst_tape,scst_changer,scst_disk,scst_vdisk,qla2x00tgt

qla2xxx 186700 1 qla2x00tgt

Se crea un fichero de 512 MB en /mnt con nombre disk1:

# dd if=/dev/zero of=/mnt/disk1 bs=1024k count=512

512+0 records in

512+0 records out

536870912 bytes (537 MB) copied, 5,87352 seconds, 91,4 MB/s

# file /mnt/disk1

/mnt/disk1: data

Y se configura para que sea visible por la HBA:

# echo "open vm_disk /mnt/disk1" > /proc/scsi_tgt/vdisk/vdisk

#  echo "add vm_disk 0" >/proc/scsi_tgt/groups/Default/devices

El resultado de este proceso se puede observar en la salida del comando dmesg:

scst: Attached to scsi2, channel 0, id 0, lun 0, type 0
scst: Processing thread scsi_tgt0 (PID 6116) started
scst: Processing thread scsi_tgt1 (PID 6117) started
scst: Init thread started, PID 6118
scst: Task management thread started, PID 6119
scst: Management thread started, PID 6120
scst: SCST version 2.0.0-rc2-procfs loaded successfully (max mem for commands 928MB, per device 371MB)
scst: Enabled features: TRACING
Initializing QLogic Fibre Channel HBA Driver target mode addon version 2.0.0-rc2
Target mode driver for QLogic 2×00 controller registered successfully
scst: Target template qla2x00tgt registered successfully
scst: Virtual device handler vdisk_fileio for type 0 registered successfully
scst: Virtual device handler vdisk_blockio for type 0 registered successfully
scst: Virtual device handler vdisk_nullio for type 0 registered successfully
scst: Virtual device handler vcdrom for type 5 registered successfully
scst: Device 2:0:0:0: TST 0, QUEUE ALG 0, SWP 0, TAS 0, D_SENSE 0, has_own_order_mgmt 1
scst: Device handler "dev_disk" for type 0 registered successfully
scst: Device handler "dev_disk_perf" for type 0 registered successfully
scst: Device handler "dev_changer" for type 8 registered successfully
scst: Device handler "dev_tape" for type 1 registered successfully
scst: Device handler "dev_tape_perf" for type 1 registered successfully
dev_vdisk: Registering virtual vdisk_fileio device vm_disk
dev_vdisk: Attached SCSI target virtual disk vm_disk (file="/mnt/disk1", fs=512MB, bs=512, nblocks=1048576, cyln=512)
scst: Attached to virtual device vm_disk (id 1)
scst: Added device vm_disk to group Default (LUN 0, rd_only 0)

Para activar el modo target sólo quedaría introducir el valor 1 en el fichero target_mode_enabled correspondiente a su scsi_host asociado como interfaz sysfs.

# echo "1" >/sys/class/scsi_host/host5/target_mode_enabled

Dejo unas comprobaciones verificando la correcta configuración de nuestro vdisk:

# cat /sys/class/scsi_host/host5/active_mode

Target

#  cat /proc/scsi_tgt/scsi_tgt
Device (host:ch:id:lun or name)                             Device handler
2:0:0:0                                                     dev_disk
vm_disk                                                     vdisk_fileio

# cat /proc/scsi_tgt/vdisk/vdisk

Name Size(MB) Block size Options File name T10 device id

vm_disk 512 512 /mnt/disk1 vm_disk 968d2339

#  cat /proc/scsi_tgt/groups/Default/devices

Device (host:ch:id:lun or name) LUN Options

vm_disk 0

 

El el siguiente post pondremos a prueba nuestro disco creado, usando un initiator de fibra sobre un host Windows Server 2008 con HBA QLA2340.

Fuentes:

How to configure QLogic target driver for 22xx/23xx/24xx/25xx adapters. Step by step guide.

2 Responses to “Disco de fibra emulado con SCST”

  1. Google dice:

    Google

    Check beneath, are some completely unrelated websites to ours, on the other hand, they may be most trustworthy sources that we use.

  2. Google dice:

    Google

    We came across a cool internet site that you just may well get pleasure from. Take a look when you want.

  3. Nurse Jobs dice:

    Regards for helping out, fantastic information. «If you would convince a man that he does wrong, do right. Men will believe what they see.» by Henry David Thoreau.

  4. An outstanding share! I have just forwarded thks onto a co-worker
    who had been doing a little research on this. And he actually bought me breakfast because
    I found it for him… lol. So allow me to reword this….

    Thanks for the meal!! But yeah, thanx for spending the time to talk about this subjewct here on your web page.

  5. Hеy ths iiѕ somewhat of off topikc but I was wonderіng if blogs
    use WYSIWYG editorѕ or if you have to manually code with HTML.
    I’m startinng a blog sߋn but have no coding exρerience so I wanted to get guidance
    frfom someone with еxperience. Any help would be gгeatly appreciated!

  6. I came across your Disco de fibra emulado con SCST | Almacenamiento Abierto website and wanted to let you know that we have decided to open our POWERFUL and PRIVATE website traffic system to the public for a limited time! You can sign up for our targeted traffic network with a free trial as we make this offer available again. If you need targeted traffic that is interested in your subject matter or products start your free trial today: https://38x.de/92sj7 Unsubscribe here: https://twe.lv/gg

  7. […] del escenario creado descrito en los post  SCST 2 y SCST 3, donde se compiló un kernel vanilla y se le añadió el proyecto SCST junto con los […]

  8. […] comprobar la correcta funcionalidad del disco de fibra creado en el anterior post, disponemos de un servidor con Windows Server 2008 y una HBA Emulex LP-10000DC  con drivers en […]

Responder a top malaysia online casino Cancelar la respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *