Mostrando entradas con la etiqueta iscsi. Mostrar todas las entradas
Mostrando entradas con la etiqueta iscsi. Mostrar todas las entradas

miércoles, 28 de marzo de 2012

Manual de Supervivencia XenServer y Multipath + iscsi

El Storage como parte fundamental de la mayoría de entornos, hay que tenerlo muy controlado. Para ello la siguiente guía:

Para los que utilizamos multipath en XenServer, hay que tener en cuenta algunos trucos para realizar tareas sobre este daemon.

Como ver los caminos que tenemos configurados:
[root@xenserv ~]# multipath -ll
[size=1.5T][features=1 queue_if_no_path][hwhandler=1 emc][rw]
\_ round-robin 0 [prio=2][active]
 \_ 1:0:0:1 sdc 8:32  [active][ready]
 \_ 3:0:0:1 sdh 8:112 [active][ready]
\_ round-robin 0 [prio=0][enabled]
 \_ 2:0:0:1 sde 8:64  [active][ready]
 \_ 4:0:0:1 sdi 8:128 [active][ready]
3600601601a4024006a4f2b3c2635e111 dm-3 DGC,VRAID
[size=500G][features=1 queue_if_no_path][hwhandler=1 emc][rw]
\_ round-robin 0 [prio=1][active]
 \_ 2:0:0:2 sdj 8:144 [active][ready]

Si queremos ver con más detalle el estado actual de multipath:
[root@xenserv ~]# multipath -v3

Hay que tener en cuenta que multipath trabaja con los caminos que le sirve open-iscsi, por lo tanto, un reinicio de open-iscsi, afecta al servicio multipath. 
Si queremos logearnos a nuestra cabina de discos por solo un camino:
[root@xenserv ~]# iscsiadm -m node -l
Por ejemplo:
iscsiadm --mode node --targetname iqn.cabina... --portal 192.168.1.15 --login

Si por el contrario queremos logearnos en todos los caminos:
[root@xenserv ~]# iscsiadm -m node -L all

Si queremos eliminar caminos de multipath e iscsi, hemos de buscar en el directorio /etc/iscsi/nodes
iqn....com.emc:cx.ckm00103200040.a4
iqn....com.emc:cx.ckm00103200040.b4
iqn....com.emc:cx.ckm00103200040.b5

[root@xenserv ~]# rm -fr iqn....emc:cx.ckm00103200040.b5

Volvemos a logearnos a la cabina:
[root@xenserv ~]# iscsiadm -m node -l

Reinciar open-iscsi
[root@xenserv ~]#/etc/init.d/open-iscsi restart

 Reiniciar multipath
[root@xenserv ~]# /etc/init.d/multipath restart

Si solo queremos probar de quitar un camino unicamente "flush", por ejemplo del multipath sin que sea permanente como en el caso anterior, podemos hacerlo mediante:
[root@xenserv ~]# multipath -f sdm

Si queremos hacer este flush para todos los caminos (OJO que se los pule todos!)
[root@xenserv ~]# multipath -F

miércoles, 29 de febrero de 2012

XenServer - iscsi allocated

Es posible que algún día, veas que tus SR I-SCSI crece el espacio allocated desmesuradamente. Antes de temblar y buscar en google como arreglarlo, es mejor que leas las siguientes líneas ;)

Por ejemplo ponemos que tenemos una LUN de 1TB presentada como el SR principal de nuestro POOL,  de este espacio tienes ya ocupado 500GB en varias máquinas virtuales y ves que tienes "allocated(500GB)". Hasta aquí lo vemos bien, no hay problema. Pero, que pasa si un día ves que tu allocated está en 3TB...

La verdad es que nada :) Lo más seguro es que tengas un sistema de backup que realiza snapshots y la XAPI no se entera que se borran cuando finaliza el proceso de copia.


Tan sencillo como hacer un "rescan" en el SR para que los valores de allocated vuelvan a la normalidad. 


Saludos!

viernes, 4 de noviembre de 2011

Citrix XenServer + FreeNas iscsi múltiples clientes target


¡Que lastima! Dicho por los creadores de FreeNAS, las conexiones de múltiples a un mismo target iSCSI no se pueden realizar por protocolo iSCSI, solamente esta soportado en estos casos usar CIFS o NFS. 

Así que para montar un entorno de Citrix XenServer con varios nodos, hay que usarlo como NFS VHD, que tampoco esta mal, ya que así los VDIs son sparse de modo que el espacio se va asignando según el crecimiento del disco de la máquina virtual.

jueves, 28 de abril de 2011

Citrix XenServer 5.6 FP1 iscsi + multipath

Curiosamente en 4 servidores dentro de un pool, 3 de ellos no eran capaz de logearse contra la cabina mediante el descubrimiento normal del XenCenter/Cli no con los comandos que utilizo para configurar iscsi en el inicio (rc.local):
iscsiadm -m node -L all
iscsiadm -m session --rescan
/etc/init.d/multipathd restart
multipath -v3
/opt/xensource/sm/mpathcount.py
 
El error era que por algún motivo, el wrapper que extrae la info del nombre del iniciador i-scsi del dom0 configurado mediante CLI/XenCenter no generaba el fichero /etc/iscsi/initiatorname.iscsilo creo a mano
InitiatorName=iqn.2011-04.es.name.server:ctrx
InitiatorAlias=server.name.es

Además tampoco cuando activaba el multipath cuando en el XenCenter activaba el multipath. Creo que eso simplemente modifica el enlace simbólico iscsid.conf que por defecto apunta a iscsid-default.conf para que apunte a iscsid-mpath.conf

Como los comandos de iscsiadm consultan el daemon hay que reiniciarlo
service open-iscsi restart

Una vez hechas estas modificaciones he lanzado un descubrimiento con el máximo debug:

iscsiadm -m discovery -t st -p 192.168.1xx.xxx -d 8

Y a partir de aquí todos los comandos de iscsiadm han funcionado bien.

miércoles, 4 de agosto de 2010

Powermt Management

Un pequeño script para escanear las HBAs y descubir los targets que hay asignados

lun_scan.sh



#!/bin/sh
#
#/*******************************************************************
# * This file is part of the Emulex Linux Device Driver for *
# * Fibre Channel Host Bus Adapters. *
# * Copyright (C) 2003-2005 Emulex. All rights reserved. *
# * EMULEX and SLI are trademarks of Emulex. *
# * www.emulex.com *
# * *
# * This program is free software; you can redistribute it and/or *
# * modify it under the terms of version 2 of the GNU General *
# * Public License as published by the Free Software Foundation. *
# * This program is distributed in the hope that it will be useful. *
# * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
# * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
# * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
# * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
# * TO BE LEGALLY INVALID. See the GNU General Public License for *
# * more details, a copy of which can be found in the file COPYING *
# * included with this package. *
# *******************************************************************/
#
# scripts/lun_scan Rev : 1.2
# This script is provided by Emulex to use with its 7.x and 8.x linux device
# drivers for Light Pulse Fibre Channel adapters.
#
# This script performs a scan on either specific lpfc HBAs or on all
# lpfc HBAs. When scanning an HBA, all discovered targets, and all
# luns will be probed.
#
#
# USAGE: The script is invoked with at least 1 argument. The arguments
# specify either the SCSI Host numbers corresponding to the specific
# lpfc HBA that are to be scanned, or the keyword "all" which indicates
# that all lpfc HBAs are to be scanned.
#

VERSION="1.2"
OS_REV=`uname -r | cut -c1-3`

usage()
{
echo ""
echo "Usage: lun_scan [ <#> [<#>] | all ]"
echo " where "
echo " <#> : is a scsi host number of a specific lpfc HBA that is to"
echo " be scanned. More than 1 host number can be specified. "
echo " all : indicates that all lpfc HBAs are to be scanned."
echo ""
echo " Example:"
echo " lun_scan all : Scans all lpfc HBAs"
echo " lun_scan 2 : Scans the lpfc HBA with scsi host number 2"
echo " lun_scan 2 4 : Scans the lpfc HBAs with scsi host number 2 and 4"
echo ""
echo " Warning: Scanning an adapter while performing a tape backup should"
echo " be avoided."
echo ""
}

abort_exit() {
echo ""
echo "Error: Cannot find an lpfc HBA instance with scsi host number : $host"
echo "... Aborting lun_scan."
echo ""
exit 2
}

# Validate argument list
if [ $# -eq 0 -o "$1" = "--help" -o "$1" = "-h" ] ; then
usage
exit 1
fi

# Get list of lpfc HBAs to scan
hosts=$*;

if [ ${OS_REV} = 2.4 ]; then
lowhost=0
ha=`ls /proc/scsi/lpfc/? 2> /dev/null | cut -f5 -d'/'`
hb=`ls /proc/scsi/lpfc/?? 2> /dev/null | cut -f5 -d'/'`
hc=`ls /proc/scsi/lpfc/??? 2> /dev/null | cut -f5 -d'/'`
all_hosts="$ha $hb $hc"
lowhost=`echo $all_hosts | sed "s/ .*//"`
else
all_hosts=`ls -1 -d /sys/bus/pci/drivers/lpfc/*/host* | sed -e "s/.*host//"`
fi

# If all option is used get all the lpfc host numbers.
if [ "$hosts" == "all" ] ; then
hosts="$all_hosts"
fi

if [ ${OS_REV} = 2.4 ]; then

for host in $hosts ; do
# Convert host number to lpfc instance number.
instance=`expr $host - $lowhost`

if [ ! -e /proc/scsi/lpfc/$host ] ; then
abort_exit
fi

echo Scanning lpfc$instance, scsi host number : $host;

max_lun=256

targets=`cat /proc/scsi/lpfc/$host | grep 'lpfc*t*' | cut -f2 -d't' | cut -f1 -d' '`

for target in $targets ; do
# Convert target ID to decimal from Hex format
let "dec_target = 0x$target"
echo " Scanning Target Id $dec_target..."
for ((lun=0; lun<$max_lun; lun++)) ; do echo "scsi add-single-device $host 0 $dec_target $lun" >/proc/scsi/scsi
done
done
done

else

for host in $hosts ; do
if [ ! -e /sys/bus/pci/drivers/lpfc/*/host$host ] ; then
abort_exit
fi

echo Scanning lpfc HBA instance with scsi host number : $host;
echo '- - -' > /sys/class/scsi_host/host$host/scan
done

fi

echo ""
Ejecutamos el script:
lun_scan.sh all

Hacemos que powermt vea la nueva lun

powermt check
powermt config
powermt save

Mostramos lo que ve powermt
powermt display dev=all