diff --git a/RHEL-173130-iSCSILogicalUnit-add-block-size-override-and-backstore-type-selection.patch b/RHEL-173130-iSCSILogicalUnit-add-block-size-override-and-backstore-type-selection.patch new file mode 100644 index 0000000..7f4ea4c --- /dev/null +++ b/RHEL-173130-iSCSILogicalUnit-add-block-size-override-and-backstore-type-selection.patch @@ -0,0 +1,160 @@ +--- a/heartbeat/iSCSILogicalUnit.in 2021-11-03 10:12:01.000000000 +0100 ++++ b/heartbeat/iSCSILogicalUnit.in 2026-05-28 14:25:31.007210780 +0200 +@@ -67,6 +67,8 @@ + # Set LIO-T backend default as 'block' + OCF_RESKEY_liot_bstype_default="block" + : ${OCF_RESKEY_liot_bstype=${OCF_RESKEY_liot_bstype_default}} ++OCF_RESKEY_block_size_default="" ++: ${OCF_RESKEY_block_size=${OCF_RESKEY_block_size_default}} + + ## tgt specifics + # tgt has "backing store type" and "backing store open flags", +@@ -186,6 +188,19 @@ + + + ++ ++ ++Enable or disable write-back caching for this Logical Unit. ++Setting to 1 enables write-back caching (the default for fileio ++backstores). Setting to 0 disables it, enabling write-through mode. ++Write-through mode is recommended for HA configurations to ensure ++data is flushed to disk before the iSCSI write is acknowledged. ++Requires the lio-t implementation. ++ ++Write-back cache (0 or 1) ++ ++ ++ + + + The SCSI vendor ID to be configured for this Logical Unit. +@@ -292,6 +307,19 @@ + + + ++ ++ ++Override the block size presented to initiators for this ++Logical Unit. Accepted values are 512, 1024, 2048, or 4096. ++This sets the block_size attribute in the LIO kernel target ++(configfs) or the blocksize attribute in SCST. ++Requires the lio-t implementation. ++If unset, the kernel default (typically 512) is used. ++ ++Block size (512, 1024, 2048, or 4096) ++ ++ ++ + + + +@@ -428,7 +456,13 @@ + lio-t) + ocf_take_lock $TARGETLOCKFILE + ocf_release_lock_on_exit $TARGETLOCKFILE +- iblock_attrib_path="/sys/kernel/config/target/core/iblock_*/${OCF_RESOURCE_INSTANCE}/attrib" ++ # Map liot_bstype to the configfs core directory name ++ case "${OCF_RESKEY_liot_bstype}" in ++ block) liot_configfs_core="iblock_*" ;; ++ fileio) liot_configfs_core="fileio_*" ;; ++ pscsi) liot_configfs_core="pscsi_*" ;; ++ esac ++ liot_core_path="/sys/kernel/config/target/core/${liot_configfs_core}/${OCF_RESOURCE_INSTANCE}" + # For lio, we first have to create a target device, then + # add it to the Target Portal Group as an LU. + # Handle differently 'block', 'fileio' and 'pscsi' +@@ -445,10 +479,13 @@ + ocf_run targetcli /backstores/${OCF_RESKEY_liot_bstype} create ${OCF_RESOURCE_INSTANCE} ${OCF_RESKEY_path} || exit $OCF_ERR_GENERIC + fi + if [ -n "${OCF_RESKEY_scsi_sn}" ]; then +- echo ${OCF_RESKEY_scsi_sn} > /sys/kernel/config/target/core/iblock_*/${OCF_RESOURCE_INSTANCE}/wwn/vpd_unit_serial ++ echo ${OCF_RESKEY_scsi_sn} > ${liot_core_path}/wwn/vpd_unit_serial + fi + if [ -n "${OCF_RESKEY_product_id}" ]; then +- echo "${OCF_RESKEY_product_id}" > /sys/kernel/config/target/core/iblock_*/${OCF_RESOURCE_INSTANCE}/wwn/product_id ++ echo "${OCF_RESKEY_product_id}" > ${liot_core_path}/wwn/product_id ++ fi ++ if [ -n "${OCF_RESKEY_block_size}" ]; then ++ echo ${OCF_RESKEY_block_size} > ${liot_core_path}/attrib/block_size || exit $OCF_ERR_GENERIC + 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 +@@ -470,13 +507,16 @@ + fi + + if [ -n "${OCF_RESKEY_emulate_tpu}" ]; then +- echo ${OCF_RESKEY_emulate_tpu} > ${iblock_attrib_path}/emulate_tpu || exit $OCF_ERR_GENERIC ++ echo ${OCF_RESKEY_emulate_tpu} > ${liot_core_path}/attrib/emulate_tpu || exit $OCF_ERR_GENERIC + fi + if [ -n "${OCF_RESKEY_emulate_3pc}" ]; then +- echo ${OCF_RESKEY_emulate_3pc} > ${iblock_attrib_path}/emulate_3pc || exit $OCF_ERR_GENERIC ++ echo ${OCF_RESKEY_emulate_3pc} > ${liot_core_path}/attrib/emulate_3pc || exit $OCF_ERR_GENERIC + fi + if [ -n "${OCF_RESKEY_emulate_caw}" ]; then +- echo ${OCF_RESKEY_emulate_caw} > ${iblock_attrib_path}/emulate_caw || exit $OCF_ERR_GENERIC ++ echo ${OCF_RESKEY_emulate_caw} > ${liot_core_path}/attrib/emulate_caw || exit $OCF_ERR_GENERIC ++ fi ++ if [ -n "${OCF_RESKEY_emulate_write_cache}" ]; then ++ echo ${OCF_RESKEY_emulate_write_cache} > ${liot_core_path}/attrib/emulate_write_cache || exit $OCF_ERR_GENERIC + fi + ;; + esac +@@ -604,9 +644,14 @@ + configfs_path="/sys/kernel/config/target/iscsi/${OCF_RESKEY_target_iqn}/tpgt_1/lun/lun_${OCF_RESKEY_lun}/*/udev_path" + [ -e ${configfs_path} ] && [ `cat ${configfs_path}` = "${OCF_RESKEY_path}" ] && return $OCF_SUCCESS + +- # if we aren't activated, is a block device still left over? +- block_configfs_path="/sys/kernel/config/target/core/iblock_*/${OCF_RESOURCE_INSTANCE}/udev_path" +- [ -e ${block_configfs_path} ] && ocf_log warn "existing block without an active lun: ${block_configfs_path}" ++ # if we aren't activated, is a backstore still left over? ++ case "${OCF_RESKEY_liot_bstype}" in ++ block) liot_configfs_core="iblock_*" ;; ++ fileio) liot_configfs_core="fileio_*" ;; ++ pscsi) liot_configfs_core="pscsi_*" ;; ++ esac ++ block_configfs_path="/sys/kernel/config/target/core/${liot_configfs_core}/${OCF_RESOURCE_INSTANCE}/udev_path" ++ [ -e ${block_configfs_path} ] && ocf_log warn "existing backstore without an active lun: ${block_configfs_path}" + [ -e ${block_configfs_path} ] && return $OCF_ERR_GENERIC + ;; + esac +@@ -624,6 +669,22 @@ + fi + done + ++ # Validate block_size if set ++ if [ -n "${OCF_RESKEY_block_size}" ]; then ++ case "${OCF_RESKEY_block_size}" in ++ 512|1024|2048|4096) ++ ;; ++ *) ++ ocf_exit_reason "Invalid block_size ${OCF_RESKEY_block_size} (must be 512, 1024, 2048, or 4096)" ++ exit $OCF_ERR_CONFIGURED ++ ;; ++ esac ++ if [ "${OCF_RESKEY_implementation}" != "lio-t" ]; then ++ ocf_exit_reason "block_size is only supported with the lio-t implementation" ++ exit $OCF_ERR_CONFIGURED ++ fi ++ fi ++ + # Is the configured implementation supported? + case "$OCF_RESKEY_implementation" in + "iet"|"tgt"|"lio"|"lio-t") +@@ -689,13 +750,13 @@ + iet) + # IET does not support setting the vendor and product ID + # (it always uses "IET" and "VIRTUAL-DISK") +- unsupported_params="vendor_id product_id allowed_initiators lio_iblock tgt_bstype tgt_bsoflags tgt_bsopts tgt_device_type emulate_tpu emulate_3pc emulate_caw liot_bstype" ++ unsupported_params="vendor_id product_id allowed_initiators lio_iblock tgt_bstype tgt_bsoflags tgt_bsopts tgt_device_type emulate_tpu emulate_3pc emulate_caw emulate_write_cache liot_bstype" + ;; + tgt) +- unsupported_params="allowed_initiators lio_iblock emulate_tpu emulate_3pc emulate_caw liot_bstype" ++ unsupported_params="allowed_initiators lio_iblock emulate_tpu emulate_3pc emulate_caw emulate_write_cache liot_bstype" + ;; + lio) +- unsupported_params="scsi_id vendor_id product_id tgt_bstype tgt_bsoflags tgt_bsopts tgt_device_type emulate_tpu emulate_3pc emulate_caw liot_bstype" ++ unsupported_params="scsi_id vendor_id product_id tgt_bstype tgt_bsoflags tgt_bsopts tgt_device_type emulate_tpu emulate_3pc emulate_caw emulate_write_cache liot_bstype" + ;; + lio-t) + unsupported_params="scsi_id vendor_id tgt_bstype tgt_bsoflags tgt_bsopts tgt_device_type lio_iblock" diff --git a/resource-agents.spec b/resource-agents.spec index 2e3b1c4..d4ea1ab 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -45,7 +45,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.10.0 -Release: 119%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 120%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: %{upstream_prefix}-%{upstream_version}.tar.gz @@ -214,6 +214,7 @@ Patch161: RHEL-177840-podman-etcd-fix-machine-deletion-deadlock.patch Patch162: RHEL-177845-podman-etcd-fix-learner-start-deadlock.patch Patch163: RHEL-150842-pgsqlms-use-monitor_user-for-monitor-calls-and-use-pgpass-when-monitor_password-is-not-specified.patch Patch164: RHEL-179069-IPaddr2-fix-interfaces-named-with-keywords.patch +Patch165: RHEL-173130-iSCSILogicalUnit-add-block-size-override-and-backstore-type-selection.patch # bundled ha-cloud-support libs Patch500: ha-cloud-support-aliyun.patch @@ -523,6 +524,7 @@ exit 1 %patch -p1 -P 162 %patch -p1 -P 163 %patch -p1 -P 164 +%patch -p1 -P 165 # bundled ha-cloud-support libs %patch -p1 -P 500 @@ -857,6 +859,11 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm %changelog +* Thu May 28 2026 Oyvind Albrigtsen - 4.10.0-120 +- iSCSILogicalUnit: add block size override and backstore type selection + + Resolves: RHEL-173130 + * Wed May 27 2026 Oyvind Albrigtsen - 4.10.0-119 - IPaddr2: fix interfaces named with keywords like primary, secondary, etc