From d9e1cb288f9f2b76b281c163070a3083231b0792 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 26 Sep 2022 23:14:18 +0200 Subject: [PATCH] test: support open-iscsi >= 2.1.2 Since open-iscsi 2.1.2 [0] the initiator name should be generated via a one-time service instead of distro package's post-install scripts. However, some distros still use this approach even after this patch, so prefer the already existing initiatorname.iscsi file if it exists. [0] https://github.com/open-iscsi/open-iscsi/commit/f37d5b653f9f251845db3f29b1a3dcb90ec89731 --- test/test-functions | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 716aa63107b..3dfbf94cadf 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1026,7 +1026,17 @@ install_iscsi() { mkdir -p "${initdir:?}"/var/lib/iscsi/{ifaces,isns,nodes,send_targets,slp,static} mkdir -p "${initdir:?}/etc/iscsi" echo "iscsid.startup = /bin/systemctl start iscsid.socket" >"${initdir:?}/etc/iscsi/iscsid.conf" - inst_simple "/etc/iscsi/initiatorname.iscsi" + # Since open-iscsi 2.1.2 [0] the initiator name should be generated via + # a one-time service instead of distro package's post-install scripts. + # However, some distros still use this approach even after this patch, + # so prefer the already existing initiatorname.iscsi file if it exists. + # + # [0] https://github.com/open-iscsi/open-iscsi/commit/f37d5b653f9f251845db3f29b1a3dcb90ec89731 + if [[ ! -e /etc/iscsi/initiatorname.iscsi ]]; then + image_install "${ROOTLIBDIR:?}"/system/iscsi-init.service + else + inst_simple "/etc/iscsi/initiatorname.iscsi" + fi fi # Install server-side stuff ("target" in iSCSI jargon) - TGT in this case