|
|
15862b |
diff -uNr a/heartbeat/iSCSILogicalUnit b/heartbeat/iSCSILogicalUnit
|
|
|
15862b |
--- a/heartbeat/iSCSILogicalUnit 2017-03-21 11:02:41.525216214 +0100
|
|
|
15862b |
+++ b/heartbeat/iSCSILogicalUnit 2017-03-21 11:15:58.307410228 +0100
|
|
|
15862b |
@@ -74,6 +74,8 @@
|
|
|
15862b |
# OCF_RESKEY_tgt_bsoflags
|
|
|
15862b |
# OCF_RESKEY_tgt_device_type
|
|
|
15862b |
|
|
|
15862b |
+# targetcli: iSCSITarget and iSCSILogicalUnit must use the same lockfile
|
|
|
15862b |
+TARGETLOCKFILE=${HA_RSCTMP}/targetcli.lock
|
|
|
15862b |
#######################################################################
|
|
|
15862b |
|
|
|
15862b |
meta_data() {
|
|
|
15862b |
@@ -360,6 +362,8 @@
|
|
|
15862b |
fi
|
|
|
15862b |
;;
|
|
|
15862b |
lio-t)
|
|
|
15862b |
+ ocf_take_lock $TARGETLOCKFILE
|
|
|
15862b |
+ ocf_release_lock_on_exit $TARGETLOCKFILE
|
|
|
15862b |
# For lio, we first have to create a target device, then
|
|
|
15862b |
# add it to the Target Portal Group as an LU.
|
|
|
15862b |
ocf_run targetcli /backstores/block create name=${OCF_RESOURCE_INSTANCE} dev=${OCF_RESKEY_path} || exit $OCF_ERR_GENERIC
|
|
|
15862b |
@@ -434,6 +438,8 @@
|
|
|
15862b |
fi
|
|
|
15862b |
;;
|
|
|
15862b |
lio-t)
|
|
|
15862b |
+ ocf_take_lock $TARGETLOCKFILE
|
|
|
15862b |
+ ocf_release_lock_on_exit $TARGETLOCKFILE
|
|
|
15862b |
ocf_run targetcli /iscsi/${OCF_RESKEY_target_iqn}/tpg1/luns delete ${OCF_RESKEY_lun} || exit $OCF_ERR_GENERIC
|
|
|
15862b |
if [ -n "${OCF_RESKEY_allowed_initiators}" ]; then
|
|
|
15862b |
for initiator in ${OCF_RESKEY_allowed_initiators}; do
|
|
|
15862b |
diff -uNr a/heartbeat/iSCSITarget b/heartbeat/iSCSITarget
|
|
|
15862b |
--- a/heartbeat/iSCSITarget 2017-03-21 11:02:41.506216405 +0100
|
|
|
15862b |
+++ b/heartbeat/iSCSITarget 2017-03-21 11:19:13.493453664 +0100
|
|
|
15862b |
@@ -50,6 +50,9 @@
|
|
|
15862b |
|
|
|
15862b |
# Lockfile, used for selecting a target ID
|
|
|
15862b |
LOCKFILE=${HA_RSCTMP}/iSCSITarget-${OCF_RESKEY_implementation}.lock
|
|
|
15862b |
+
|
|
|
15862b |
+# targetcli: iSCSITarget and iSCSILogicalUnit must use the same lockfile
|
|
|
15862b |
+TARGETLOCKFILE=${HA_RSCTMP}/targetcli.lock
|
|
|
15862b |
#######################################################################
|
|
|
15862b |
|
|
|
15862b |
meta_data() {
|
|
|
15862b |
@@ -325,6 +328,8 @@
|
|
|
15862b |
# number 1. In lio, creating a network portal
|
|
|
15862b |
# automatically creates the corresponding target if it
|
|
|
15862b |
# doesn't already exist.
|
|
|
15862b |
+ ocf_take_lock $TARGETLOCKFILE
|
|
|
15862b |
+ ocf_release_lock_on_exit $TARGETLOCKFILE
|
|
|
15862b |
for portal in ${OCF_RESKEY_portals}; do
|
|
|
15862b |
if [ $portal != ${OCF_RESKEY_portals_default} ] ; then
|
|
|
15862b |
ocf_run targetcli /iscsi set global auto_add_default_portal=false || exit $OCF_ERR_GENERIC
|
|
|
15862b |
@@ -479,6 +484,8 @@
|
|
|
15862b |
ocf_run lio_node --deliqn ${OCF_RESKEY_iqn} || exit $OCF_ERR_GENERIC
|
|
|
15862b |
;;
|
|
|
15862b |
lio-t)
|
|
|
15862b |
+ ocf_take_lock $TARGETLOCKFILE
|
|
|
15862b |
+ ocf_release_lock_on_exit $TARGETLOCKFILE
|
|
|
15862b |
ocf_run targetcli /iscsi delete ${OCF_RESKEY_iqn} || exit $OCF_ERR_GENERIC
|
|
|
15862b |
;;
|
|
|
15862b |
esac
|