From fb5277b3067ff38ecbcbf40161fb8c7d2ba03a23 Mon Sep 17 00:00:00 2001 From: Fedor Piecka Date: Mon, 6 Apr 2020 10:02:55 +0200 Subject: [PATCH] Change hardcoded (and possibly wrong) lio_iblock to automatic detection of backstore index in lio-t implementation. --- heartbeat/iSCSILogicalUnit.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/heartbeat/iSCSILogicalUnit.in b/heartbeat/iSCSILogicalUnit.in index 5bfbee24de..669f24bec5 100644 --- a/heartbeat/iSCSILogicalUnit.in +++ b/heartbeat/iSCSILogicalUnit.in @@ -273,6 +273,8 @@ Using distinct values here avoids a warning in LIO "LEGACY: SHARED HBA"; and it is necessary when using multiple LUNs started at the same time (eg. on node failover) to prevent a race condition in tcm_core on mkdir() in /sys/kernel/config/target/core/. + +This parameter is only used by LIO. LIO-T ignores it. LIO iblock device number @@ -426,7 +428,8 @@ iSCSILogicalUnit_start() { lio-t) ocf_take_lock $TARGETLOCKFILE ocf_release_lock_on_exit $TARGETLOCKFILE - iblock_attrib_path="/sys/kernel/config/target/core/iblock_${OCF_RESKEY_lio_iblock}/${OCF_RESOURCE_INSTANCE}/attrib" + iblock_path="/sys/kernel/config/target/core/*_*/${OCF_RESOURCE_INSTANCE}" + iblock_attrib_path="${iblock_path}/attrib" # For lio, we first have to create a target device, then # add it to the Target Portal Group as an LU. # Handle differently 'block' and 'fileio' @@ -438,7 +441,7 @@ iSCSILogicalUnit_start() { ocf_run targetcli /backstores/${OCF_RESKEY_liot_bstype} create ${OCF_RESOURCE_INSTANCE} ${OCF_RESKEY_path} $(test -n "$OCF_RESKEY_scsi_sn" && echo "wwn=${OCF_RESKEY_scsi_sn}") || exit $OCF_ERR_GENERIC fi 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 + echo ${OCF_RESKEY_scsi_sn} > ${iblock_path}/wwn/vpd_unit_serial fi ocf_run targetcli /iscsi/${OCF_RESKEY_target_iqn}/tpg1/luns create /backstores/${OCF_RESKEY_liot_bstype}/${OCF_RESOURCE_INSTANCE} ${OCF_RESKEY_lun} || exit $OCF_ERR_GENERIC