您的位置:首页 > 其它

scst target在设置开机自启动时所遇问题的原因及解决办法

2015-12-03 18:20 645 查看
    最近 在做个scst target 对接ceph的Demo,其中遇到了些问题,记录一下

1.通过modprobe加载iscsi-scst modprobe时报modprobe: FATAL: Moduleiscsi-scst not found.

问题:

通过modprobe加载iscsi-scst modprobe时报modprobe: FATAL: Module iscsi-scst not found.



原因:

由于/lib/modules/3.16.0-30-generic/modules.dep无iscsi-scst的加载依赖。

通过modprobe加载正常的情况下去查询/lib/modules/3.16.0-30-generic/modules.dep应该有以下内容:

extra/dev_handlers/scst_vdisk.ko: extra/scst.ko kernel/lib/libcrc32c.ko

 


解决方案:

我们原来是编译安装顺序是

1. scst-3.0.1

2. iscsi-scst-3.0.1

3. scstadmin-3.0.1

这样在安装scst时由于iscsi-scst未编译,无法把iscsi-scst.ko的依赖写到/lib/modules/3.16.0-30-generic/modules.dep里。
 
正确的编译顺序是:
1.编译安装scst-3.0.1
2.编译安装iscsi-scst-3.0.1
3.再安装一遍scst-3.0.1
4. .编译安装scstadmin-3.0.1
 

2.scst target 开机无法自启动问题

问题:
scsttarget 开机无法自启动
 
解决方案:
1).创建/etc/scst.conf文件,包含以下内容:

# Automatically generated by SCST Configurator v3.0.1.

TARGET_DRIVER iscsi {

enabled 0

}
2).更改scstadmin-3.0.1的Makefile文件echo$$chr update-rc.d "$(1)" defaults;改为
$$chr update-rc.d "$(1)" defaults;

原文件:

ECHO_INSTALL_FN=                                                       \
if [ -n "$(DESTDIR)" ];then                                    \
chr="chroot$(DESTDIR)";                                      \
else                                                           \
chr="";                                                      \
fi;                                                            \
if type systemctl >/dev/null2>&1; then                         \
echo $$chr systemctl enable"$(1).service";                 \
elif type chkconfig >/dev/null2>&1; then                       \
echo $$chr chkconfig --add"$(1)";                          \
elif type update-rc.d >/dev/null2>&1; then                     \
echo $$chr update-rc.d "$(1)"defaults;                     \
elif type rc-update >/dev/null2>&1; then                       \
echo $$chr rc-update add"$(1)" default;                    \
elif type /usr/lib/lsb/install_initd>/dev/null 2>&1; then      \
echo $$chr/usr/lib/lsb/install_initd "$(1)";               \
fi


更改后文件:

ECHO_INSTALL_FN=                                                       \
if [ -n "$(DESTDIR)" ];then                                    \
chr="chroot$(DESTDIR)";                                      \
else                                                           \
chr="";                                                      \
fi;                                                            \
if type systemctl >/dev/null2>&1; then                        \
echo $$chr systemctl enable"$(1).service";                \
elif type chkconfig >/dev/null2>&1; then                       \
echo $$chr chkconfig --add"$(1)";                         \
elif type update-rc.d >/dev/null2>&1; then                     \
$$chr update-rc.d "$(1)"defaults;                    \
elif type rc-update >/dev/null2>&1; then                       \
echo $$chr rc-update add"$(1)" default;                   \
elif type /usr/lib/lsb/install_initd>/dev/null 2>&1; then      \
echo $$chr/usr/lib/lsb/install_initd "$(1)";               \
fi

 

3.启动scst 报Loading and configuring SCSTStarting /usr/local/sbin/iscsi-scstdfailed

问题:启动scst 报Loading and configuring SCSTStarting /usr/local/sbin/iscsi-scstdfailed

root@ceph02:~#/etc/init.d/scst start
Loadingand configuring SCSTStarting /usr/local/sbin/iscsi-scstd failed
*

原因与分析思路:

1.查看syslog,发现iscsi-scstd报Unable tobind server socket

root@ceph02:/var/log#tail -f syslog
Nov 2810:47:46 ceph02 kernel: [  993.676551]iscsi-scst: Write thread for pool ffff88105087d440 started, PID 2619
Nov 2810:47:46 ceph02 kernel: [  993.676577]iscsi-scst: Write thread for pool ffff88105087d440 started, PID 2620
Nov 2810:47:46 ceph02 kernel: [  993.676606]iscsi-scst: Write thread for pool ffff88105087d440 started, PID 2621
Nov 2810:47:46 ceph02 kernel: [  993.676632]iscsi-scst: Write thread for pool ffff88105087d440 started, PID 2622
Nov 2810:47:46 ceph02 iscsi-scstd: max_data_seg_len 1048576, max_queued_cmds 2048
Nov 28 10:47:46 ceph02 iscsi-scstd: Unable to bind serversocket (Address already in use)!
Nov 2810:47:46 ceph02 kernel: [  993.680398]iscsi-scst: Releasing allocated resources
Nov 2810:47:46 ceph02 kernel: [  993.687152] iscsi-scst:Read thread for PID 2559 for pool ffff88105087d440 finished
由此推断端口被占用,由于iscsi-scst占用的是3260端口,因此我们查询3260端口是否被占用。
root@ceph02:/var/run#netstat -lnp | grep 3260
tcp   0     0 0.0.0.0:3260           0.0.0.0:*              LISTEN      1723/tgtd
tcp6  0     0:::3260                 :::*                   LISTEN      1723/tgtd

由上图可以看出,3260端口已经被tgtd占用,原来这台机器装有另一个scsi target软件tgt,把该软件stop,问题即可解决。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: