ClusterLabs / resource-agents

Combined repository of OCF agents from the RHCS and Linux-HA projects
GNU General Public License v2.0
492 stars 578 forks source link

lio backstore block vs iblock #834

Open maugsburger opened 8 years ago

maugsburger commented 8 years ago

Hi,

I'm not sure if this is a problem with incompatible changes between targetcli versions, but I always got a Traceback ERROR: Traceback (most recent call last): File "/usr/bin/targetcli", line 89, in <module> main() File "/usr/bin/targetcli", line 78, in main shell.run_cmdline(" ".join(sys.argv[1:])) File "/usr/lib/python2.7/dist-packages/configshell/shell.py", line 934, in run_cmdline self._execute_command(path, command, pparams, kparams) File "/usr/lib/python2.7/dist-packages/configshell/shell.py", line 899, in _execute_command self.log.error(msg) File "/usr/lib/python2.7/dist-packages/configshell/log.py", line 159, in error self._log('error', msg) File "/usr/lib/python2.7/dist-packages/configshell/log.py", line 112, in _log self.con.display(msg) File "/usr/lib/python2.7/dist-packages/configshell/console.py", line 153, in display self.raw_write(text) File "/usr/lib/python2.7/dist-packages/configshell/console.py", line 141, in raw_write self._stdout.write(text) TypeError: expected a string or other character buffer object

and after some debugging found out the problem is targetcli /backstores/block create vs targetcli /backstores/iblock create, and after applying the following diff everything worked fine:

--- iSCSILogicalUnit.orig       2016-07-11 15:43:33.324955524 +0000
+++ iSCSILogicalUnit  2016-07-11 15:43:40.884842482 +0000
@@ -362,11 +362,11 @@
        lio-t)
                # For lio, we first have to create a target device, then
                # add it to the Target Portal Group as an LU.
-               ocf_run targetcli /backstores/block create name=${OCF_RESOURCE_INSTANCE} dev=${OCF_RESKEY_path} || exit $OCF_ERR_GENERIC
+               ocf_run targetcli /backstores/iblock create name=${OCF_RESOURCE_INSTANCE} dev=${OCF_RESKEY_path} || exit $OCF_ERR_GENERIC
                if [ -n "${OCF_RESKEY_scsi_sn}" ]; then
                        echo ${OCF_RESKEY_scsi_sn} > /sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/wwn/vpd_unit_serial
                fi
-               ocf_run targetcli /iscsi/${OCF_RESKEY_target_iqn}/tpg1/luns create /backstores/block/${OCF_RESOURCE_INSTANCE} ${OCF_RESKEY_lun} || exit $OCF_ERR_GENERIC
+               ocf_run targetcli /iscsi/${OCF_RESKEY_target_iqn}/tpg1/luns create /backstores/iblock/${OCF_RESOURCE_INSTANCE} ${OCF_RESKEY_lun} || exit $OCF_ERR_GENERIC

                if [ -n "${OCF_RESKEY_allowed_initiators}" ]; then
                        for initiator in ${OCF_RESKEY_allowed_initiators}; do
@@ -444,7 +444,7 @@
                # delete the backstore, then something is seriously
                # wrong and we need to fail the stop operation
                # (potentially causing fencing)
-               ocf_run targetcli /backstores/block delete ${OCF_RESOURCE_INSTANCE} || exit $OCF_ERR_GENERIC
+               ocf_run targetcli /backstores/iblock delete ${OCF_RESOURCE_INSTANCE} || exit $OCF_ERR_GENERIC
                ;;
        esac

versions:

root@hase01b:~# uname -a
Linux hase01b 4.6.0-1-amd64 #1 SMP Debian 4.6.2-2 (2016-06-25) x86_64 GNU/Linux
root@hase01b:~# targetcli version
Using configshell version 1.6.1~g020d540
Using rtslib version 3.0.pre4.1~g1b33ceb
Using targetcli version 3.0.pre4.1~ga55d018
abraham1901 commented 7 years ago

+1 iblock In official document: http://linux-iscsi.org/wiki/Targetcli targetcli 2.0rc1-2 (Ubuntu 12.04) targetcli 2.1-1 (Ubuntu 14.04) targetcli 1:3.0~pre4.1~ga55d018-2 (Ubuntu 16.04)

block targetcli 0:2.1.fb41-3.el7 (CentOS Linux 7)

Need use case for different OS.

dmuhamedagic commented 7 years ago

It'd be better to test the targetcli version. Even better would be to somehow list available backstore types.

sammcj commented 7 years ago

This is interesting, I think we may be affected by this...

Fredericwu commented 5 years ago

I have tried this method,but iSCSILogicalUnit still doesn't work!!!