mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
Merge scstadmin from trunk. Hence add support for saving and restoring the ALUA state, unify the qla2x00t/iSCSI-SCST and SCST init scripts, compute the SCST handler kernel module list from /etc/scst.conf and add man pages for scstadmin, /etc/scst.conf and /etc/default/scst. (svn merge -r3389:3982 https://scst.svn.sourceforge.net/svnroot/scst/trunk/scstadmin/Makefile Makefile)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.0.x@3983 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1,6 +1,31 @@
|
||||
SCSTADMIN_DIR = scstadmin
|
||||
|
||||
INITDIR := $(PREFIX)/etc/init.d
|
||||
MANDIR := $(DESTDIR)/usr/local/man
|
||||
INITDIR := $(shell if [ -f /etc/slackware-version ]; then \
|
||||
echo /etc/rc.d; \
|
||||
else \
|
||||
echo /etc/init.d; \
|
||||
fi)
|
||||
INSTALL_INITD_CMD := $(shell if [ -f /etc/gentoo-release ]; then \
|
||||
echo rc-update add; \
|
||||
elif [ -f /etc/slackware-version ]; then \
|
||||
echo none; \
|
||||
else \
|
||||
echo /usr/lib/lsb/install_initd; \
|
||||
fi)
|
||||
INSTALL_INITD_ARGS := $(shell [ -f /etc/gentoo-release ] && echo default)
|
||||
REMOVE_INITD_CMD := $(shell if [ -f /etc/gentoo-release ]; then \
|
||||
echo rc-update del; \
|
||||
elif [ -f /etc/slackware-version ]; then \
|
||||
echo none; \
|
||||
else \
|
||||
echo /usr/lib/lsb/remove_initd; \
|
||||
fi)
|
||||
DEFAULTDIR := $(shell if [ -f /etc/gentoo-release ]; then \
|
||||
echo /etc/conf.d; \
|
||||
else \
|
||||
echo /etc/default; \
|
||||
fi)
|
||||
|
||||
all:
|
||||
cd $(SCSTADMIN_DIR) && $(MAKE) $@
|
||||
@@ -9,20 +34,62 @@ install:
|
||||
@if ! perl -MExtUtils::MakeMaker -e '' >/dev/null 2>&1; then \
|
||||
echo Error: the Perl module ExtUtils::MakeMaker must be installed \
|
||||
first; false; fi
|
||||
@if [ ! -e /usr/lib/lsb/install_initd ]; then \
|
||||
echo Error: the lsb-core package must be installed first; false; fi
|
||||
@if [ ! -e /etc/slackware-version -a ! -e /etc/gentoo-release \
|
||||
-a ! -e /lib/lsb/init-functions ]; then \
|
||||
echo "Error: the lsb-core (Debian, Ubuntu), redhat-lsb (RHEL, CentOS,"\
|
||||
"Scientific Linux, Fedora) or insserv (SLES, openSUSE) package must" \
|
||||
"be installed first"; false; fi
|
||||
cd $(SCSTADMIN_DIR) && $(MAKE) $@
|
||||
-/usr/lib/lsb/install_initd scst
|
||||
-/usr/lib/lsb/install_initd qla2x00t
|
||||
mkdir -m 755 -p $(DESTDIR)$(INITDIR)
|
||||
install -m 755 init.d/scst $(DESTDIR)$(INITDIR)
|
||||
install -m 755 init.d/qla2x00t $(DESTDIR)$(INITDIR)
|
||||
for m in scstadmin/man*/*.[1-9]; do \
|
||||
if [ -e $$m ]; then \
|
||||
d=$(MANDIR)/$$(basename $$(dirname $$m)); \
|
||||
if install -d $$d; then \
|
||||
install -m 644 $$m $$d; \
|
||||
fi \
|
||||
fi \
|
||||
done
|
||||
install -d $(DESTDIR)$(INITDIR)
|
||||
tmp=/tmp/scst-initd-$$$$ && init.d/scst >$$tmp && \
|
||||
install -m 755 $$tmp $(DESTDIR)$(INITDIR)/scst && \
|
||||
rm -f $$tmp
|
||||
if [ ! -e $(DESTDIR)$(DEFAULTDIR)/scst ]; then \
|
||||
install -m 755 default/scst $(DESTDIR)$(DEFAULTDIR); \
|
||||
fi
|
||||
@if [ "$(REMOVE_INITD_CMD)" != "none" ]; then \
|
||||
$(REMOVE_INITD_CMD) iscsi-scst >/dev/null 2>&1; \
|
||||
rm -f $(INITDIR)/iscsi-scst; \
|
||||
$(REMOVE_INITD_CMD) qla2x00t >/dev/null 2>&1; \
|
||||
rm -f $(INITDIR)/qla2x00t; \
|
||||
fi
|
||||
@if [ "$(INSTALL_INITD_CMD)" != "none" ]; then \
|
||||
echo; \
|
||||
echo 'If you want SCST to start automatically at boot time, run' \
|
||||
'the following command:'; \
|
||||
if [ ! -z "$(DESTDIR)" ]; then echo -n "chroot $(DESTDIR) "; fi; \
|
||||
echo '$(INSTALL_INITD_CMD) scst $(INSTALL_INITD_ARGS)'; \
|
||||
echo; \
|
||||
fi
|
||||
|
||||
uninstall:
|
||||
-/usr/lib/lsb/remove_initd qla2x00t
|
||||
-/usr/lib/lsb/remove_initd scst
|
||||
-rm -f $(DESTDIR)$(PATH_INITD)/qla2x00t
|
||||
-rm -f $(DESTDIR)$(PATH_INITD)/scst
|
||||
if [ -e $(DESTDIR)$(DEFAULTDIR)/scst ]; then \
|
||||
mv $(DESTDIR)$(DEFAULTDIR)/scst \
|
||||
$(DESTDIR)$(DEFAULTDIR)/scst.`date +%F,%T`; \
|
||||
fi
|
||||
if [ -e $(DESTDIR)$(INITDIR)/scst -a "$(REMOVE_INITD_CMD)" != "none" ];\
|
||||
then \
|
||||
if [ -z "$(DESTDIR)" ]; then \
|
||||
$(REMOVE_INITD_CMD) scst; \
|
||||
else \
|
||||
chroot $(DESTDIR) $(REMOVE_INITD_CMD) scst; \
|
||||
fi; \
|
||||
rm -f $(DESTDIR)$(INITDIR)/scst; \
|
||||
fi
|
||||
for m in scstadmin/man*/*.[1-9]; do \
|
||||
if [ -e $$m ]; then \
|
||||
d=$(MANDIR)/$$(basename $$(dirname $$m)); \
|
||||
rm -f $$d/$$(basename $$m); \
|
||||
fi \
|
||||
done
|
||||
cd $(SCSTADMIN_DIR) && $(MAKE) $@
|
||||
|
||||
perl-module:
|
||||
|
||||
3
scstadmin/default/scst
Normal file
3
scstadmin/default/scst
Normal file
@@ -0,0 +1,3 @@
|
||||
# When using the procfs interface, specify all SCST target drivers in
|
||||
# SCST_TARGET_MODULES. An example:
|
||||
# SCST_TARGET_MODULES="scst_local iscsi_scst ib_srpt"
|
||||
@@ -35,14 +35,33 @@ HANDLER vcdrom {
|
||||
TARGET_DRIVER scst_local {
|
||||
TARGET scst_local_tgt {
|
||||
session_name scst_local_host
|
||||
session_name scst_local_host1
|
||||
|
||||
LUN 0 disk1
|
||||
LUN 1 disk2
|
||||
}
|
||||
}
|
||||
|
||||
TARGET_DRIVER iscsi {
|
||||
IncomingUser "joe 12charsecret"
|
||||
enabled 1
|
||||
|
||||
TARGET iqn.2006-10.net.vlnb:tgt {
|
||||
IncomingUser "joe 12charsecret"
|
||||
HeaderDigest CRC32C,None
|
||||
enabled 1
|
||||
|
||||
LUN 0 disk1
|
||||
LUN 1 disk2
|
||||
LUN 2 blockio1 {
|
||||
read_only 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TARGET_DRIVER qla2x00t {
|
||||
TARGET 25:00:00:f0:98:87:92:f3 {
|
||||
enabled 1
|
||||
|
||||
GROUP INI1 {
|
||||
LUN 0 blockio1
|
||||
LUN 1 1:0:0:0 {
|
||||
@@ -53,30 +72,68 @@ TARGET_DRIVER qla2x00t {
|
||||
INITIATOR 25:00:00:f0:99:87:94:a3
|
||||
INITIATOR 25:00:00:f0:99:87:94:a4
|
||||
}
|
||||
|
||||
enabled 1
|
||||
}
|
||||
|
||||
TARGET 25:00:00:f0:98:87:92:f4 {
|
||||
}
|
||||
}
|
||||
|
||||
TARGET_DRIVER iscsi {
|
||||
IncomingUser "joe 12charsecret"
|
||||
|
||||
TARGET iqn.2006-10.net.vlnb:tgt {
|
||||
IncomingUser "joe 12charsecret"
|
||||
HeaderDigest CRC32C,None
|
||||
TARGET_DRIVER ib_srpt {
|
||||
TARGET ib_srpt_target_0 {
|
||||
enabled 1
|
||||
|
||||
LUN 0 disk1
|
||||
LUN 1 disk2
|
||||
LUN 2 blockio1 {
|
||||
read_only 1
|
||||
}
|
||||
|
||||
enabled 1
|
||||
}
|
||||
|
||||
enabled 1
|
||||
TARGET ib_srpt_target_1 {
|
||||
enabled 1
|
||||
|
||||
LUN 0 disk1
|
||||
LUN 1 disk2
|
||||
}
|
||||
}
|
||||
|
||||
DEVICE_GROUP dgroup1 {
|
||||
DEVICE disk1
|
||||
|
||||
TARGET_GROUP tgroup1 {
|
||||
group_id 1
|
||||
state active
|
||||
|
||||
TARGET ib_srpt_target_0 {
|
||||
rel_tgt_id 1
|
||||
}
|
||||
}
|
||||
|
||||
TARGET_GROUP tgroup2 {
|
||||
group_id 2
|
||||
state offline
|
||||
|
||||
TARGET ib_srpt_target_1 {
|
||||
rel_tgt_id 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEVICE_GROUP dgroup2 {
|
||||
DEVICE disk2
|
||||
|
||||
TARGET_GROUP tgroup1 {
|
||||
group_id 1
|
||||
state offline
|
||||
|
||||
TARGET ib_srpt_target_0 {
|
||||
rel_tgt_id 1
|
||||
}
|
||||
}
|
||||
|
||||
TARGET_GROUP tgroup2 {
|
||||
group_id 2
|
||||
state active
|
||||
|
||||
TARGET ib_srpt_target_1 {
|
||||
rel_tgt_id 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
These init scripts are intended for use with non-iscsi configurations. For
|
||||
iscsi, please use one of the init scripts found in iscsi-scst/etc/initd.
|
||||
@@ -1,122 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2008 Mark Buechler <mark.buechler@gmail.com>
|
||||
# Copyright (C) 2009 Bart Van Assche <bvanassche@acm.org>
|
||||
# This software is made available under the GPLv2 license.
|
||||
#
|
||||
# System startup script for the QLogic 22xx/23xx card target driver.
|
||||
#
|
||||
# Note: on most Linux distributions /bin/sh is a soft link to /bin/bash, while
|
||||
# on a default Ubuntu setup /bin/sh is a soft link to /bin/dash !
|
||||
#
|
||||
# See also:
|
||||
# * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
|
||||
# * http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: qla2x00t
|
||||
# Required-Start: $syslog $local_fs scst
|
||||
# Required-Stop: $syslog $local_fs scst
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: QLogic 22xx/23xx card target driver
|
||||
### END INIT INFO
|
||||
### BEGIN CHKCONFIG INFO
|
||||
# chkconfig: 2345 14 86
|
||||
# description: QLogic 22xx/23xx card target driver
|
||||
### END CHKCONFIG IFO
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
|
||||
|
||||
# Modules to load/unload.
|
||||
KERNEL_MODULES="qla2x00tgt"
|
||||
|
||||
# Return values according to LSB for all commands but status:
|
||||
# 0 - success
|
||||
# 1 - generic or unspecified error
|
||||
# 2 - invalid or excess argument(s)
|
||||
# 3 - unimplemented feature (e.g. "reload")
|
||||
# 4 - insufficient privilege
|
||||
# 5 - program is not installed
|
||||
# 6 - program is not configured
|
||||
# 7 - program is not running
|
||||
#
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
## Start the service.
|
||||
echo -n "Loading and configuring the QLogic target driver"
|
||||
|
||||
for module in ${KERNEL_MODULES}; do
|
||||
if ! modprobe "${module}"; then
|
||||
log_failure_msg
|
||||
exit 5
|
||||
fi
|
||||
done
|
||||
;;
|
||||
stop)
|
||||
## Stop the service.
|
||||
echo -n "Stopping the QLogic target driver"
|
||||
|
||||
reverse_list=""
|
||||
for module in ${KERNEL_MODULES}; do
|
||||
reverse_list="${module} ${reverse_list}"
|
||||
done
|
||||
for module in ${reverse_list}; do
|
||||
if [ -e "/sys/module/${module}" ] && ! rmmod "${module}"; then
|
||||
log_failure_msg FAILED
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
log_success_msg
|
||||
;;
|
||||
restart)
|
||||
## Stop and restart the service if the service is already running,
|
||||
## otherwise start the service.
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
try-restart)
|
||||
## Restart the service if the service is already running.
|
||||
$0 status >/dev/null && $0 restart
|
||||
;;
|
||||
reload)
|
||||
## Cause the configuration of the service to be reloaded without
|
||||
## actually stopping and restarting the service.
|
||||
echo -n "Reloading QLogic target driver configuration"
|
||||
log_success_msg
|
||||
;;
|
||||
force-reload)
|
||||
## Cause the configuration to be reloaded if the service supports this,
|
||||
## otherwise restart the service if it is running.
|
||||
echo -n "Reloading QLogic target driver configuration"
|
||||
log_success_msg
|
||||
;;
|
||||
status)
|
||||
## Print the current status of the service.
|
||||
echo -n "QLogic target driver status: "
|
||||
|
||||
# Status has a slightly different meaning for the status command:
|
||||
# 0 - service running
|
||||
# 1 - service dead, but /var/run/ pid file exists
|
||||
# 2 - service dead, but /var/lock/ lock file exists
|
||||
# 3 - service not running
|
||||
|
||||
for module in ${KERNEL_MODULES}; do
|
||||
if [ ! -e "/sys/module/${module}" ]; then
|
||||
echo "Not loaded"
|
||||
exit 3
|
||||
fi
|
||||
done
|
||||
echo "OK"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,104 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
#
|
||||
# Copyright (C) 2008 Mark Buechler <mark.buechler@gmail.com>
|
||||
# Copyright (C) 2009 Bart Van Assche <bvanassche@acm.org>
|
||||
# Copyright (C) 2010 Scott Bowe <scottb@sentania.net>
|
||||
# This software is made available under the GPLv2 license.
|
||||
#
|
||||
# System startup script for the QLogic 22xx/23xx card target driver.
|
||||
#
|
||||
# Customized for Gentoo Linux by Scott Bowe
|
||||
#
|
||||
# Note: on most Linux distributions /bin/sh is a soft link to /bin/bash, while
|
||||
# on a default Ubuntu setup /bin/sh is a soft link to /bin/dash !
|
||||
#
|
||||
|
||||
opts="${opts} try-restart "
|
||||
depend() {
|
||||
use logger localmount
|
||||
before scst
|
||||
}
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
|
||||
|
||||
# Modules to load/unload.
|
||||
KERNEL_MODULES="qla2x00tgt"
|
||||
MODPROBE="/sbin/modprobe"
|
||||
RMMOD="/sbin/rmmod"
|
||||
|
||||
# Return values according to LSB for all commands but status:
|
||||
# 0 - success
|
||||
# 1 - generic or unspecified error
|
||||
# 2 - invalid or excess argument(s)
|
||||
# 3 - unimplemented feature (e.g. "reload")
|
||||
# 4 - insufficient privilege
|
||||
# 5 - program is not installed
|
||||
# 6 - program is not configured
|
||||
# 7 - program is not running
|
||||
#
|
||||
start(){
|
||||
## Start the service.
|
||||
ebegin "Loading and configuring the QLogic target driver"
|
||||
eindent
|
||||
ret=0
|
||||
for module in ${KERNEL_MODULES}; do
|
||||
einfo "Loading ${module}"
|
||||
if ! modprobe "${module}"; then
|
||||
ret=5
|
||||
eend $ret "Failed to load target driver"
|
||||
return $ret
|
||||
fi
|
||||
done
|
||||
einfo "Qlogic target driver loaded!!!"
|
||||
eend $?
|
||||
return $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
## Stop the service.
|
||||
ebegin "Stopping the QLogic target driver"
|
||||
eindent
|
||||
reverse_list=""
|
||||
for module in ${KERNEL_MODULES}; do
|
||||
reverse_list="${module} ${reverse_list}"
|
||||
done
|
||||
for module in ${reverse_list}; do
|
||||
einfo "Unloading module"
|
||||
if [ -e "/sys/module/${module}" ] && ! rmmod "${module}"; then
|
||||
$eend $? "Failed to unload the target driver"
|
||||
return $?
|
||||
fi
|
||||
done
|
||||
einfo "Qlogic target driver unloaded!!!"
|
||||
eend $?
|
||||
return $?
|
||||
}
|
||||
|
||||
restart() {
|
||||
## Stop and restart the service if the service is already running,
|
||||
## otherwise start the service.
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
try-restart() {
|
||||
## Restart the service if the service is already running.
|
||||
status >/dev/null 2>&1 && restart
|
||||
}
|
||||
|
||||
status() {
|
||||
einfo "Qlogic target status: "
|
||||
eindent
|
||||
|
||||
for module in ${SCST_MODULES}; do
|
||||
if [ ! -e "/sys/module/${module}" ]; then
|
||||
einfo "${module} not loaded"
|
||||
ret=3
|
||||
eend $ret
|
||||
return $ret
|
||||
fi
|
||||
done
|
||||
ret=0
|
||||
ebegin "Qlogic target loaded OK"
|
||||
eend $ret
|
||||
return $ret
|
||||
}
|
||||
@@ -1,43 +1,46 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# A script that generates the /etc/init.d/scst script. On systems that support
|
||||
# the LSB an LSB compliant init script is generated. On Gentoo systems a Gentoo
|
||||
# init script is generated. And on Slackware the LSB init script is used with
|
||||
# replacements for the used LSB functions.
|
||||
|
||||
if [ -e /etc/gentoo-release ]; then
|
||||
echo "#!/sbin/runscript"
|
||||
else
|
||||
echo "#!/bin/sh"
|
||||
fi
|
||||
|
||||
cat <<"EOF"
|
||||
#
|
||||
# Copyright (C) 2008 Mark Buechler <mark.buechler@gmail.com>
|
||||
# Copyright (C) 2009 Bart Van Assche <bvanassche@acm.org>
|
||||
# Copyright (C) 2009-2011 Bart Van Assche <bvanassche@acm.org>
|
||||
# This software is made available under the GPLv2 license.
|
||||
#
|
||||
# System startup script for the SCST core functionality.
|
||||
#
|
||||
# Note: on most Linux distributions /bin/sh is a soft link to /bin/bash, while
|
||||
# on a default Ubuntu setup /bin/sh is a soft link to /bin/dash !
|
||||
# System startup script for SCST.
|
||||
#
|
||||
# See also:
|
||||
# * http://refspecs.freestandards.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
|
||||
# * http://refspecs.freestandards.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
|
||||
# * http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
|
||||
#
|
||||
EOF
|
||||
|
||||
if [ ! -e /etc/gentoo-release ]; then
|
||||
cat <<"EOF"
|
||||
### BEGIN INIT INFO
|
||||
# Provides: scst
|
||||
# Required-Start: $syslog $local_fs
|
||||
# Required-Stop: $syslog $local_fs
|
||||
# Required-Start: $syslog $local_fs $network
|
||||
# Required-Stop: $syslog $local_fs $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: SCST core
|
||||
# Description: SCST - A Generic SCSI Target Subsystem
|
||||
### END INIT INFO
|
||||
### BEGIN CHKCONFIG INFO
|
||||
# chkconfig: 2345 13 87
|
||||
# description: SCST core
|
||||
### END CHKCONFIG IFO
|
||||
# description: SCST - A Generic SCSI Target Subsystem
|
||||
### END CHKCONFIG INFO
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
|
||||
SCST_CFG=/etc/scst.conf
|
||||
|
||||
# Modules to load/unload.
|
||||
#
|
||||
# !!! DON'T ADD HERE TARGET DRIVERS, WHICH IMMEDIATELLY START ACCEPTING
|
||||
# !!! NEW CONNECTIONS, BECAUSE AT THIS POINT ACCESS CONTROL HASN'T CONFIGURED
|
||||
# !!! YET!
|
||||
#
|
||||
SCST_MODULES="scst scst_disk scst_vdisk"
|
||||
|
||||
# Return values according to LSB for all commands but status:
|
||||
# Return values according to LSB for all commands except status:
|
||||
# 0 - success
|
||||
# 1 - generic or unspecified error
|
||||
# 2 - invalid or excess argument(s)
|
||||
@@ -48,99 +51,276 @@ SCST_MODULES="scst scst_disk scst_vdisk"
|
||||
# 7 - program is not running
|
||||
#
|
||||
|
||||
if [ -e /lib/lsb/init-functions ]; then
|
||||
# Debian, RHEL / Fedora, SLES / openSUSE.
|
||||
. /lib/lsb/init-functions
|
||||
else
|
||||
# Slackware.
|
||||
log_success_msg() {
|
||||
echo "$@"
|
||||
}
|
||||
log_failure_msg() {
|
||||
echo "$@"
|
||||
}
|
||||
fi
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
|
||||
SCST_DFLT=/etc/default/scst
|
||||
|
||||
[ -x "$(which scstadmin)" ] || exit 5
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
if [ -f $SCST_DFLT ]; then
|
||||
. $SCST_DFLT
|
||||
fi
|
||||
EOF
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
## Start the service.
|
||||
echo -n "Loading and configuring the mid-level SCSI target SCST"
|
||||
cat <<"EOF"
|
||||
|
||||
for module in ${SCST_MODULES}; do
|
||||
if ! modprobe "${module}"; then
|
||||
log_failure_msg
|
||||
exit 5
|
||||
SCST_CFG=/etc/scst.conf
|
||||
|
||||
if [ ! -e /lib/lsb/init-functions ]; then
|
||||
# Slackware / Gentoo.
|
||||
start_daemon() {
|
||||
"$@" >/dev/null 2>&1 &
|
||||
}
|
||||
killproc() {
|
||||
local exe="`basename "$1"`"
|
||||
killall $exe
|
||||
rm -f "/var/run/$exe.pid"
|
||||
}
|
||||
fi
|
||||
|
||||
# Whether or not there is a "TARGET_DRIVER iscsi" section in scst.conf.
|
||||
using_iscsi() {
|
||||
for m in $SCST_MODULES; do
|
||||
if [ $m = "iscsi_scst" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# Parse scst.conf and assign the list of associated kernel modules to
|
||||
# SCST_MODULES.
|
||||
parse_scst_conf() {
|
||||
SCST_MODULES="scst"
|
||||
SCST_OPT_MODULES=""
|
||||
SCST_DAEMONS=""
|
||||
if [ ! -e $SCST_CFG ]; then
|
||||
return 0
|
||||
fi
|
||||
local nonblanks="[^ ]\{1,\}"
|
||||
local blanks="[ ]\{1,\}"
|
||||
SCST_MODULES="$SCST_MODULES `sed -n -e 's/^HANDLER'"$blanks"'\('"$nonblanks"'\)'"$blanks"'{$/\1/p' \
|
||||
-e 's/^\[HANDLER'"$blanks"'\('"$nonblanks"'\)\]$/\1/p' $SCST_CFG \
|
||||
| while read h; do
|
||||
case "$h" in
|
||||
dev_cdrom) echo scst_cdrom;;
|
||||
dev_changer) echo scst_changer;;
|
||||
dev_disk*) echo scst_disk;;
|
||||
dev_modisk*) echo scst_modisk;;
|
||||
dev_processor) echo scst_processor;;
|
||||
dev_raid) echo scst_raid;;
|
||||
dev_tape*) echo scst_tape;;
|
||||
dev_user) echo scst_user;;
|
||||
vdisk*|vcdrom) echo scst_vdisk;;
|
||||
*) echo "$h";;
|
||||
esac
|
||||
done | sort -u` \
|
||||
`sed -n 's/^TARGET_DRIVER'"$blanks"'\('"$nonblanks"'\)'"$blanks"'{$/\1/p' $SCST_CFG | while read d; do
|
||||
case "$d" in
|
||||
iscsi) echo iscsi_scst;;
|
||||
qla2x00t) echo qla2x00tgt;;
|
||||
*) echo "$d";;
|
||||
esac
|
||||
done | sort -u` \
|
||||
$SCST_TARGET_MODULES"
|
||||
if using_iscsi; then
|
||||
case "`uname -m`" in
|
||||
x86_64|i686)
|
||||
SCST_OPT_MODULES="crc32c-intel $SCST_OPT_MODULES";;
|
||||
esac
|
||||
SCST_OPT_MODULES="crc32c $SCST_OPT_MODULES"
|
||||
SCST_DAEMONS="/usr/local/sbin/iscsi-scstd $SCST_DAEMONS"
|
||||
fi
|
||||
}
|
||||
|
||||
# Unload SCST. parse_scst_conf must already have been invoked.
|
||||
unload_scst() {
|
||||
for d in $SCST_DAEMONS; do
|
||||
killproc $d
|
||||
done
|
||||
|
||||
reverse_list=""
|
||||
for m in $SCST_MODULES; do
|
||||
reverse_list="$m $reverse_list"
|
||||
done
|
||||
for m in $reverse_list; do
|
||||
refcnt="`cat /sys/module/$m/refcnt 2>/dev/null`"
|
||||
if [ ! -z "$refcnt" ] && [ "$refcnt" -gt 0 ]; then
|
||||
# Apparently it can happen that the iscsi_scst refcnt is only
|
||||
# decremented a short time after killproc finished. If that
|
||||
# occurs, sleep for a short time.
|
||||
sleep 1
|
||||
fi
|
||||
if [ -e /sys/module/$m/refcnt ] && ! rmmod $m; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
for m in $SCST_OPT_MODULES; do
|
||||
reverse_list="$m $reverse_list"
|
||||
done
|
||||
for m in $reverse_list; do
|
||||
rmmod $m >/dev/null 2>&1
|
||||
done
|
||||
|
||||
# Clear the config in case unloading failed or SCST has been built into the
|
||||
# kernel
|
||||
if [ -e /sys/module/scst ]; then
|
||||
scstadmin -noprompt -force -clear_config >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
start_scst() {
|
||||
if [ -e /sys/module/scst -a -e /sys/module/scst/refcnt ]; then
|
||||
echo Already started
|
||||
return 1
|
||||
fi
|
||||
|
||||
parse_scst_conf
|
||||
|
||||
for m in $SCST_OPT_MODULES; do
|
||||
modprobe $m >/dev/null 2>&1
|
||||
done
|
||||
|
||||
for m in $SCST_MODULES; do
|
||||
if [ ! -e /sys/module/$m ]; then
|
||||
if ! modprobe $m; then
|
||||
echo modprobe $m failed.
|
||||
unload_scst
|
||||
return 5
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
for d in $SCST_DAEMONS; do
|
||||
if ! start_daemon $d; then
|
||||
echo "Starting $d failed"
|
||||
unload_scst
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -f $SCST_CFG ]; then
|
||||
if scstadmin -config $SCST_CFG >/dev/null 2>&1; then
|
||||
log_success_msg
|
||||
scstadmin -force -noprompt -clear_config >/dev/null 2>&1
|
||||
tmpout=/tmp/scstadmin-output-$$
|
||||
if scstadmin -config $SCST_CFG >$tmpout 2>&1; then
|
||||
rm -f $tmpout
|
||||
return 0
|
||||
else
|
||||
log_failure_msg
|
||||
exit 1
|
||||
cat $tmpout
|
||||
rm -f $tmpout
|
||||
unload_scst
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
log_success_msg
|
||||
echo "SCST configuration file $SCST_CFG missing"
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
## Stop the service.
|
||||
echo -n "Stopping the mid-level SCSI target SCST"
|
||||
}
|
||||
|
||||
reverse_list=""
|
||||
for module in ${SCST_MODULES}; do
|
||||
reverse_list="${module} ${reverse_list}"
|
||||
done
|
||||
for module in ${reverse_list}; do
|
||||
if [ -e "/sys/module/${module}" ] && ! rmmod "${module}"; then
|
||||
log_failure_msg FAILED
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
log_success_msg
|
||||
;;
|
||||
restart)
|
||||
## Stop and restart the service if the service is already running,
|
||||
## otherwise start the service.
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
try-restart)
|
||||
## Restart the service if the service is already running.
|
||||
$0 status >/dev/null 2>&1 && $0 restart
|
||||
;;
|
||||
reload)
|
||||
## Cause the configuration of the service to be reloaded without
|
||||
## actually stopping and restarting the service.
|
||||
echo -n "Reloading SCST configuration"
|
||||
if scstadmin -config $SCST_CFG >/dev/null 2>&1; then
|
||||
log_success_msg
|
||||
else
|
||||
log_failure_msg
|
||||
exit 1
|
||||
stop_scst() {
|
||||
if ! parse_scst_conf; then
|
||||
return 1
|
||||
fi
|
||||
;;
|
||||
force-reload)
|
||||
## Cause the configuration to be reloaded if the service supports this,
|
||||
## otherwise restart the service if it is running.
|
||||
echo -n "Reloading SCST configuration"
|
||||
if scstadmin -config $SCST_CFG >/dev/null 2>&1; then
|
||||
log_success_msg
|
||||
else
|
||||
$0 restart
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
## Print the current status of the service.
|
||||
echo -n "SCST status: "
|
||||
|
||||
unload_scst
|
||||
}
|
||||
|
||||
scst_status() {
|
||||
# Status has a slightly different meaning for the status command:
|
||||
# 0 - service running
|
||||
# 1 - service dead, but /var/run/ pid file exists
|
||||
# 2 - service dead, but /var/lock/ lock file exists
|
||||
# 3 - service not running
|
||||
|
||||
for module in ${SCST_MODULES}; do
|
||||
if [ ! -e "/sys/module/${module}" ]; then
|
||||
echo "Not loaded"
|
||||
exit 3
|
||||
parse_scst_conf
|
||||
|
||||
for m in $SCST_MODULES; do
|
||||
if [ ! -e /sys/module/$m ]; then
|
||||
echo "$m: not loaded"
|
||||
return 3
|
||||
fi
|
||||
done
|
||||
echo "OK"
|
||||
return 0
|
||||
}
|
||||
|
||||
EOF
|
||||
|
||||
if [ ! -e /etc/gentoo-release ]; then
|
||||
cat <<"EOF"
|
||||
rc=0
|
||||
case "$1" in
|
||||
start)
|
||||
## Start the service.
|
||||
echo -n "Loading and configuring SCST"
|
||||
start_scst
|
||||
rc=$?
|
||||
;;
|
||||
stop)
|
||||
## Stop the service.
|
||||
echo -n "Stopping SCST"
|
||||
stop_scst
|
||||
rc=$?
|
||||
;;
|
||||
restart)
|
||||
## Stop and restart the service if the service is already running,
|
||||
## otherwise start the service.
|
||||
echo -n "Restarting SCST"
|
||||
stop_scst && start_scst
|
||||
rc=$?
|
||||
;;
|
||||
try-restart)
|
||||
## Restart the service if the service is already running.
|
||||
echo -n "Trying to restart SCST"
|
||||
scst_status >/dev/null 2>&1 && stop_scst && start_scst
|
||||
rc=$?
|
||||
;;
|
||||
reload)
|
||||
## Cause the configuration of the service to be reloaded without
|
||||
## actually stopping and restarting the service.
|
||||
echo -n "Reloading SCST configuration"
|
||||
if scstadmin -config $SCST_CFG >/dev/null 2>&1; then
|
||||
rc=0
|
||||
else
|
||||
rc=1
|
||||
fi
|
||||
;;
|
||||
force-reload)
|
||||
## Cause the configuration to be reloaded if the service supports this,
|
||||
## otherwise restart the service if it is running.
|
||||
echo -n "Reloading SCST configuration"
|
||||
if scstadmin -config $SCST_CFG >/dev/null 2>&1; then
|
||||
rc=0
|
||||
else
|
||||
stop_scst && start_scst
|
||||
rc=$?
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
## Print the current status of the service.
|
||||
echo -n "SCST status: "
|
||||
scst_status
|
||||
rc=$?
|
||||
if [ $rc = 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "Not running"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
|
||||
@@ -148,4 +328,35 @@ case "$1" in
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
if [ $rc = 0 ]; then
|
||||
log_success_msg
|
||||
else
|
||||
log_failure_msg
|
||||
fi
|
||||
|
||||
exit $rc
|
||||
EOF
|
||||
else
|
||||
cat <<"EOF"
|
||||
depend() {
|
||||
need localmount
|
||||
need net
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
true
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting SCST"
|
||||
start_scst
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping SCST"
|
||||
stop_scst
|
||||
eend $?
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
#!/sbin/runscript
|
||||
#
|
||||
# Copyright (C) 2008 Mark Buechler <mark.buechler@gmail.com>
|
||||
# Copyright (C) 2009 Bart Van Assche <bvanassche@acm.org>
|
||||
# Copyright (C) 2010 Scott Bowe <scottb@sentania.net>
|
||||
# This software is made available under the GPLv2 license.
|
||||
#
|
||||
# System startup script for the SCST core functionality.
|
||||
#
|
||||
# Customized for gentoo linux by Scott Bowe.
|
||||
#
|
||||
# Note: on most Linux distributions /bin/sh is a soft link to /bin/bash, while
|
||||
# on a default Ubuntu setup /bin/sh is a soft link to /bin/dash !
|
||||
|
||||
opts="${opts} try-restart reload force-reload"
|
||||
depend() {
|
||||
use logger
|
||||
}
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin
|
||||
|
||||
DEFAULTFILE="/etc/conf.d/scst"
|
||||
SCST_CFG=/etc/scst.conf
|
||||
MODPROBE="/sbin/modprobe"
|
||||
RMMOD="/sbin/rmmod"
|
||||
|
||||
if [ -f $DEFAULTFILE ]; then
|
||||
. $DEFAULTFILE
|
||||
fi
|
||||
|
||||
# Modules to load/unload.
|
||||
#
|
||||
# !!! DON'T ADD HERE TARGET DRIVERS, WHICH IMMEDIATELLY START ACCEPTING
|
||||
# !!! NEW CONNECTIONS, BECAUSE AT THIS POINT ACCESS CONTROL HASN'T CONFIGURED
|
||||
# !!! YET!
|
||||
#
|
||||
SCST_MODULES="scst scst_disk scst_vdisk"
|
||||
|
||||
# Return values according to LSB for all commands but status:
|
||||
# 0 - success
|
||||
# 1 - generic or unspecified error
|
||||
# 2 - invalid or excess argument(s)
|
||||
# 3 - unimplemented feature (e.g. "reload")
|
||||
# 4 - insufficient privilege
|
||||
# 5 - program is not installed
|
||||
# 6 - program is not configured
|
||||
# 7 - program is not running
|
||||
#
|
||||
|
||||
checkconfig() {
|
||||
if [ ! -f $SCST_CFG ] ; then
|
||||
eerror "Please create $SCST_CFG"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
checkinstall() {
|
||||
if [ ! -x `which scstadmin` ] ; then
|
||||
eerror "scstadmin is not intalled"
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Loading and configuring the mid-level SCSI target SCST"
|
||||
eindent
|
||||
checkconfig
|
||||
checkinstall || return $?
|
||||
ret=0
|
||||
for module in ${SCST_MODULES}; do
|
||||
einfo "Loading SCST module ${module}..."
|
||||
if ! modprobe "${module}"; then
|
||||
eerror "${module} failed to load"
|
||||
eend $? "Failed to load SCST"
|
||||
return $?
|
||||
fi
|
||||
done
|
||||
einfo "Configuring SCST..."
|
||||
eindent
|
||||
if [ -f $SCST_CFG ]; then
|
||||
if scstadmin -config $SCST_CFG >/dev/null 2>&1; then
|
||||
einfo "SCST config was loaded"
|
||||
else
|
||||
eend $? "SCST config could not be loaded"
|
||||
return $?
|
||||
fi
|
||||
else
|
||||
einfo "SCST configuration file $SCST_CFG missing, skipping"
|
||||
return 0
|
||||
fi
|
||||
eoutdent
|
||||
eoutdent
|
||||
einfo "SCST loaded!!!"
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
## Stop the service.
|
||||
ebegin "Stopping the mid-level SCSI target SCST"
|
||||
eindent
|
||||
reverse_list=""
|
||||
for module in ${SCST_MODULES}; do
|
||||
reverse_list="${module} ${reverse_list}"
|
||||
done
|
||||
for module in ${reverse_list}; do
|
||||
einfo "Unloading ${module}"
|
||||
if [ -e "/sys/module/${module}" ] && ! rmmod "${module}"; then
|
||||
eindent
|
||||
eend $? "Failed to unload ${module}"
|
||||
return $?
|
||||
fi
|
||||
done
|
||||
eoutdent
|
||||
einfo "SCST unloaded!!!"
|
||||
eend $?
|
||||
}
|
||||
|
||||
restart() {
|
||||
## Stop and restart the service if the service is already running,
|
||||
## otherwise start the service.
|
||||
stop
|
||||
sleep 3
|
||||
start
|
||||
}
|
||||
|
||||
try-restart() {
|
||||
## Restart the service if the service is already running.
|
||||
status >/dev/null 2>&1 && restart
|
||||
}
|
||||
|
||||
reload() {
|
||||
## Cause the configuration of the service to be reloaded without
|
||||
## actually stopping and restarting the service.
|
||||
einfo "Reloading SCST configuration"
|
||||
eindent
|
||||
if scstadmin -config $SCST_CFG >/dev/null 2>&1; then
|
||||
ret=0
|
||||
ebegin "SCST config reloaded"
|
||||
else
|
||||
eend $? "SCST config could not be releaded"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
force-reload() {
|
||||
## Cause the configuration to be reloaded if the service supports this,
|
||||
## otherwise restart the service if it is running.
|
||||
einfo "Reloading SCST configuration"
|
||||
eindent
|
||||
if scstadmin -config $SCST_CFG >/dev/null 2>&1; then
|
||||
ret=0
|
||||
ebegin "SCST config reloaded"
|
||||
else
|
||||
restart
|
||||
fi
|
||||
}
|
||||
|
||||
status() {
|
||||
## Print the current status of the service.
|
||||
einfo "SCST status: "
|
||||
eindent
|
||||
|
||||
for module in ${SCST_MODULES}; do
|
||||
if [ ! -e "/sys/module/${module}" ]; then
|
||||
einfo "${module} not loaded"
|
||||
ret=3
|
||||
eend $ret
|
||||
return $ret
|
||||
fi
|
||||
done
|
||||
ret=0
|
||||
ebegin "SCST modules loaded OK"
|
||||
eend $ret
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
MODULE_VERSION = 0.9.00
|
||||
MODULE_VERSION = 0.9.10
|
||||
TOOL = scstadmin
|
||||
|
||||
SBINDIR := $(PREFIX)/usr/local/sbin
|
||||
SBINDIR := /usr/local/sbin
|
||||
|
||||
all: perl-module
|
||||
|
||||
|
||||
292
scstadmin/scstadmin.sysfs/man1/scstadmin.1
Normal file
292
scstadmin/scstadmin.sysfs/man1/scstadmin.1
Normal file
@@ -0,0 +1,292 @@
|
||||
.\" -*- nroff -*-
|
||||
.\" Copyright 2011 Bart Van Assche <bvanassche@acm.org>. All rights reserved.
|
||||
.\" Permission is granted to copy, distribute and/or modify this document
|
||||
.\" under the terms of the GNU General Public License, version 2 (GPLv2).
|
||||
.TH scstadmin 1 "July 2011" "scstadmin 2.0.0"
|
||||
.SH NAME
|
||||
scstadmin \- administer the configuration of SCST
|
||||
.SH SYNOPSIS
|
||||
.B scstadmin
|
||||
[<OPTION>]* <COMMAND>
|
||||
.SH DESCRIPTION
|
||||
SCST consists of multiple kernel modules: the SCST core, SCST target drivers
|
||||
and SCST device handlers. The state of each of these kernel modules is
|
||||
configurable at runtime. Scstadmin allows query the current state, to modify
|
||||
the current state, to save the current state to a file and to restore the SCST
|
||||
state from a file. The relevant SCST concepts are:
|
||||
.TP
|
||||
.B device
|
||||
An SCST device represents local storage that is exported via SCST. An SCST
|
||||
device is either a local SCSI device (disk, CD-ROM, tape, ...), a block I/O
|
||||
device like a disk or RAID controller or a file on a filesystem. The SCST
|
||||
drivers that control SCST devices are called device handlers. Examples of
|
||||
such device handlers are dev_disk, vdisk_blockio and vdisk_fileio.
|
||||
.TP
|
||||
.B target
|
||||
An SCST target is an interface that allows a remote system to access the
|
||||
storage exported via SCST. Each target is controlled by a target
|
||||
driver. Examples of target drivers are iscsi_scst, qla2x00t, ib_srpt and
|
||||
scst_local.
|
||||
.TP
|
||||
.B ALUA
|
||||
An SCST setup can have multiple storage interfaces. A single SCST server can
|
||||
be equipped with multiple interfaces or two SCST servers can have been set up
|
||||
in a cluster. If there are multiple paths between an initiator and a target
|
||||
system or target cluster then configuring ALUA (Asymmetric Logical Unit
|
||||
Access) will make SCST to tell the initiator which path to use.
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
<OPTION> is one of:
|
||||
.TP
|
||||
.B -debug
|
||||
For commands that modify the SCST state, let scstadmin show which SCST state
|
||||
information would be modified instead of performing these modifications.
|
||||
.TP
|
||||
.B -force
|
||||
Let certain potentially dangerous operations proceed, e.g. closing a device
|
||||
that is still in use or removing an initiator group that is still in use.
|
||||
.TP
|
||||
.B -nonkey
|
||||
When writing a config file or listing attributes, include non-key attributes.
|
||||
.TP
|
||||
.B -noprompt
|
||||
Do not prompt for confirmation before modifying the SCST state.
|
||||
.PP
|
||||
<COMMAND> is one of:
|
||||
.TP
|
||||
.B -h
|
||||
Show usage information.
|
||||
.TP
|
||||
.B -help
|
||||
Identical to -h.
|
||||
.TP
|
||||
.B -config <file>
|
||||
Read and apply the specified configuration file.
|
||||
.TP
|
||||
.B -check_config <file>
|
||||
Verify the syntax of the specified configuration file.
|
||||
.TP
|
||||
.B -write_config <file>
|
||||
Save the current configuration to the specified file.
|
||||
.TP
|
||||
.B -clear_config
|
||||
Remove all configured devices, targets that do not correspond to a physical
|
||||
entity, dynamic target attributes, initiator groups, LUNs and dynamic driver
|
||||
attributes. Disable all targets that correspond to a physical entity and
|
||||
disable all target drivers. Note: static SCST core, target and target driver
|
||||
attributes that have been modified are not reset to their default value unless
|
||||
the corresponding kernel modules are reloaded.
|
||||
.TP
|
||||
.B -list_handler [<handler>]
|
||||
If no device handler name has been specified, show the names of all device
|
||||
handlers supported by the currently loaded kernel modules. If a device handler
|
||||
name has been specified, list the names of the devices that use that device
|
||||
handler.
|
||||
.TP
|
||||
.B -list_device [<device>]
|
||||
If no device name has been specified, show the names of all configured
|
||||
devices. If a device name has been specified, show all attributes of the
|
||||
specified device.
|
||||
.TP
|
||||
.B -list_driver [<driver>]
|
||||
If no target driver name has been specified, list the names of all target
|
||||
drivers supported by the currently loaded kernel modules. If a target driver
|
||||
name has been specified, show the names of all targets that use the specified
|
||||
target driver.
|
||||
.TP
|
||||
.B -list_target [<target>] [-driver <driver>]
|
||||
If no target driver name has been specified, show all target names for all
|
||||
target drivers. If a target driver name has been specified, show all
|
||||
configuration information for the specified target. That information includes
|
||||
the assigned LUNs and information about all initiator groups associated with
|
||||
the target.
|
||||
.TP
|
||||
.B -list_group [<group>] [-driver <driver>] [-target <target>]
|
||||
If either the target driver name or the target name has not been specified,
|
||||
show information about all known target drivers, targets and initiator groups.
|
||||
If a target driver name and target name have been specified, show
|
||||
configuration information for the specified initiator group.
|
||||
.TP
|
||||
.B -list_scst_attr
|
||||
Show name and value of all SCST core attributes.
|
||||
.TP
|
||||
.B -list_hnd_attr <handler>
|
||||
Show name and value of all attributes of the specified device handler,
|
||||
and also the names of all device creation attributes.
|
||||
.TP
|
||||
.B -list_dev_attr <device>
|
||||
Show name and value of all attributes of the specified device.
|
||||
.TP
|
||||
.B -list_drv_attr <driver>
|
||||
Show name and value of all attributes of the specified target driver.
|
||||
.TP
|
||||
.B -list_tgt_attr <target> -driver <driver>
|
||||
Show name and value of all attributes of the specified target.
|
||||
.TP
|
||||
.B -list_grp_attr <group> -target <target> -driver <driver>
|
||||
Show name and value of all attributes of the specified initiator group.
|
||||
.TP
|
||||
.B -list_lun_attr <lun> -driver <driver> -target <target> [-group <group>]
|
||||
Show name and value of all attributes of the specified LUN. The LUN number
|
||||
either refers to a LUN associated with a target or to a LUN associated with
|
||||
an initiator group of a target.
|
||||
.TP
|
||||
.B -list_sessions
|
||||
Show all active sessions for all targets.
|
||||
.TP
|
||||
.B -list_dgrp [<dgrp>]
|
||||
If no device group name has been specified, show all defined ALUA device
|
||||
groups. If a device group name has been specified, show configuration
|
||||
information for that device group only.
|
||||
.TP
|
||||
.B -list_tgrp [<tgrp>] -dev_group <dgrp>
|
||||
If no ALUA target group name has been specified, list the target groups
|
||||
associated with the specified device group. If a target group name has been
|
||||
specified, show configuration information for that target group.
|
||||
.TP
|
||||
.B -list_tgrp_attr <tgrp> -dev_group <dgrp>
|
||||
Show a list with all ALUA attributes of the specified target group.
|
||||
.TP
|
||||
.B -list_ttgt_attr <tgt> -dev_group <dgrp> -tgt_group <tgrp>
|
||||
Show a list with all ALUA attributes of the specified target.
|
||||
.TP
|
||||
.B -set_scst_attr -attributes <p=v,...>
|
||||
Set the value of one or more SCST core attributes.
|
||||
.TP
|
||||
.B -set_hnd_attr <handler> -attributes <p=v,...>
|
||||
Set the value of one or more device handler attributes.
|
||||
.TP
|
||||
.B -set_dev_attr <device> -attributes <p=v,...>
|
||||
Set the value of one or more device attributes.
|
||||
.TP
|
||||
.B -set_drv_attr <driver> -attributes <p=v,...>
|
||||
Set the value of one or more target driver attributes.
|
||||
.TP
|
||||
.B -set_tgt_attr <target> -driver <driver> -attributes <p=v,...>
|
||||
Set the value of one or more target attributes.
|
||||
.TP
|
||||
.B -set_grp_attr <group> -driver <driver> -target <target> -attributes <p=v,...>
|
||||
Set the value of one or more initiator group attributes.
|
||||
.TP
|
||||
.B -set_lun_attr <lun> -driver <driver> -target <target> [-group <group>] -attributes <p=v,...>
|
||||
Set the value of one or more LUN attributes. The LUN number either refers to a
|
||||
LUN associated with a target or to a LUN associated with an initiator group of
|
||||
a target.
|
||||
.TP
|
||||
.B -add_drv_attr <driver> -attributes <p=v,...>
|
||||
Add one or more new attributes to the specified target driver and set these to
|
||||
the specified values. Which attribute names are valid depends on the affected
|
||||
target driver. Adding the same attribute several times will cause multiple
|
||||
values to be defined for that attribute.
|
||||
.TP
|
||||
.B -add_tgt_attr <target> -driver <driver> -attributes <p=v,...>
|
||||
Add one or more new attributes to the specified target and set these to the
|
||||
specified values. Which attribute names are valid depends on the involved
|
||||
target driver. Adding the same attribute several times will cause multiple
|
||||
values to be defined for that attribute.
|
||||
.TP
|
||||
.B -rem_drv_attr <driver> -attributes <p=v,...>
|
||||
Remove an (attribute, value) pair from the specified target driver.
|
||||
.TP
|
||||
.B -rem_tgt_attr <target> -driver <driver> -attributes <p=v,...>
|
||||
Remove an (attribute, value) pair from the specified target.
|
||||
.TP
|
||||
.B -open_dev <device> -handler <handler> -attributes <p=v,...>
|
||||
Create a new SCST device using the specified device handler and attributes.
|
||||
.TP
|
||||
.B -resync_dev <device>
|
||||
Update device size. SCST caches the size of devices controlled by the
|
||||
vdisk_fileio and the vdisk_blockio device handlers. This command will not only
|
||||
cause SCST to update the cached device size but will also cause any logged in
|
||||
initiator to be notified about the capacity change event.
|
||||
.TP
|
||||
.B -close_dev <device> -handler <handler>
|
||||
Remove the specified device from SCST.
|
||||
.TP
|
||||
.B -add_target <target> -driver <driver>
|
||||
Add a target to a target driver.
|
||||
.TP
|
||||
.B -rem_target <target> -driver <driver>
|
||||
Remove a target from a target driver.
|
||||
.TP
|
||||
.B -add_group <group> -driver <driver> -target <target>
|
||||
Add an initiator group to the specified target.
|
||||
.TP
|
||||
.B -rem_group <group> -driver <driver> -target <target>
|
||||
Remove an initiator group from the specified target.
|
||||
.TP
|
||||
.B -add_init <init> -driver <driver> -target <target> -group <group>
|
||||
Add an initiator to an initiator group. <init> is either an explicit initiator
|
||||
name or an initiator name pattern. The wildcard characters '*', '?' and '!'
|
||||
are supported.
|
||||
.TP
|
||||
.B -rem_init <user> -driver <driver> -target <target> -group <group>
|
||||
Remove an initiator name or initiator name pattern from an initiator group.
|
||||
.TP
|
||||
.B -move_init <init> -driver <driver> -target <target> -group <group1> -to <group2>
|
||||
Move an initiator or initiator name pattern from one initiator group to another.
|
||||
.TP
|
||||
.B -clear_inits -driver <driver> -target <target> -group <group>
|
||||
Remove all initiators from an initiator group.
|
||||
.TP
|
||||
.B -add_lun <lun> -driver <driver> -target <target> [-group <group>] \
|
||||
-device <device> -attributes <p=v,...>
|
||||
Add a LUN to a target or initiator group.
|
||||
.TP
|
||||
.B -rem_lun <lun> -driver <driver> -target <target> [-group <group>]
|
||||
Remove a LUN from a target or initiator group.
|
||||
.TP
|
||||
.B -replace_lun <lun> -driver <driver> -target <target> [-group <group>] \
|
||||
-device <device> -attributes <p=v,...>
|
||||
Replace the device associated with a LUN by another device.
|
||||
.TP
|
||||
.B -clear_luns -driver <driver> -target <target> [-group <group>]
|
||||
Remove all LUNs from a target or initiator group.
|
||||
.TP
|
||||
.B -enable_target <target> -driver <driver>
|
||||
Enable a target.
|
||||
.TP
|
||||
.B -disable_target <target> -driver <driver>
|
||||
Disable a target.
|
||||
.TP
|
||||
.B -issue_lip [<target>] [-driver <driver>]
|
||||
Issue a LIP (Loop Initialization Protocol, fibre channel) for a specific
|
||||
target or for all drivers and targets.
|
||||
.TP
|
||||
.B -set_tgrp_attr <tgrp> -dev_group <dgrp> -attributes <p=v,...>
|
||||
Set one or more attributes of the specified ALUA target group.
|
||||
.TP
|
||||
.B -set_ttgt_attr <tgt> -dev_group <dgrp> -tgt_group <tgrp> \
|
||||
-attributes <p=v,...>
|
||||
Set one or more attributes of the specified ALUA target.
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
.B scstadmin -open_dev disk01 -handler vdisk_fileio -attributes filename=/vdisks/disk01.dsk,read_only
|
||||
Lets SCST open the file /vdisks/disk01.dsk as a disk.
|
||||
.TP
|
||||
.B scstadmin -set_dev_attr disk01 -attributes t10_dev_id=0x2345
|
||||
Sets the T10 device id of SCST device disk01
|
||||
.TP
|
||||
.B scstadmin -add_group host01 -driver qla2x00t -target 50:06:0B:00:00:39:71:78
|
||||
Creates a new initiator group called host01.
|
||||
.TP
|
||||
.B scstadmin -add_lun 1 -driver qla2x00t -target 50:06:0B:00:00:39:71:78 -group host01 -device disk01 -attributes read_only=1
|
||||
Add a LUN to a group in read-only mode.
|
||||
.TP
|
||||
.B scstadmin -enable_target 50:06:0B:00:00:39:71:78 -driver qla2x00t
|
||||
Enables target mode for the fibre channel HCA port with the specified WWN.
|
||||
.TP
|
||||
.B scstadmin -write_config /etc/scst-new.conf
|
||||
Save the current configuration to the specified file.
|
||||
.SH AUTHORS
|
||||
The scstadmin software has been developed by Mark R. Buechler and also
|
||||
contains contributions from Bart Van Assche.
|
||||
.SH REPORTING BUGS
|
||||
Please send feedback about scstadmin itself or its documentation to the
|
||||
mailing list scst-devel@lists.sourceforge.net. See also
|
||||
https://lists.sourceforge.net/lists/listinfo/scst-devel for more information
|
||||
about this mailing list.
|
||||
.SH FILES
|
||||
/etc/scst.conf
|
||||
.SH "SEE ALSO"
|
||||
scst.conf(5)
|
||||
38
scstadmin/scstadmin.sysfs/man5/scst.5
Normal file
38
scstadmin/scstadmin.sysfs/man5/scst.5
Normal file
@@ -0,0 +1,38 @@
|
||||
.\" -*- nroff -*-
|
||||
.\" Copyright 2011 Bart Van Assche <bvanassche@acm.org>. All rights reserved.
|
||||
.\" Permission is granted to copy, distribute and/or modify this document
|
||||
.\" under the terms of the GNU General Public License, version 2 (GPLv2).
|
||||
.TH scst 5 "July 2011" "scstadmin 2.0.0"
|
||||
.SH NAME
|
||||
scst \- /etc/init.d/scst configuration file.
|
||||
.SH DESCRIPTION
|
||||
/etc/default/scst is a configuration file read by the SCST startup script
|
||||
/etc/init.d/scst and contains zero or more variables that control the behavior
|
||||
of that startup script. Currently there is only one such variable,
|
||||
SCST_TARGET_MODULES, and it only has to be set when using the procfs interface.
|
||||
.P
|
||||
The format of the
|
||||
.I scst
|
||||
file is as follows:
|
||||
.br
|
||||
- Blank lines and lines starting with a hash sign (#) are ignored.
|
||||
.br
|
||||
- All other lines must contain a variable definition using the syntax
|
||||
<name>=<value>. If <value> contains blanks, it must be
|
||||
surrounded with double quotes.
|
||||
.P
|
||||
An example:
|
||||
.IP
|
||||
# When using the procfs interface, the /etc/init.d/scst script
|
||||
.br
|
||||
# cannot derive from /etc/scst.conf which target modules will
|
||||
.br
|
||||
# be used and hence these have to be specified explicitly.
|
||||
.br
|
||||
SCST_TARGET_MODULES="scst_local iscsi_scst ib_srpt"
|
||||
.SH FILES
|
||||
.IP /etc/default/scst
|
||||
Configuration file that controls the behavior of some aspects of
|
||||
/etc/init.d/scst.
|
||||
.SH "SEE ALSO"
|
||||
scstadmin(1), scst.conf(5)
|
||||
340
scstadmin/scstadmin.sysfs/man5/scst.conf.5
Normal file
340
scstadmin/scstadmin.sysfs/man5/scst.conf.5
Normal file
@@ -0,0 +1,340 @@
|
||||
.\" -*- nroff -*-
|
||||
.\" Copyright 2011 Bart Van Assche <bvanassche@acm.org>. All rights reserved.
|
||||
.\" Permission is granted to copy, distribute and/or modify this document
|
||||
.\" under the terms of the GNU General Public License, version 2 (GPLv2).
|
||||
.TH scst.conf 5 "July 2011" "scstadmin 2.0.0"
|
||||
.SH NAME
|
||||
scst.conf \- Main SCST configuration file.
|
||||
.SH DESCRIPTION
|
||||
.I scst.conf
|
||||
is the main SCST configuration file. It contains information about the
|
||||
configuration of the SCST core, device handlers, devices, target drivers,
|
||||
targets, initiator groups, LUNs and ALUA configuration. This file is read and
|
||||
applied by the
|
||||
.BR scstadmin (1)
|
||||
program when the SCST service starts.
|
||||
.P
|
||||
The format of the
|
||||
.I scst.conf
|
||||
file is as follows:
|
||||
.br
|
||||
- Blank lines and lines starting with a hash sign
|
||||
.RB ( # )
|
||||
are ignored.
|
||||
.br
|
||||
- All other lines either define an attribute, mark the start of a new section
|
||||
or the end of a section.
|
||||
.br
|
||||
- An attribute definition consists of an attribute name and an attribute
|
||||
value.
|
||||
.br
|
||||
- Attribute names consist of a sequence of letters, numbers and underscore
|
||||
characters (_). Attribute names must not contain blanks.
|
||||
.br
|
||||
- An attribute name may occur several times in a section with different values.
|
||||
.br
|
||||
- Attribute values may contain blanks. Any attribute value that contains
|
||||
blanks must be surrounded with double quotes.
|
||||
.br
|
||||
- A line that ends with
|
||||
.BR { .
|
||||
marks the start of a new section.
|
||||
.br
|
||||
- A line that contains nothing else than
|
||||
.B }
|
||||
marks the end of a section.
|
||||
.P
|
||||
The recognized section names and their arguments are:
|
||||
.TP
|
||||
.B "HANDLER <handler>"
|
||||
Defines device handler attributes and also which devices are associated with
|
||||
the specified device handler. <handler> is the name of an SCST device handler.
|
||||
.TP
|
||||
.B "DEVICE <name>"
|
||||
Defines the name and attributes of an SCST device. <name> is either a H:C:I:L
|
||||
quadruplet referring to a local SCSI device or an SCST device name. A
|
||||
.B DEVICE
|
||||
section is a subsection of a
|
||||
.B HANDLER
|
||||
section.
|
||||
.TP
|
||||
.B "TARGET_DRIVER <driver>"
|
||||
Defines target driver attributes and also which targets are associated with
|
||||
the specified target driver. <driver> is the name of an SCST target driver.
|
||||
.TP
|
||||
.B "TARGET <target>"
|
||||
A
|
||||
.B TARGET
|
||||
section is either a subsection of a
|
||||
.B TARGET_DRIVER
|
||||
or of a
|
||||
.B TARGET_GROUP
|
||||
section. The former is the definition of an SCST target while the latter
|
||||
is a reference to an SCST target defined on the local system or on
|
||||
another system in the same cluster.
|
||||
.TP
|
||||
.B "LUN <number> <device name>"
|
||||
Associates an SCST device with a target and defines its LUN number.
|
||||
.RB "A " LUN " section is a subsection of a " TARGET " section."
|
||||
.TP
|
||||
.B "GROUP <group>"
|
||||
Defines an initiator group with the specified name. A
|
||||
.B GROUP
|
||||
section is a subsection of a
|
||||
.B TARGET
|
||||
section.
|
||||
.TP
|
||||
.B "INITIATOR <ini>"
|
||||
Associates an initiator name with an initiator group. <ini> is either an
|
||||
initiator name or a wildcard pattern matching zero or more initiator
|
||||
names. The supported wildcard characters are:
|
||||
.BR ! ", " * " and " ? ". An " INITIATOR
|
||||
section is a subsection of a
|
||||
.B GROUP
|
||||
section.
|
||||
.TP
|
||||
.B "DEVICE_GROUP <dg>"
|
||||
<dg> is the name of a group of devices that share ALUA settings.
|
||||
.TP
|
||||
.B "TARGET_GROUP <tg>"
|
||||
Defines an ALUA target port group. A
|
||||
.B TARGET_GROUP
|
||||
section is a subsection of a
|
||||
.B DEVICE_GROUP
|
||||
section.
|
||||
.P
|
||||
An example:
|
||||
.IP
|
||||
# Sample SCST configuration file for scstadmin v2.0.
|
||||
.IP
|
||||
setup_id 0x1234
|
||||
.IP
|
||||
HANDLER dev_disk {
|
||||
.br
|
||||
DEVICE 1:0:0:0
|
||||
.br
|
||||
DEVICE 2:0:0:0
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
HANDLER vdisk_fileio {
|
||||
.br
|
||||
DEVICE disk1 {
|
||||
.br
|
||||
filename /disk1
|
||||
.br
|
||||
nv_cache 1
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
DEVICE disk2 {
|
||||
.br
|
||||
filename /disk2
|
||||
.br
|
||||
blocksize 4096
|
||||
.br
|
||||
removable 1
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
HANDLER vdisk_blockio {
|
||||
.br
|
||||
DEVICE blockio1 {
|
||||
.br
|
||||
filename /dev/sda5
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
HANDLER vcdrom {
|
||||
.br
|
||||
DEVICE cdrom1 {
|
||||
.br
|
||||
filename /cdrom1.iso
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
TARGET_DRIVER scst_local {
|
||||
.br
|
||||
TARGET scst_local_tgt {
|
||||
.br
|
||||
session_name scst_local_host
|
||||
.IP
|
||||
LUN 0 disk1
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
TARGET_DRIVER iscsi {
|
||||
.br
|
||||
IncomingUser "joe 12charsecret"
|
||||
.br
|
||||
enabled 1
|
||||
.IP
|
||||
TARGET iqn.2006-10.net.vlnb:tgt {
|
||||
.br
|
||||
IncomingUser "joe 12charsecret"
|
||||
.br
|
||||
IncomingUser "fred 12charsecret2"
|
||||
.br
|
||||
IncomingUser "jonas 12charsecret3"
|
||||
.br
|
||||
HeaderDigest CRC32C,None
|
||||
.br
|
||||
enabled 1
|
||||
.IP
|
||||
LUN 0 disk1
|
||||
.br
|
||||
LUN 1 disk2
|
||||
.br
|
||||
LUN 2 blockio1 {
|
||||
.br
|
||||
read_only 1
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
TARGET_DRIVER qla2x00t {
|
||||
.br
|
||||
TARGET 25:00:00:f0:98:87:92:f3 {
|
||||
.br
|
||||
enabled 1
|
||||
.IP
|
||||
GROUP INI1 {
|
||||
.br
|
||||
LUN 0 blockio1
|
||||
.br
|
||||
LUN 1 1:0:0:0 {
|
||||
.br
|
||||
read_only 1
|
||||
.br
|
||||
}
|
||||
.br
|
||||
LUN 5 cdrom1
|
||||
.IP
|
||||
INITIATOR 25:00:00:f0:99:87:94:a3
|
||||
.br
|
||||
INITIATOR 25:00:00:f0:99:87:94:a4
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
TARGET 25:00:00:f0:98:87:92:f4 {
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
TARGET_DRIVER ib_srpt {
|
||||
.br
|
||||
TARGET ib_srpt_target_0 {
|
||||
.br
|
||||
enabled 1
|
||||
.IP
|
||||
LUN 0 disk1
|
||||
.br
|
||||
LUN 1 disk2
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
TARGET ib_srpt_target_1 {
|
||||
.br
|
||||
enabled 1
|
||||
.IP
|
||||
LUN 0 disk1
|
||||
.br
|
||||
LUN 1 disk2
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
DEVICE_GROUP dgroup1 {
|
||||
.br
|
||||
DEVICE disk1
|
||||
.IP
|
||||
TARGET_GROUP tgroup1 {
|
||||
.br
|
||||
group_id 1
|
||||
.br
|
||||
state active
|
||||
.IP
|
||||
TARGET ib_srpt_target_0 {
|
||||
.br
|
||||
rel_tgt_id 1
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
TARGET_GROUP tgroup2 {
|
||||
.br
|
||||
group_id 2
|
||||
.br
|
||||
state offline
|
||||
.IP
|
||||
TARGET ib_srpt_target_1 {
|
||||
.br
|
||||
rel_tgt_id 2
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
DEVICE_GROUP dgroup2 {
|
||||
.br
|
||||
DEVICE disk2
|
||||
.IP
|
||||
TARGET_GROUP tgroup1 {
|
||||
.br
|
||||
group_id 1
|
||||
.br
|
||||
state offline
|
||||
.IP
|
||||
TARGET ib_srpt_target_0 {
|
||||
.br
|
||||
rel_tgt_id 1
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.IP
|
||||
TARGET_GROUP tgroup2 {
|
||||
.br
|
||||
group_id 2
|
||||
.br
|
||||
state active
|
||||
.IP
|
||||
TARGET ib_srpt_target_1 {
|
||||
.br
|
||||
rel_tgt_id 2
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.br
|
||||
}
|
||||
.SH KERNEL MODULE PARAMETERS
|
||||
Some SCST settings cannot be configured via scst.conf but only as a kernel
|
||||
module parameter. Parameters for an SCST kernel module can be configured in
|
||||
/etc/modprobe.d/99-local.conf just like for any other kernel module. An example:
|
||||
.IP
|
||||
options ib_srpt use_node_guid_in_target_name=1
|
||||
.SH FILES
|
||||
.IP "/etc/scst.conf"
|
||||
The configuration file read by
|
||||
.BR scstadmin (1).
|
||||
.SH "SEE ALSO"
|
||||
scstadmin(1), scst(5), modprobe.d(5)
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user