diff --git a/0001-add-ISCSI_VERSION_STR-define.patch b/0001-add-ISCSI_VERSION_STR-define.patch new file mode 100644 index 0000000000000000000000000000000000000000..3427db4b681f36b5993d3fcbdb31d890d4a7270c --- /dev/null +++ b/0001-add-ISCSI_VERSION_STR-define.patch @@ -0,0 +1,25 @@ +From 3518aebee85edf2da8df1cbcad1bc0f3588405a5 Mon Sep 17 00:00:00 2001 +From: happy_orange +Date: Fri, 10 Mar 2023 17:27:55 +0800 +Subject: [PATCH 1/1] add ISCSI_VERSION_STR define + +--- + usr/version.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usr/version.h b/usr/version.h +index f8be671..328d650 100644 +--- a/usr/version.h ++++ b/usr/version.h +@@ -9,7 +9,7 @@ + * Version string should be set by the build system, else we have problems + */ + #ifndef ISCSI_VERSION_STR +-#error Must set ISCSI_VERSION_STR ++#define ISCSI_VERSION_STR "2.1.8" + #endif + #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" + +-- +2.31.1 + diff --git a/0001-unit-file-tweaks.patch b/0001-unit-file-tweaks.patch index 7b2083010b7000214e562713d8441edc80f2fb86..c800c87ee08403e1db8f5f6a72cbc0670d1a0895 100644 --- a/0001-unit-file-tweaks.patch +++ b/0001-unit-file-tweaks.patch @@ -1,118 +1,30 @@ -From fd538429be486d057b092e3b9c148add2c5ea9c2 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 4 Jun 2019 13:23:32 -0700 +From 7a88111c7f32b1dcbb4b0d49790ac059514fa5cf Mon Sep 17 00:00:00 2001 +From: happy_orange +Date: Thu, 9 Mar 2023 16:08:09 +0800 Subject: [PATCH 1/1] unit file tweaks --- - etc/systemd/iscsi-init.service | 2 +- - etc/systemd/iscsi-mark-root-nodes | 34 ++++++++++++++++++++++++++++++ - etc/systemd/iscsi-onboot.service | 15 +++++++++++++ - etc/systemd/iscsi-shutdown.service | 15 +++++++++++++ - etc/systemd/iscsi.service | 16 +++++++------- - etc/systemd/iscsid.service | 3 +-- - etc/systemd/iscsiuio.service | 4 +--- - 7 files changed, 75 insertions(+), 14 deletions(-) - create mode 100644 etc/systemd/iscsi-mark-root-nodes - create mode 100644 etc/systemd/iscsi-onboot.service - create mode 100644 etc/systemd/iscsi-shutdown.service + etc/systemd/iscsi-init.service.template | 2 +- + etc/systemd/iscsi.service.template | 16 ++++++++-------- + etc/systemd/iscsid.service.template | 3 +-- + etc/systemd/iscsiuio.service.template | 4 +--- + 4 files changed, 11 insertions(+), 14 deletions(-) -diff --git a/etc/systemd/iscsi-init.service b/etc/systemd/iscsi-init.service -index 17792da..3fe14c1 100644 ---- a/etc/systemd/iscsi-init.service -+++ b/etc/systemd/iscsi-init.service -@@ -7,4 +7,4 @@ After=root.mount +diff --git a/etc/systemd/iscsi-init.service.template b/etc/systemd/iscsi-init.service.template +index 8f9a8aa..51dd052 100644 +--- a/etc/systemd/iscsi-init.service.template ++++ b/etc/systemd/iscsi-init.service.template +@@ -16,4 +16,4 @@ WantedBy=systemd-remount-fs.service [Service] Type=oneshot RemainAfterExit=no -ExecStart=/usr/bin/sh -c 'echo "InitiatorName=`@SBINDIR@/iscsi-iname`" > /etc/iscsi/initiatorname.iscsi' +ExecStart=/usr/bin/sh -c 'echo "InitiatorName=`/usr/sbin/iscsi-iname`" > /etc/iscsi/initiatorname.iscsi' -diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes -new file mode 100644 -index 0000000..423412d ---- /dev/null -+++ b/etc/systemd/iscsi-mark-root-nodes -@@ -0,0 +1,34 @@ -+#!/bin/bash -+ -+SCSIADM=/usr/sbin/iscsiadm -+start_iscsid=0 -+start_iscsiuio=0 -+ -+while read t num p target flash; do -+ # strip tag number from portal, keep "ip:port" -+ portal=${p%,*} -+ transport=${t%:} -+ -+ # use session number to find the iface name in use -+ num=${num#[}; num=${num%]} -+ iface=$(iscsiadm -m session -r $num | grep iface.iscsi_ifacename | cut -d= -f2) -+ -+ $ISCSIADM -m node -p $portal -T $target -I $iface -o update -n node.startup -v onboot -+ -+ start_iscsid=1 -+ -+ if [ "$transport" = bnx2i ] || [ "$transport" = qedi ]; then -+ start_iscsiuio=1 -+ fi -+done < <( $ISCSIADM -m session ) -+ -+# force iscsid and iscsiuio to start if needed for -+# recovering sessions created in the initrd -+ -+if [ "$start_iscsid" -eq 1 ]; then -+ systemctl --no-block start iscsid.service -+fi -+if [ "$start_iscsiuio" -eq 1 ]; then -+ systemctl --no-block start iscsiuio.service -+fi -+i]} -diff --git a/etc/systemd/iscsi-onboot.service b/etc/systemd/iscsi-onboot.service -new file mode 100644 -index 0000000..42ced68 ---- /dev/null -+++ b/etc/systemd/iscsi-onboot.service -@@ -0,0 +1,15 @@ -+[Unit] -+Description=Special handling of early boot iSCSI sessions -+Documentation=man:iscsiadm(8) man:iscsid(8) -+DefaultDependencies=no -+RefuseManualStart=true -+Before=iscsi.service -+After=systemd-remount-fs.service -+ConditionDirectoryNotEmpty=/sys/class/iscsi_session -+ -+[Service] -+Type=oneshot -+ExecStart=-/usr/libexec/iscsi-mark-root-nodes -+ -+[Install] -+WantedBy=sysinit.target -diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service -new file mode 100644 -index 0000000..caee933 ---- /dev/null -+++ b/etc/systemd/iscsi-shutdown.service -@@ -0,0 +1,15 @@ -+[Unit] -+Description=Logout off all iSCSI sessions on shutdown -+Documentation=man:iscsid(8) man:iscsiadm(8) -+DefaultDependencies=no -+Conflicts=shutdown.target -+After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service -+Before=remote-fs-pre.target -+Wants=remote-fs-pre.target -+RefuseManualStop=yes -+ -+[Service] -+Type=oneshot -+RemainAfterExit=true -+ExecStart=-/usr/bin/true -+ExecStop=-/usr/sbin/iscsiadm -m node --logoutall=all -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index 6becab4..175cb2c 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service -@@ -1,18 +1,18 @@ +diff --git a/etc/systemd/iscsi.service.template b/etc/systemd/iscsi.service.template +index 6becab4..125d225 100644 +--- a/etc/systemd/iscsi.service.template ++++ b/etc/systemd/iscsi.service.template +@@ -1,17 +1,17 @@ [Unit] Description=Login and scanning of iSCSI devices Documentation=man:iscsiadm(8) man:iscsid(8) @@ -132,17 +44,16 @@ index 6becab4..175cb2c 100644 -ExecStop=@SBINDIR@/iscsiadm -m node --logoutall=automatic -ExecStop=@SBINDIR@/iscsiadm -m node --logoutall=manual -SuccessExitStatus=21 15 - RemainAfterExit=true +ExecStart=-/usr/sbin/iscsiadm -m node --loginall=automatic +ExecReload=-/usr/sbin/iscsiadm -m node --loginall=automatic +SuccessExitStatus=21 + RemainAfterExit=true [Install] - WantedBy=remote-fs.target -diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service +diff --git a/etc/systemd/iscsid.service.template b/etc/systemd/iscsid.service.template index e2a50d3..324c593 100644 ---- a/etc/systemd/iscsid.service -+++ b/etc/systemd/iscsid.service +--- a/etc/systemd/iscsid.service.template ++++ b/etc/systemd/iscsid.service.template @@ -4,13 +4,12 @@ Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8) DefaultDependencies=no After=network-online.target iscsiuio.service iscsi-init.service @@ -158,11 +69,11 @@ index e2a50d3..324c593 100644 KillMode=mixed Restart=on-failure -diff --git a/etc/systemd/iscsiuio.service b/etc/systemd/iscsiuio.service -index 2e721fe..8bbea42 100644 ---- a/etc/systemd/iscsiuio.service -+++ b/etc/systemd/iscsiuio.service -@@ -2,18 +2,16 @@ +diff --git a/etc/systemd/iscsiuio.service.template b/etc/systemd/iscsiuio.service.template +index 2e721fe..fc0be93 100644 +--- a/etc/systemd/iscsiuio.service.template ++++ b/etc/systemd/iscsiuio.service.template +@@ -2,17 +2,15 @@ Description=iSCSI UserSpace I/O driver Documentation=man:iscsiuio(8) DefaultDependencies=no @@ -177,11 +88,10 @@ index 2e721fe..8bbea42 100644 Type=notify NotifyAccess=main -ExecStart=@SBINDIR@/iscsiuio -f - KillMode=mixed +ExecStart=/usr/sbin/iscsiuio -f + KillMode=mixed Restart=on-failure - [Install] -- -2.27.0 +2.31.1 diff --git a/0002-idmb_rec_write-check-for-tpgt-first.patch b/0002-idmb_rec_write-check-for-tpgt-first.patch index ba9da6d6542047d69cb32f47f2d99ae4c62aab24..c8e216b23f80c27aafea4a55911e7997de0d07f5 100644 --- a/0002-idmb_rec_write-check-for-tpgt-first.patch +++ b/0002-idmb_rec_write-check-for-tpgt-first.patch @@ -1,4 +1,4 @@ -From 45878c9461298c9da68a626d990dc4ef99e01baa Mon Sep 17 00:00:00 2001 +From fd18e6ee693d96e8f76abd49623ead80fbc53994 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Tue, 13 Aug 2013 10:59:44 -0700 Subject: [PATCH] idmb_rec_write, check for tpgt first @@ -6,15 +6,16 @@ Subject: [PATCH] idmb_rec_write, check for tpgt first Factor out the check for a tpgt to a single place, before going crazy on the rec files. Makes flow of this function easier to follow, and preps for splitting it up. + --- usr/idbm.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/usr/idbm.c b/usr/idbm.c -index 42c2699..e6ede85 100644 +index 90bc142..0abcea5 100644 --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -2178,6 +2178,10 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock) +@@ -2200,6 +2200,10 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock) goto free_portal; } @@ -25,7 +26,7 @@ index 42c2699..e6ede85 100644 rc = stat(portal, &statb); if (rc) { rc = 0; -@@ -2186,22 +2190,10 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock) +@@ -2208,22 +2212,10 @@ static int idbm_rec_write(node_rec_t *rec, bool disable_lock) * set the tgpt. In new versions you must pass all the info in * from the start */ @@ -50,5 +51,5 @@ index 42c2699..e6ede85 100644 * Old style portal as a file, but with tpgt. Let's update it. */ -- -2.26.2 +2.31.1 diff --git a/0005-update-initscripts-and-docs.patch b/0005-update-initscripts-and-docs.patch index c1943a0883ea1cbb28ce92e30e295bfc3fe62cc8..c842d36f0a25d566e13b9ba27c174a6be3735493 100644 --- a/0005-update-initscripts-and-docs.patch +++ b/0005-update-initscripts-and-docs.patch @@ -1,44 +1,38 @@ -From 97b1242450df25648d203acf7cc297cd46d10e8c Mon Sep 17 00:00:00 2001 +From 0123e714ef4a4974ddea8dd2fa7f10fc7eacda05 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Mon, 19 Nov 2012 16:37:13 -0800 Subject: [PATCH] update initscripts and docs --- - README | 11 +++++------ - etc/iscsid.conf | 15 ++++++++------- - usr/idbm.c | 3 +++ - 3 files changed, 16 insertions(+), 13 deletions(-) + README | 9 ++++++--- + etc/iscsid.conf | 9 ++++++--- + usr/idbm.c | 3 +++ + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README b/README -index 3e0459a..1f6abda 100644 +index 118f001..23c5fe4 100644 --- a/README +++ b/README -@@ -77,10 +77,6 @@ the cache sync command will fail. - - iscsiadm's -P 3 option will not print out scsi devices. - - iscsid will not automatically online devices. +@@ -1260,15 +1260,15 @@ to start the daemon and log into the targets manually. + 7.1.1 iSCSI startup using the init script + ========================================= --You need to enable "Cryptographic API" under "Cryptographic options" in the --kernel config. And you must enable "CRC32c CRC algorithm" even if --you do not use header or data digests. They are the kernel options --CONFIG_CRYPTO and CONFIG_CRYPTO_CRC32C, respectively. - - The userspace components iscsid, iscsiadm and iscsistart require the - open-isns library, which can be found here: -@@ -1130,11 +1126,11 @@ Red Hat or Fedora: +-Red Hat or Fedora: ++Red Hat or Fedora or Anolis: ----------------- - To start open-iscsi in Red Hat/Fedora you can do: + To start Open-iSCSI in Red Hat/Fedora you can do: - systemctl start open-iscsi + systemctl start iscsi - To get open-iscsi to automatically start at run time you may have to + To get Open-iSCSI to automatically start at run time you may have to run: - systemctl enable open-iscsi + systemctl enable iscsi And, to automatically mount a file system during startup you must have the partition entry in /etc/fstab marked with the "_netdev" -@@ -1142,6 +1138,9 @@ option. For example this would mount an iscsi disk sdb: +@@ -1276,6 +1276,9 @@ option. For example this would mount an iSCSI disk sdb: /dev/sdb /mnt/iscsi ext3 _netdev 0 0 @@ -47,56 +41,41 @@ index 3e0459a..1f6abda 100644 + SUSE or Debian: --------------- - The open-iscsi service is socket activated, so there is no need to + The Open-iSCSI service is socket activated, so there is no need to diff --git a/etc/iscsid.conf b/etc/iscsid.conf -index 2dc412f..a8504a9 100644 +index 79d8127..0c2f57e 100644 --- a/etc/iscsid.conf +++ b/etc/iscsid.conf -@@ -19,7 +19,7 @@ +@@ -18,8 +18,8 @@ + # maintainers. If you leave the iscsid daemon running all # the time then leave this attribute commented out. # - # Default for Fedora and RHEL. Uncomment to activate. +-# Default for Fedora and RHEL. Uncomment to activate. -# iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket ++# Default for Fedora and RHEL and Anolis.Uncomment to activate. +iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket # # Default for Debian and Ubuntu. Uncomment to activate. # iscsid.startup = /bin/systemctl start iscsid.socket -@@ -44,7 +44,7 @@ - # To request that the iscsi service scripts startup a session, use "automatic": - # node.startup = automatic - # --# To manually startup the session, use "manual". The default is manual. -+# To manually startup the session set to "manual". The default is automatic. - node.startup = manual - - # For "automatic" startup nodes, setting this to "Yes" will try logins on each -@@ -278,10 +278,10 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0 - discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 - +@@ -286,6 +286,8 @@ discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 # To allow the targets to control the setting of the digest checking, --# with the initiator requesting a preference of enabling the checking, --# uncomment one or both of the following lines: + # with the initiator requesting a preference of enabling the checking, + # uncomment one or both of the following lines: +# with the initiator requesting a preference of enabling the checking, uncomment -+# the following lines (Data digests are not supported.): ++# the following lines (Data digests are not supported.):# #node.conn[0].iscsi.HeaderDigest = CRC32C,None --#node.conn[0].iscsi.DataDigest = CRC32C,None -+ - # - # To allow the targets to control the setting of the digest checking, - # with the initiator requesting a preference of disabling the checking, -@@ -290,9 +290,9 @@ discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 - #node.conn[0].iscsi.DataDigest = None,CRC32C + #node.conn[0].iscsi.DataDigest = CRC32C,None # +@@ -298,7 +300,7 @@ discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 # To enable CRC32C digest checking for the header and/or data part of --# iSCSI PDUs, uncomment one or both of the following lines: -+# iSCSI PDUs, uncomment the following lines: + # iSCSI PDUs, uncomment one or both of the following lines: #node.conn[0].iscsi.HeaderDigest = CRC32C -#node.conn[0].iscsi.DataDigest = CRC32C + # # To disable digest checking for the header and/or data part of # iSCSI PDUs, uncomment one or both of the following lines: -@@ -301,6 +301,7 @@ discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 +@@ -307,6 +309,7 @@ discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 # # The default is to never use DataDigests or HeaderDigests. # @@ -105,7 +84,7 @@ index 2dc412f..a8504a9 100644 # For multipath configurations, you may want more than one session to be # created on each iface record. If node.session.nr_sessions is greater diff --git a/usr/idbm.c b/usr/idbm.c -index f9fefc5..c21c662 100644 +index 3092fe0..38cf5be 100644 --- a/usr/idbm.c +++ b/usr/idbm.c @@ -566,9 +566,12 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri) @@ -122,5 +101,5 @@ index f9fefc5..c21c662 100644 __recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW, "No", "Yes", num, 1); -- -2.27.0 +2.31.1 diff --git a/0006-use-var-for-config.patch b/0006-use-var-for-config.patch index e69b9e7cf0735b99c78bde43f9a93f8503daf1f3..7fa2f2e92b2b3eeab43fa1680ad98edc1356e8ce 100644 --- a/0006-use-var-for-config.patch +++ b/0006-use-var-for-config.patch @@ -1,42 +1,41 @@ -From f7c6a7381a38ca59fd7a9a64e5f54cf5c16995ad Mon Sep 17 00:00:00 2001 +From 3396cb9ae6dd1329e88ade8c9ba74809c1e5971d Mon Sep 17 00:00:00 2001 From: Chris Leech -Date: Mon, 19 Nov 2012 16:38:45 -0800 -Subject: [PATCH 1/1] use var for config +Date: Thu, 9 Mar 2023 16:51:43 +0800 +Subject: [PATCH 1/1] usr var for config --- - README | 33 ++++++++++++++++----------------- - doc/iscsiadm.8 | 8 ++++---- - doc/iscsid.8 | 2 +- - usr/idbm.c | 6 +++--- - usr/idbm.h | 13 +++++++------ - usr/iface.h | 3 ++- - 6 files changed, 33 insertions(+), 32 deletions(-) + README | 32 +++++++++++++++----------------- + libopeniscsiusr/idbm.h | 2 +- + usr/idbm.h | 1 + + usr/iface.h | 1 + + 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README b/README -index b62a14e..1875e3d 100644 +index 23c5fe4..be0b052 100644 --- a/README +++ b/README -@@ -172,8 +172,7 @@ Usage: iscsid [OPTION] +@@ -198,9 +198,7 @@ Usage: iscsid [OPTION] Open-iSCSI persistent configuration is stored in a number of directories under a configuration root directory, using a flat-file -format. This configuration root directory is /etc/iscsi by default, --but may also commonly be in /var/lib/iscsi. -+format. This configuration root directory is /var/lib/iscsi by default. +-but may also commonly be in /var/lib/iscsi (see "dbroot" in the meson +-options discussed earlier). ++format. This configuration root directory is /etc/iscsi by default. Configuration is contained in directories for: -@@ -573,7 +572,7 @@ a scsi_host per HBA port). +@@ -608,7 +606,7 @@ a scsi_host per HBA port). To manage both types of initiator stacks, iscsiadm uses the interface (iface) - structure. For each HBA port or for software iscsi for each network + structure. For each HBA port or for software iSCSI for each network device (ethX) or NIC, that you wish to bind sessions to you must create -a iface config /etc/iscsi/ifaces. +a iface config /var/lib/iscsi/ifaces. Prep ---- -@@ -606,7 +605,7 @@ Running - The command +@@ -642,7 +640,7 @@ The command: + iscsiadm -m iface -will report iface configurations that are setup in /etc/iscsi/ifaces: @@ -44,9 +43,9 @@ index b62a14e..1875e3d 100644 iface0 qla4xxx,00:c0:dd:08:63:e8,20.15.0.7,default,iqn.2005-06.com.redhat:madmax iface1 qla4xxx,00:c0:dd:08:63:ea,20.15.0.9,default,iqn.2005-06.com.redhat:madmax -@@ -616,10 +615,10 @@ The format is: +@@ -653,10 +651,10 @@ The format is: - For software iscsi, you can create the iface configs by hand, but it is + For software iSCSI, you can create the iface configs by hand, but it is recommended that you use iscsiadm's iface mode. There is an iface.example in -/etc/iscsi/ifaces which can be used as a template for the daring. +/var/lib/iscsi/ifaces which can be used as a template for the daring. @@ -57,23 +56,17 @@ index b62a14e..1875e3d 100644 must have a unique name which is less than or equal to 64 characters. Example -@@ -627,12 +626,12 @@ Example - - If you have NIC1 with MAC address 00:0F:1F:92:6B:BF and NIC2 with - MAC address 00:C0:DD:08:63:E7, and you wanted to do software iscsi over --TCP/IP, then in /etc/iscsi/ifaces/iface0 you would enter: -+TCP/IP, then in /var/lib/iscsi/ifaces/iface0 you would enter: - +@@ -669,7 +667,7 @@ TCP/IP, then in /etc/iscsi/ifaces/iface0 you would enter: iface.transport_name = tcp iface.hwaddress = 00:0F:1F:92:6B:BF -and in /etc/iscsi/ifaces/iface1 you would enter: -+and in /var/lib/iscsi/ifaces/iface1 you would enter: ++and in /var/lib/ifaces/iface1 you would enter: iface.transport_name = tcp iface.hwaddress = 00:C0:DD:08:63:E7 -@@ -674,7 +673,7 @@ port. The iface name will be of the form: - Running the following command: +@@ -715,7 +713,7 @@ Running the following command: + iscsiadm -m iface -will report iface configurations that are setup in /etc/iscsi/ifaces: @@ -81,8 +74,8 @@ index b62a14e..1875e3d 100644 default tcp,,,, iser iser,,,, -@@ -754,7 +753,7 @@ need a separate network connection to the target for discovery purposes. - *This will be fixed in the next version of open-iscsi* +@@ -802,7 +800,7 @@ need a separate network connection to the target for discovery purposes. + *This should be fixed in the some future version of Open-iSCSI* For compatibility reasons, when you run iscsiadm to do discovery, it -will check for interfaces in /etc/iscsi/iscsi/ifaces that are using @@ -90,8 +83,8 @@ index b62a14e..1875e3d 100644 tcp for the iface.transport, and it will bind the portals that are discovered so that they will be logged in through those ifaces. This behavior can also be overridden by passing in the interfaces you want to use. For the case -@@ -769,7 +768,7 @@ If you had defined interfaces but wanted the old behavior, where we do not - bind a session to an iface, then you can use the special iface "default": +@@ -819,7 +817,7 @@ bind a session to an iface, then you can use the special iface "default": + iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1 -And if you did not define any interfaces in /etc/iscsi/ifaces and do @@ -99,37 +92,37 @@ index b62a14e..1875e3d 100644 not pass anything into iscsiadm, running iscsiadm will do the default behavior, allowing the network subsystem to decide which device to use. -@@ -805,7 +804,7 @@ Discovery mode - ID [192.168.1.1:3260]: +@@ -860,7 +858,7 @@ Discovery mode + iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover -- This will search /etc/iscsi/send_targets for a record with the -+ This will search /var/lib/iscsi/send_targets for a record with the - ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it - will perform discovery using the settings stored in the record. - If a record does not exist, it will be created using the iscsid.conf -@@ -814,7 +813,7 @@ Discovery mode - The argument to -p may also be a hostname instead of an address: +- This will search /etc/iscsi/send_targets for a record with the ++ This will search /var/lib/iscsi/send_targets for a record with the + ID [portal = 192.168.1.1:3260 and type = sendtargets. If found it + will perform discovery using the settings stored in the record. + If a record does not exist, it will be created using the iscsid.conf +@@ -870,7 +868,7 @@ Discovery mode + iscsiadm -m discoverydb -t st -p somehost --discover -- For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for -+ For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for - interfaces using software iscsi. If any are found then nodes found - during discovery will be setup so that they can logged in through - those interfaces. To specify a specific iface, pass the -@@ -865,7 +864,7 @@ Discovery mode - - - SendTargets iSCSI Discovery with a specific interface. - If you wish to only use a subset of the interfaces in -- /etc/iscsi/ifaces, then you can pass them in during discovery: -+ /var/lib/iscsi/ifaces, then you can pass them in during discovery: +- For the ifaces, iscsiadm will first search /etc/iscsi/ifaces for ++ For the ifaces, iscsiadm will first search /var/lib/iscsi/ifaces for + interfaces using software iSCSI. If any are found then nodes found + during discovery will be setup so that they can logged in through + those interfaces. To specify a specific iface, pass the +@@ -926,7 +924,7 @@ Discovery mode + + - SendTargets iSCSI Discovery with a specific interface. If you wish + to only use a subset of the interfaces in +- /etc/iscsi/ifaces, then you can pass them in during discovery: ++ /var/lib/iscsi/ifaces, then you can pass them in during discovery: + iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \ --interface=iface0 --interface=iface1 --discover - -@@ -1232,8 +1231,8 @@ where targetname is the name of the target and ip_address:port is the address - and port of the portal. tpgt is the Target Portal Group Tag of - the portal, and is not used in iscsiadm commands except for static - record creation. ifacename is the name of the iscsi interface +@@ -1349,8 +1347,8 @@ Here, where targetname is the name of the target and ip_address:port + is the address and port of the portal. tpgt is the Target Portal Group + Tag of the portal, and is not used in iscsiadm commands except for static + record creation. ifacename is the name of the iSCSI interface -defined in /etc/iscsi/ifaces. If no interface was defined in -/etc/iscsi/ifaces or passed in, the default behavior is used. +defined in /var/lib/iscsi/ifaces. If no interface was defined in @@ -137,7 +130,7 @@ index b62a14e..1875e3d 100644 Default here is iscsi_tcp/tcp to be used over whichever NIC the network layer decides is best. -@@ -1353,7 +1352,7 @@ If set, iscsid will perform discovery to the address every +@@ -1488,7 +1486,7 @@ If set, iscsid will perform discovery to the address every discovery.isns.discoveryd_poll_inval or discovery.sendtargets.discoveryd_poll_inval seconds, and it will log into any portals found from the discovery source using @@ -146,110 +139,31 @@ index b62a14e..1875e3d 100644 Note that for iSNS the poll_interval does not have to be set. If not set, iscsid will only perform rediscovery when it gets a SCN from the server. -diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8 -index 3729a72..9f84a81 100644 ---- a/doc/iscsiadm.8 -+++ b/doc/iscsiadm.8 -@@ -228,7 +228,7 @@ This option is only valid for ping submode. - .TP - \fB\-I\fR, \fB\-\-interface=\fI[iface]\fR - The interface argument specifies the iSCSI interface to use for the operation. --iSCSI interfaces (iface) are defined in /etc/iscsi/ifaces. For hardware -+iSCSI interfaces (iface) are defined in /var/lib/iscsi/ifaces. For hardware - iSCSI (qla4xxx) the iface config must have the hardware address - (iface.hwaddress = port's MAC address) - and the driver/transport_name (iface.transport_name). The iface's name is -@@ -318,7 +318,7 @@ If no other options are specified: for \fIdiscovery\fR, \fIdiscoverydb\fR and - \fInode\fR, all of their respective records are displayed; for \fIsession\fR, - all active sessions and connections are displayed; for \fIfw\fR, all boot - firmware values are displayed; for \fIhost\fR, all iSCSI hosts are displayed; --and for \fIiface\fR, all ifaces setup in /etc/iscsi/ifaces are displayed. -+and for \fIiface\fR, all ifaces setup in /var/lib/iscsi/ifaces are displayed. - .TP - \fB\-n\fR, \fB\-\-name=\fIname\fR - In node mode, specify a field \fIname\fR in a record. In flashnode submode -@@ -681,10 +681,10 @@ The configuration file read by \fBiscsid\fR and \fBiscsiadm\fR on startup. - The file containing the iSCSI InitiatorName and InitiatorAlias read by - \fBiscsid\fR and \fBiscsiadm\fR on startup. - .TP --/etc/iscsi/nodes/ -+/var/lib/iscsi/nodes/ - This directory contains the nodes with their targets. - .TP --/etc/iscsi/send_targets -+/var/lib/iscsi/send_targets - This directory contains the portals. - .SH "SEE ALSO" - .BR iscsid (8) -diff --git a/doc/iscsid.8 b/doc/iscsid.8 -index db996b4..eaa9c3b 100644 ---- a/doc/iscsid.8 -+++ b/doc/iscsid.8 -@@ -70,7 +70,7 @@ and - .B iscsiadm - on startup. - .TP --/etc/iscsi/nodes -+/var/lib/iscsi/nodes - Open-iSCSI persistent configuration database - - .SH "SEE ALSO" -diff --git a/usr/idbm.c b/usr/idbm.c -index 7c63c04..779d052 100644 ---- a/usr/idbm.c -+++ b/usr/idbm.c -@@ -3104,9 +3104,9 @@ free_info: - int idbm_init(idbm_get_config_file_fn *fn) - { - /* make sure root db dir is there */ -- if (access(ISCSI_CONFIG_ROOT, F_OK) != 0) { -- if (mkdir(ISCSI_CONFIG_ROOT, 0770) != 0) { -- log_error("Could not make %s %d", ISCSI_CONFIG_ROOT, -+ if (access(ISCSIVAR, F_OK) != 0) { -+ if (mkdir(ISCSIVAR, 0770) != 0) { -+ log_error("Could not make %s %d", ISCSIVAR, - errno); - return errno; - } -diff --git a/usr/idbm.h b/usr/idbm.h -index 7496f1d..db3048b 100644 ---- a/usr/idbm.h -+++ b/usr/idbm.h -@@ -30,12 +30,13 @@ - #include "list.h" - #include "flashnode.h" - --#define NODE_CONFIG_DIR ISCSI_CONFIG_ROOT"nodes" --#define SLP_CONFIG_DIR ISCSI_CONFIG_ROOT"slp" --#define ISNS_CONFIG_DIR ISCSI_CONFIG_ROOT"isns" --#define STATIC_CONFIG_DIR ISCSI_CONFIG_ROOT"static" --#define FW_CONFIG_DIR ISCSI_CONFIG_ROOT"fw" --#define ST_CONFIG_DIR ISCSI_CONFIG_ROOT"send_targets" -+#define ISCSIVAR "/var/lib/iscsi/" -+#define NODE_CONFIG_DIR ISCSIVAR"nodes" -+#define SLP_CONFIG_DIR ISCSIVAR"slp" -+#define ISNS_CONFIG_DIR ISCSIVAR"isns" -+#define STATIC_CONFIG_DIR ISCSIVAR"static" -+#define FW_CONFIG_DIR ISCSIVAR"fw" -+#define ST_CONFIG_DIR ISCSIVAR"send_targets" - #define ST_CONFIG_NAME "st_config" - #define ISNS_CONFIG_NAME "isns_config" - +diff --git a/libopeniscsiusr/idbm.h b/libopeniscsiusr/idbm.h +index be5986f..56f8ec3 100644 +--- a/libopeniscsiusr/idbm.h ++++ b/libopeniscsiusr/idbm.h +@@ -31,7 +31,7 @@ + #include "libopeniscsiusr/libopeniscsiusr_common.h" + + #ifndef ISCSI_DB_ROOT +-#define ISCSI_DB_ROOT "/etc/iscsi" ++#define ISCSI_DB_ROOT "/var/lib/iscsi" + #endif + + #define IFACE_CONFIG_DIR ISCSI_DB_ROOT"/ifaces" diff --git a/usr/iface.h b/usr/iface.h -index 6c06f7f..c8b9de9 100644 +index 7e1e6a2..1139fc1 100644 --- a/usr/iface.h +++ b/usr/iface.h -@@ -21,8 +21,9 @@ +@@ -21,6 +21,7 @@ #define ISCSI_IFACE_H #include +#include "idbm.h" --#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces" -+#define IFACE_CONFIG_DIR ISCSIVAR"ifaces" + #define IFACE_CONFIG_DIR ISCSI_DB_ROOT"/ifaces" - struct iface_rec; - struct list_head; -- -2.26.3 +2.31.1 diff --git a/0007-libiscsi.patch b/0007-libiscsi.patch index 39d1a845e1f70c793094151fc35b90dfa4b3f7fb..c8a13a1216065ccc5242123e934cb67bee1162d8 100644 --- a/0007-libiscsi.patch +++ b/0007-libiscsi.patch @@ -1,16 +1,16 @@ -From 8b4da8007ef59bbc833fed882ddae57bbcd51f1c Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Mon, 26 Jan 2015 12:57:11 -0800 -Subject: [PATCH] libiscsi +From 0d15398c0afa4bbae9c10fa2374806b7f36cc4c7 Mon Sep 17 00:00:00 2001 +From: happy_orange +Date: Thu, 9 Mar 2023 17:50:25 +0800 +Subject: [PATCH 1/1] add libiscsi --- Makefile | 2 + - libiscsi/Makefile | 65 + - libiscsi/libiscsi.c | 617 ++++++++ + libiscsi/Makefile | 67 + + libiscsi/libiscsi.c | 745 ++++++++++ libiscsi/libiscsi.doxy | 1473 +++++++++++++++++++ - libiscsi/libiscsi.h | 344 +++++ + libiscsi/libiscsi.h | 400 +++++ libiscsi/no_date_footer.html | 6 + - libiscsi/pylibiscsi.c | 709 +++++++++ + libiscsi/pylibiscsi.c | 719 +++++++++ libiscsi/setup.py | 9 + libiscsi/tests/test_discovery_firmware.c | 53 + libiscsi/tests/test_discovery_sendtargets.c | 60 + @@ -24,9 +24,9 @@ Subject: [PATCH] libiscsi usr/Makefile | 2 +- usr/discovery.c | 5 + usr/idbm.c | 6 +- - usr/idbm.h | 3 + + usr/idbm.h | 4 + usr/iscsi_ipc.h | 2 + - 22 files changed, 3769 insertions(+), 4 deletions(-) + 22 files changed, 3966 insertions(+), 4 deletions(-) create mode 100644 libiscsi/Makefile create mode 100644 libiscsi/libiscsi.c create mode 100644 libiscsi/libiscsi.doxy @@ -45,31 +45,31 @@ Subject: [PATCH] libiscsi create mode 100644 libiscsi/tests/test_set_auth.c diff --git a/Makefile b/Makefile -index 7b445a5..4ab091f 100644 +index 09bda07..dad878f 100644 --- a/Makefile +++ b/Makefile -@@ -65,6 +65,7 @@ user: iscsiuio/Makefile - $(MAKE) -C usr - $(MAKE) -C utils - $(MAKE) -C iscsiuio -+ $(MAKE) -C libiscsi +@@ -65,6 +65,7 @@ user: deprecation_msg iscsiuio/Makefile + $(MAKE) $(MFLAGS) -C utils + $(MAKE) $(MFLAGS) -C etc + $(MAKE) $(MFLAGS) -C iscsiuio ++ $(MAKE) $(MFLAGS) -C libiscsi + $(MAKE) $(MFLAGS) -C doc @echo @echo "Compilation complete Output file" - @echo "----------------------------------- ----------------" -@@ -85,6 +86,7 @@ iscsiuio/configure iscsiuio/Makefile.in: iscsiuio/configure.ac iscsiuio/Makefile - force: ; +@@ -91,6 +92,7 @@ clean distclean: + $(MAKE) $(MFLAGS) -C usr $@ + $(MAKE) $(MFLAGS) -C etc $@ + $(MAKE) $(MFLAGS) -C libopeniscsiusr $@ ++ $(MAKE) $(MFLAGS) -C libiscsi $@ + $(MAKE) $(MFLAGS) -C doc $@ + [ ! -f iscsiuio/Makefile ] || $(MAKE) $(MFLAGS) -C iscsiuio $@ - clean: -+ $(MAKE) -C libiscsi clean - $(MAKE) -C utils/sysdeps clean - $(MAKE) -C utils/fwparam_ibft clean - $(MAKE) -C utils clean diff --git a/libiscsi/Makefile b/libiscsi/Makefile new file mode 100644 -index 0000000..53f9746 +index 0000000..462d666 --- /dev/null +++ b/libiscsi/Makefile -@@ -0,0 +1,65 @@ +@@ -0,0 +1,67 @@ +# This Makefile will work only with GNU make. + +ifeq ($(TOPDIR),) @@ -80,7 +80,9 @@ index 0000000..53f9746 +OPTFLAGS ?= -O2 -g +WARNFLAGS ?= -Wall -Wstrict-prototypes +CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr \ -+ -D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden ++ -D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden \ ++ -I../libopeniscsiusr ++LDFLAGS = -L../libopeniscsiusr -lopeniscsiusr -lkmod -lcrypto +LIB = libiscsi.so.0 +TESTS = tests/test_discovery_sendtargets tests/test_discovery_firmware +TESTS += tests/test_login tests/test_logout tests/test_params @@ -89,13 +91,13 @@ index 0000000..53f9746 + +COMMON_SRCS = sysdeps.o +# sources shared between iscsid, iscsiadm and iscsistart -+ISCSI_LIB_SRCS = netlink.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o io.o auth.o discovery.o login.o log.o md5.o sha1.o iface.o idbm.o sysfs.o iscsi_sysfs.o iscsi_net_util.o iscsid_req.o iser.o uip_mgmt_ipc.o ++ISCSI_LIB_SRCS = netlink.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o io.o auth.o discovery.o login.o log.o iface.o idbm.o sysfs.o iscsi_sysfs.o iscsi_net_util.o iscsid_req.o iser.o uip_mgmt_ipc.o +FW_PARAM_SRCS = fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_sysfs.o + +# sources shared with the userspace utils, note we build these separately +# to get PIC versions. +COMMON_OBJS = $(patsubst %.o, common-objs/%.o, $(COMMON_SRCS)) -+USR_OBJS = $(patsubst %.o, usr-objs/%.o, $(ISCSI_LIB_SRCS) strings.o) ++USR_OBJS = $(patsubst %.o, usr-objs/%.o, $(ISCSI_LIB_SRCS) local_strings.o) +FW_OBJS = $(patsubst %.o, fw-objs/%.o, $(FW_PARAM_SRCS)) + +# Flags for the tests @@ -106,7 +108,7 @@ index 0000000..53f9746 +lib: $(LIB) +tests: $(TESTS) + -+common-objs/%.o: ../utils/sysdeps/%.c ++common-objs/%.o: ../sysdeps/%.c + mkdir -p common-objs + $(CC) $(CFLAGS) -c $< -o $@ + @@ -114,7 +116,7 @@ index 0000000..53f9746 + mkdir -p usr-objs + $(CC) $(CFLAGS) -c $< -o $@ + -+fw-objs/%.o: ../utils/fwparam_ibft/%.c ++fw-objs/%.o: ../usr/fwparam_ibft/%.c + mkdir -p fw-objs + $(CC) $(CFLAGS) -c $< -o $@ + @@ -137,15 +139,16 @@ index 0000000..53f9746 +-include .depend ../usr/.depend diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c new file mode 100644 -index 0000000..064e4b5 +index 0000000..c598aee --- /dev/null +++ b/libiscsi/libiscsi.c -@@ -0,0 +1,617 @@ +@@ -0,0 +1,745 @@ +/* + * iSCSI Administration library + * + * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved. + * Copyright (C) 2008-2009 Hans de Goede ++ * Copyright (C) 2015 Peter Hatina + * maintained by open-iscsi@googlegroups.com + * + * This program is free software; you can redistribute it and/or modify @@ -278,6 +281,7 @@ index 0000000..064e4b5 + + /* Fill the drec struct with all needed info */ + memset(&drec, 0, sizeof drec); ++ drec.iscsid_req_tmo = -1; + idbm_sendtargets_defaults(&drec.u.sendtargets); + drec.type = DISCOVERY_TYPE_SENDTARGETS; + strlcpy(drec.address, address, sizeof(drec.address)); @@ -318,7 +322,8 @@ index 0000000..064e4b5 + *found_nodes = calloc(found, sizeof **found_nodes); + if (*found_nodes == NULL) { + snprintf(context->error_str, -+ sizeof(context->error_str), strerror(ENOMEM)); ++ sizeof(context->error_str), ++ "%s", strerror(ENOMEM)); + rc = ENOMEM; + goto leave; + } @@ -370,6 +375,7 @@ index 0000000..064e4b5 + CHECK(iface_create_ifaces_from_boot_contexts(&ifaces, &targets)); + + memset(&drec, 0, sizeof(drec)); ++ drec.iscsid_req_tmo = -1; + drec.type = DISCOVERY_TYPE_FW; + rc = idbm_bind_ifaces_to_nodes(discovery_fw, &drec, &ifaces, &rec_list); + if (rc) { @@ -568,7 +574,7 @@ index 0000000..064e4b5 + + CHECK(idbm_for_each_iface(&nr_found, (void*)node->iface, login_helper, + (char *)node->name, node->tpgt, -+ (char *)node->address, node->port)) ++ (char *)node->address, node->port, false)) + if (nr_found == 0) { + strcpy(context->error_str, "No such node"); + rc = ENODEV; @@ -612,6 +618,130 @@ index 0000000..064e4b5 + return rc; +} + ++struct libiscsi_session_array { ++ int cnt; ++ int size; ++ struct libiscsi_session_info *data; ++}; ++ ++static void libiscsi_session_array_init(struct libiscsi_session_array *arr) ++{ ++ arr->cnt = 0; ++ arr->size = 0; ++ arr->data = NULL; ++} ++ ++static int libiscsi_session_array_grow(struct libiscsi_session_array *arr) ++{ ++ if (arr->size == 0) ++ arr->size = 4; ++ else ++ arr->size *= 2; ++ ++ arr->data = (struct libiscsi_session_info *) realloc( ++ arr->data, ++ arr->size * sizeof(struct libiscsi_session_info)); ++ ++ return arr->data ? 0 : 1; ++} ++ ++static int libiscsi_session_array_grow_ondemand(struct libiscsi_session_array *arr) ++{ ++ if (arr->size == arr->cnt) ++ return libiscsi_session_array_grow(arr); ++ return 0; ++} ++ ++static int libiscsi_session_array_resize_precize(struct libiscsi_session_array *arr) ++{ ++ arr->data = (struct libiscsi_session_info *) realloc( ++ arr->data, ++ arr->cnt * sizeof(struct libiscsi_session_info)); ++ arr->size = arr->cnt; ++ ++ return arr->data ? 0 : 1; ++} ++ ++static void copy_session_info_to_libiscsi_session_info( ++ struct libiscsi_session_info *info, ++ struct session_info *s_info) ++{ ++ /* Copy session info to public struct. */ ++ info->sid = s_info->sid; ++ /* Timeouts */ ++ memcpy(&info->tmo, &s_info->tmo, sizeof(struct libiscsi_session_timeout)); ++ /* CHAP authentication information */ ++ memcpy(&info->chap, &s_info->chap, sizeof(struct libiscsi_chap_auth_info)); ++ /* Target information */ ++ strncpy(info->targetname, s_info->targetname, LIBISCSI_VALUE_MAXLEN); ++ strncpy(info->address, s_info->address, NI_MAXHOST); ++ strncpy(info->persistent_address, s_info->persistent_address, NI_MAXHOST); ++ info->tpgt = s_info->tpgt; ++ info->persistent_port = s_info->persistent_port; ++} ++ ++static int get_sessions_helper(void *data, struct session_info *s_info) ++{ ++ struct libiscsi_session_array *arr = (struct libiscsi_session_array *) data; ++ ++ if (libiscsi_session_array_grow_ondemand(arr) != 0) ++ return 1; ++ ++ copy_session_info_to_libiscsi_session_info(&arr->data[arr->cnt++], s_info); ++ ++ return 0; ++} ++ ++int libiscsi_get_session_infos(struct libiscsi_context *context, ++ struct libiscsi_session_info **infos, ++ int *nr_sessions) ++{ ++ int rc = 0; ++ int nr_found = 0; ++ struct libiscsi_session_array arr; ++ ++ if (!context || !infos || !nr_sessions) ++ return 1; ++ ++ libiscsi_session_array_init(&arr); ++ ++ rc = iscsi_sysfs_for_each_session((void *) &arr, &nr_found, ++ get_sessions_helper, 0); ++ if (rc != 0 || nr_found == 0) { ++ strcpy(context->error_str, "No matching session"); ++ return ENODEV; ++ } ++ ++ if (libiscsi_session_array_resize_precize(&arr) != 0) { ++ strcpy(context->error_str, "Can't allocate memory for session infos"); ++ return ENOMEM; ++ } ++ ++ *infos = arr.data; ++ *nr_sessions = nr_found; ++ ++ return 0; ++} ++ ++int libiscsi_get_session_info_by_id(struct libiscsi_context *context, ++ struct libiscsi_session_info *info, ++ const char *session) ++{ ++ struct session_info s_info; ++ ++ if (!context || !info || !session) ++ return 1; ++ ++ if (iscsi_sysfs_get_sessioninfo_by_id(&s_info, (char*) session) != 0) { ++ strcpy(context->error_str, "No matching session"); ++ return ENODEV; ++ } ++ ++ copy_session_info_to_libiscsi_session_info(info, &s_info); ++ ++ return 0; ++} ++ +int libiscsi_node_set_parameter(struct libiscsi_context *context, + const struct libiscsi_node *node, + const char *parameter, const char *value) @@ -630,7 +760,7 @@ index 0000000..064e4b5 + + CHECK(idbm_for_each_iface(&nr_found, ¶ms, idbm_node_set_param, + (char *)node->name, node->tpgt, -+ (char *)node->address, node->port)) ++ (char *)node->address, node->port, false)) + if (nr_found == 0) { + strcpy(context->error_str, "No such node"); + rc = ENODEV; @@ -650,7 +780,7 @@ index 0000000..064e4b5 + info = idbm_recinfo_alloc(MAX_KEYS); + if (!info) { + snprintf(context->error_str, sizeof(context->error_str), -+ strerror(ENOMEM)); ++ "%s", strerror(ENOMEM)); + return ENOMEM; + } + @@ -692,7 +822,7 @@ index 0000000..064e4b5 + as most settings should be the same independent of the iface. */ + CHECK(idbm_for_each_iface(&nr_found, context, get_parameter_helper, + (char *)node->name, node->tpgt, -+ (char *)node->address, node->port)) ++ (char *)node->address, node->port, false)) + if (nr_found == 0) { + strcpy(context->error_str, "No such node"); + rc = ENODEV; @@ -2239,15 +2369,16 @@ index 0000000..7a5ff7f +SEARCHENGINE = NO diff --git a/libiscsi/libiscsi.h b/libiscsi/libiscsi.h new file mode 100644 -index 0000000..756590e +index 0000000..a9891f4 --- /dev/null +++ b/libiscsi/libiscsi.h -@@ -0,0 +1,344 @@ +@@ -0,0 +1,400 @@ +/* + * iSCSI Administration library + * + * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved. + * Copyright (C) 2008-2009 Hans de Goede ++ * Copyright (C) 2015 Peter Hatina + * maintained by open-iscsi@googlegroups.com + * + * This program is free software; you can redistribute it and/or modify @@ -2301,6 +2432,17 @@ index 0000000..756590e + */ +struct libiscsi_context; + ++/** \brief iSCSI session timeouts ++ * ++ * Struct holding session timeouts. ++ */ ++struct libiscsi_session_timeout { ++ int abort_tmo; ++ int lu_reset_tmo; ++ int recovery_tmo; ++ int tgt_reset_tmo; ++}; ++ +/** \brief iSCSI node record + * + * Struct holding data uniquely identifying an iSCSI node. @@ -2329,6 +2471,24 @@ index 0000000..756590e + char reverse_password[LIBISCSI_VALUE_MAXLEN] /** Reverse Password */; +}; + ++/** \brief iSCSI session ++ * ++ * Struct hoding iSCSI session information. ++ */ ++struct libiscsi_session_info { ++ int sid; ++ ++ struct libiscsi_session_timeout tmo; ++ struct libiscsi_chap_auth_info chap; ++ ++ char targetname[LIBISCSI_VALUE_MAXLEN]; ++ int tpgt; ++ char address[NI_MAXHOST]; ++ int port; ++ char persistent_address[NI_MAXHOST]; ++ int persistent_port; ++}; ++ +/** \brief generic libiscsi authentication information struct + * + * Struct holding authentication information for discovery and login. @@ -2493,6 +2653,32 @@ index 0000000..756590e +PUBLIC int libiscsi_node_logout(struct libiscsi_context *context, + const struct libiscsi_node *node); + ++/** \brief Get an array of iSCSI sessions. ++ * ++ * Get the array containing iSCSI sessions' information. ++ * ++ * \param context libiscsi context to operate on. ++ * \param infos Array of iSCSI sessions' information. ++ * Release with free(). ++ * \param nr_sessions The number of elements in \e infos. ++ * \return 0 on success, otherwise a standard error code ++ * (from errno.h). ++ */ ++PUBLIC int libiscsi_get_session_infos(struct libiscsi_context *context, ++ struct libiscsi_session_info **infos, int *nr_sessions); ++ ++/** \brief Get session information by session ID. ++ * ++ * \param context libiscsi context to operate on. ++ * \param info iSCSI session information. ++ * \param session Session name. ++ * \return 0 on success, otherwise a standard error code ++ * (from errno.h) ++ */ ++PUBLIC int libiscsi_get_session_info_by_id(struct libiscsi_context *context, ++ struct libiscsi_session_info *info, ++ const char *session); ++ +/** \brief Set an iSCSI parameter for the given node + * + * Set the given nodes iSCSI parameter named by \e parameter to value \e value. @@ -2601,10 +2787,10 @@ index 0000000..1e0c6c4 + diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c new file mode 100644 -index 0000000..8800853 +index 0000000..40b5955 --- /dev/null +++ b/libiscsi/pylibiscsi.c -@@ -0,0 +1,709 @@ +@@ -0,0 +1,719 @@ +/* + * iSCSI Administration library + * @@ -2971,8 +3157,13 @@ index 0000000..8800853 +static PyObject *PyIscsiNode_login(PyObject *self) +{ + PyIscsiNode *node = (PyIscsiNode *)self; ++ int ret; ++ ++ Py_BEGIN_ALLOW_THREADS ++ ret = libiscsi_node_login(context, &node->node); ++ Py_END_ALLOW_THREADS + -+ if (libiscsi_node_login(context, &node->node)) { ++ if (ret) { + PyErr_SetString(PyExc_IOError, + libiscsi_get_error_string(context)); + return NULL; @@ -3158,6 +3349,7 @@ index 0000000..8800853 + const struct libiscsi_auth_info *authinfo = NULL; + struct libiscsi_node *found_nodes; + PyObject* found_node_list; ++ int ret; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO", + kwlist, &address, &port, @@ -3177,8 +3369,12 @@ index 0000000..8800853 + } + } + -+ if (libiscsi_discover_sendtargets(context, address, port, authinfo, -+ &nr_found, &found_nodes)) { ++ Py_BEGIN_ALLOW_THREADS ++ ret = libiscsi_discover_sendtargets(context, address, port, authinfo, ++ &nr_found, &found_nodes); ++ Py_END_ALLOW_THREADS ++ ++ if (ret) { + PyErr_SetString(PyExc_IOError, + libiscsi_get_error_string(context)); + return NULL; @@ -3914,20 +4110,20 @@ index 0000000..a21f888 + return rc; +} diff --git a/usr/Makefile b/usr/Makefile -index 21bb154..885243a 100644 +index 84f33bc..16fb5f0 100644 --- a/usr/Makefile +++ b/usr/Makefile -@@ -37,7 +37,7 @@ PKG_CONFIG = /usr/bin/pkg-config +@@ -46,7 +46,7 @@ PKG_CONFIG ?= /usr/bin/pkg-config CFLAGS ?= -O2 -g WARNFLAGS ?= -Wall -Wextra -Werror -Wstrict-prototypes -fno-common CFLAGS += $(WARNFLAGS) -I../include -I. -D_GNU_SOURCE \ -- -I$(TOPDIR)/libopeniscsiusr -+ -I$(TOPDIR)/libopeniscsiusr -DISNS_ENABLE +- -I$(TOPDIR)/libopeniscsiusr \ ++ -I$(TOPDIR)/libopeniscsiusr -DISNS_ENABLE \ + -DISCSI_VERSION_STR=\"$(ISCSI_VERSION_STR)\" CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod) - ISCSI_LIB = -L$(TOPDIR)/libopeniscsiusr -lopeniscsiusr - LDFLAGS += $(shell $(PKG_CONFIG) --libs libkmod) + CFLAGS += $(shell $(PKG_CONFIG) --cflags libsystemd) diff --git a/usr/discovery.c b/usr/discovery.c -index 7dec696..2cf1838 100644 +index 587af6d..7c4f613 100644 --- a/usr/discovery.c +++ b/usr/discovery.c @@ -36,6 +36,7 @@ @@ -3951,7 +4147,7 @@ index 7dec696..2cf1838 100644 #ifdef SLP_ENABLE #include "iscsi-slp-discovery.h" -@@ -98,6 +101,7 @@ static int request_initiator_name(int tmo) +@@ -98,12 +101,14 @@ static int request_initiator_name(int tmo) return 0; } @@ -3959,19 +4155,18 @@ index 7dec696..2cf1838 100644 void discovery_isns_free_servername(void) { if (isns_config.ic_server_name) -@@ -377,6 +381,7 @@ retry: - discovery_isns_free_servername(); - return rc; + free(isns_config.ic_server_name); + isns_config.ic_server_name = NULL; } +#endif - int discovery_fw(void *data, - __attribute__((unused))struct iface_rec *iface, + int discovery_isns_set_servername(char *address, int port) + { diff --git a/usr/idbm.c b/usr/idbm.c -index 27cad0a..2498a03 100644 +index 38cf5be..6588e76 100644 --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -1825,9 +1825,9 @@ int idbm_print_all_discovery(int info_level) +@@ -1846,9 +1846,9 @@ int idbm_print_all_discovery(int info_level) * fn should return -1 if it skipped the rec, an ISCSI_ERR error code if * the operation failed or 0 if fn was run successfully. */ @@ -3979,30 +4174,31 @@ index 27cad0a..2498a03 100644 - char *targetname, int tpgt, char *ip, int port, - bool ruw_lock) +int idbm_for_each_iface(int *found, void *data, idbm_iface_op_fn *fn, -+ char *targetname, int tpgt, char *ip, int port, -+ bool ruw_lock) ++ char *targetname, int tpgt, char *ip, int port, ++ bool ruw_lock) { DIR *iface_dirfd; struct dirent *iface_dent; diff --git a/usr/idbm.h b/usr/idbm.h -index ce098b7..d1a7f63 100644 +index f428531..827777e 100644 --- a/usr/idbm.h +++ b/usr/idbm.h -@@ -105,6 +105,9 @@ struct rec_op_data { +@@ -106,6 +106,10 @@ struct rec_op_data { node_rec_t *match_rec; idbm_iface_op_fn *fn; }; +extern int idbm_for_each_iface(int *found, void *data, idbm_iface_op_fn *fn, -+ char *targetname, int tpgt, char *ip, int port, -+ bool ruw_lock); ++ char *targetname, int tpgt, char *ip, int port, ++ bool ruw_lock); ++ extern int idbm_for_each_portal(int *found, void *data, idbm_portal_op_fn *fn, char *targetname, bool ruw_lock); extern int idbm_for_each_node(int *found, void *data, diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h -index 47857dd..596543b 100644 +index 78bd29a..d5c9f14 100644 --- a/usr/iscsi_ipc.h +++ b/usr/iscsi_ipc.h -@@ -162,4 +162,6 @@ struct iscsi_ipc { +@@ -175,4 +175,6 @@ struct iscsi_ipc { char *host_stats); }; @@ -4010,5 +4206,5 @@ index 47857dd..596543b 100644 + #endif /* ISCSI_IPC_H */ -- -2.26.2 +2.31.1 diff --git a/0008-libiscsi-introduce-sessions-API.patch b/0008-libiscsi-introduce-sessions-API.patch new file mode 100644 index 0000000000000000000000000000000000000000..01405fc074ab841b268cba83ea7ed05b3f301ef6 --- /dev/null +++ b/0008-libiscsi-introduce-sessions-API.patch @@ -0,0 +1,57 @@ +From 4382a3eac90d0a6b7715cea5d2173ae877ee5a47 Mon Sep 17 00:00:00 2001 +From: Peter Hatina +Date: Thu, 9 Mar 2023 19:00:29 +0800 +Subject: [PATCH] libiscsi introduce sessions API + +--- + usr/iscsi_sysfs.c | 6 ++++++ + usr/iscsi_sysfs.h | 2 ++ + 2 files changed, 8 insertions(+) + +diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c +index 9a591be..0830f0e 100644 +--- a/usr/iscsi_sysfs.c ++++ b/usr/iscsi_sysfs.c +@@ -3,6 +3,7 @@ + * + * Copyright (C) 2006 Mike Christie + * Copyright (C) 2006 Red Hat, Inc. All rights reserved. ++ * Copyright (C) 2015 Peter Hatina + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published +@@ -1163,6 +1164,11 @@ free_info: + return rc; + } + ++const char *iscsi_sysfs_get_session_path(void) ++{ ++ return ISCSI_SESSION_DIR; ++} ++ + int iscsi_sysfs_for_each_iface_on_host(void *data, uint32_t host_no, + int *nr_found, + iscsi_sysfs_iface_op_fn *fn) +diff --git a/usr/iscsi_sysfs.h b/usr/iscsi_sysfs.h +index 9575c65..52b3081 100644 +--- a/usr/iscsi_sysfs.h ++++ b/usr/iscsi_sysfs.h +@@ -3,6 +3,7 @@ + * + * Copyright (C) 2006 Mike Christie + * Copyright (C) 2006 Red Hat, Inc. All rights reserved. ++ * Copyright (C) 2015 Peter Hatina + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published +@@ -48,6 +49,7 @@ typedef int (iscsi_sysfs_flashnode_op_fn)(void *, struct flashnode_rec *, + uint32_t, uint32_t); + typedef int (iscsi_sysfs_iface_op_fn)(void *, struct iface_rec *); + ++extern const char *iscsi_sysfs_get_session_path(void); + extern int iscsi_sysfs_for_each_iface_on_host(void *data, uint32_t host_no, + int *nr_found, + iscsi_sysfs_iface_op_fn *fn); +-- +2.31.1 + diff --git a/0009-libiscsi-introduce-sessions-API.patch b/0009-libiscsi-introduce-sessions-API.patch deleted file mode 100644 index 57ab58fa85e4800141b8391d9c218974a2f5bd30..0000000000000000000000000000000000000000 --- a/0009-libiscsi-introduce-sessions-API.patch +++ /dev/null @@ -1,290 +0,0 @@ -From 2c28c620727e522f022689312d76f107eb8ef18f Mon Sep 17 00:00:00 2001 -From: Peter Hatina -Date: Mon, 5 Oct 2015 16:50:36 -0700 -Subject: [PATCH] libiscsi introduce sessions API - ---- - libiscsi/libiscsi.c | 125 ++++++++++++++++++++++++++++++++++++++++++++ - libiscsi/libiscsi.h | 56 ++++++++++++++++++++ - usr/iscsi_sysfs.c | 6 +++ - usr/iscsi_sysfs.h | 2 + - 4 files changed, 189 insertions(+) - -diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c -index 064e4b5..755c18c 100644 ---- a/libiscsi/libiscsi.c -+++ b/libiscsi/libiscsi.c -@@ -3,6 +3,7 @@ - * - * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved. - * Copyright (C) 2008-2009 Hans de Goede -+ * Copyright (C) 2015 Peter Hatina - * maintained by open-iscsi@googlegroups.com - * - * This program is free software; you can redistribute it and/or modify -@@ -469,6 +470,130 @@ leave: - return rc; - } - -+struct libiscsi_session_array { -+ int cnt; -+ int size; -+ struct libiscsi_session_info *data; -+}; -+ -+static void libiscsi_session_array_init(struct libiscsi_session_array *arr) -+{ -+ arr->cnt = 0; -+ arr->size = 0; -+ arr->data = NULL; -+} -+ -+static int libiscsi_session_array_grow(struct libiscsi_session_array *arr) -+{ -+ if (arr->size == 0) -+ arr->size = 4; -+ else -+ arr->size *= 2; -+ -+ arr->data = (struct libiscsi_session_info *) realloc( -+ arr->data, -+ arr->size * sizeof(struct libiscsi_session_info)); -+ -+ return arr->data ? 0 : 1; -+} -+ -+static int libiscsi_session_array_grow_ondemand(struct libiscsi_session_array *arr) -+{ -+ if (arr->size == arr->cnt) -+ return libiscsi_session_array_grow(arr); -+ return 0; -+} -+ -+static int libiscsi_session_array_resize_precize(struct libiscsi_session_array *arr) -+{ -+ arr->data = (struct libiscsi_session_info *) realloc( -+ arr->data, -+ arr->cnt * sizeof(struct libiscsi_session_info)); -+ arr->size = arr->cnt; -+ -+ return arr->data ? 0 : 1; -+} -+ -+static void copy_session_info_to_libiscsi_session_info( -+ struct libiscsi_session_info *info, -+ struct session_info *s_info) -+{ -+ /* Copy session info to public struct. */ -+ info->sid = s_info->sid; -+ /* Timeouts */ -+ memcpy(&info->tmo, &s_info->tmo, sizeof(struct libiscsi_session_timeout)); -+ /* CHAP authentication information */ -+ memcpy(&info->chap, &s_info->chap, sizeof(struct libiscsi_chap_auth_info)); -+ /* Target information */ -+ strncpy(info->targetname, s_info->targetname, LIBISCSI_VALUE_MAXLEN); -+ strncpy(info->address, s_info->address, NI_MAXHOST); -+ strncpy(info->persistent_address, s_info->persistent_address, NI_MAXHOST); -+ info->tpgt = s_info->tpgt; -+ info->persistent_port = s_info->persistent_port; -+} -+ -+static int get_sessions_helper(void *data, struct session_info *s_info) -+{ -+ struct libiscsi_session_array *arr = (struct libiscsi_session_array *) data; -+ -+ if (libiscsi_session_array_grow_ondemand(arr) != 0) -+ return 1; -+ -+ copy_session_info_to_libiscsi_session_info(&arr->data[arr->cnt++], s_info); -+ -+ return 0; -+} -+ -+int libiscsi_get_session_infos(struct libiscsi_context *context, -+ struct libiscsi_session_info **infos, -+ int *nr_sessions) -+{ -+ int rc = 0; -+ int nr_found = 0; -+ struct libiscsi_session_array arr; -+ -+ if (!context || !infos || !nr_sessions) -+ return 1; -+ -+ libiscsi_session_array_init(&arr); -+ -+ rc = iscsi_sysfs_for_each_session((void *) &arr, &nr_found, -+ get_sessions_helper, 0); -+ if (rc != 0 || nr_found == 0) { -+ strcpy(context->error_str, "No matching session"); -+ return ENODEV; -+ } -+ -+ if (libiscsi_session_array_resize_precize(&arr) != 0) { -+ strcpy(context->error_str, "Can't allocate memory for session infos"); -+ return ENOMEM; -+ } -+ -+ *infos = arr.data; -+ *nr_sessions = nr_found; -+ -+ return 0; -+} -+ -+int libiscsi_get_session_info_by_id(struct libiscsi_context *context, -+ struct libiscsi_session_info *info, -+ const char *session) -+{ -+ struct session_info s_info; -+ -+ if (!context || !info || !session) -+ return 1; -+ -+ if (iscsi_sysfs_get_sessioninfo_by_id(&s_info, (char*) session) != 0) { -+ strcpy(context->error_str, "No matching session"); -+ return ENODEV; -+ } -+ -+ copy_session_info_to_libiscsi_session_info(info, &s_info); -+ -+ return 0; -+} -+ - int libiscsi_node_set_parameter(struct libiscsi_context *context, - const struct libiscsi_node *node, - const char *parameter, const char *value) -diff --git a/libiscsi/libiscsi.h b/libiscsi/libiscsi.h -index 756590e..a9891f4 100644 ---- a/libiscsi/libiscsi.h -+++ b/libiscsi/libiscsi.h -@@ -3,6 +3,7 @@ - * - * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved. - * Copyright (C) 2008-2009 Hans de Goede -+ * Copyright (C) 2015 Peter Hatina - * maintained by open-iscsi@googlegroups.com - * - * This program is free software; you can redistribute it and/or modify -@@ -56,6 +57,17 @@ enum libiscsi_auth_t { - */ - struct libiscsi_context; - -+/** \brief iSCSI session timeouts -+ * -+ * Struct holding session timeouts. -+ */ -+struct libiscsi_session_timeout { -+ int abort_tmo; -+ int lu_reset_tmo; -+ int recovery_tmo; -+ int tgt_reset_tmo; -+}; -+ - /** \brief iSCSI node record - * - * Struct holding data uniquely identifying an iSCSI node. -@@ -84,6 +96,24 @@ struct libiscsi_chap_auth_info { - char reverse_password[LIBISCSI_VALUE_MAXLEN] /** Reverse Password */; - }; - -+/** \brief iSCSI session -+ * -+ * Struct hoding iSCSI session information. -+ */ -+struct libiscsi_session_info { -+ int sid; -+ -+ struct libiscsi_session_timeout tmo; -+ struct libiscsi_chap_auth_info chap; -+ -+ char targetname[LIBISCSI_VALUE_MAXLEN]; -+ int tpgt; -+ char address[NI_MAXHOST]; -+ int port; -+ char persistent_address[NI_MAXHOST]; -+ int persistent_port; -+}; -+ - /** \brief generic libiscsi authentication information struct - * - * Struct holding authentication information for discovery and login. -@@ -248,6 +278,32 @@ PUBLIC int libiscsi_node_login(struct libiscsi_context *context, - PUBLIC int libiscsi_node_logout(struct libiscsi_context *context, - const struct libiscsi_node *node); - -+/** \brief Get an array of iSCSI sessions. -+ * -+ * Get the array containing iSCSI sessions' information. -+ * -+ * \param context libiscsi context to operate on. -+ * \param infos Array of iSCSI sessions' information. -+ * Release with free(). -+ * \param nr_sessions The number of elements in \e infos. -+ * \return 0 on success, otherwise a standard error code -+ * (from errno.h). -+ */ -+PUBLIC int libiscsi_get_session_infos(struct libiscsi_context *context, -+ struct libiscsi_session_info **infos, int *nr_sessions); -+ -+/** \brief Get session information by session ID. -+ * -+ * \param context libiscsi context to operate on. -+ * \param info iSCSI session information. -+ * \param session Session name. -+ * \return 0 on success, otherwise a standard error code -+ * (from errno.h) -+ */ -+PUBLIC int libiscsi_get_session_info_by_id(struct libiscsi_context *context, -+ struct libiscsi_session_info *info, -+ const char *session); -+ - /** \brief Set an iSCSI parameter for the given node - * - * Set the given nodes iSCSI parameter named by \e parameter to value \e value. -diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c -index 435c576..e549afe 100644 ---- a/usr/iscsi_sysfs.c -+++ b/usr/iscsi_sysfs.c -@@ -3,6 +3,7 @@ - * - * Copyright (C) 2006 Mike Christie - * Copyright (C) 2006 Red Hat, Inc. All rights reserved. -+ * Copyright (C) 2015 Peter Hatina - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published -@@ -1151,6 +1152,11 @@ free_info: - return rc; - } - -+const char *iscsi_sysfs_get_session_path(void) -+{ -+ return ISCSI_SESSION_DIR; -+} -+ - int iscsi_sysfs_for_each_iface_on_host(void *data, uint32_t host_no, - int *nr_found, - iscsi_sysfs_iface_op_fn *fn) -diff --git a/usr/iscsi_sysfs.h b/usr/iscsi_sysfs.h -index 1d0377f..909db34 100644 ---- a/usr/iscsi_sysfs.h -+++ b/usr/iscsi_sysfs.h -@@ -3,6 +3,7 @@ - * - * Copyright (C) 2006 Mike Christie - * Copyright (C) 2006 Red Hat, Inc. All rights reserved. -+ * Copyright (C) 2015 Peter Hatina - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published -@@ -47,6 +48,7 @@ typedef int (iscsi_sysfs_flashnode_op_fn)(void *, struct flashnode_rec *, - uint32_t, uint32_t); - typedef int (iscsi_sysfs_iface_op_fn)(void *, struct iface_rec *); - -+extern const char *iscsi_sysfs_get_session_path(void); - extern int iscsi_sysfs_for_each_iface_on_host(void *data, uint32_t host_no, - int *nr_found, - iscsi_sysfs_iface_op_fn *fn); --- -2.26.2 - diff --git a/0014-remove-the-offload-boot-supported-ifdef.patch b/0009-remove-the-offload-boot-supported-ifdef.patch similarity index 100% rename from 0014-remove-the-offload-boot-supported-ifdef.patch rename to 0009-remove-the-offload-boot-supported-ifdef.patch diff --git a/0015-Revert-iscsiadm-return-error-when-login-fails.patch b/0010-Revert-iscsiadm-return-error-when-login-fails.patch similarity index 100% rename from 0015-Revert-iscsiadm-return-error-when-login-fails.patch rename to 0010-Revert-iscsiadm-return-error-when-login-fails.patch diff --git a/0010-libiscsi-fix-discovery-request-timeout-regression.patch b/0010-libiscsi-fix-discovery-request-timeout-regression.patch deleted file mode 100644 index cddc17c08f1443c91e8864ecb6b4f1d01f226744..0000000000000000000000000000000000000000 --- a/0010-libiscsi-fix-discovery-request-timeout-regression.patch +++ /dev/null @@ -1,32 +0,0 @@ -From c53c576c09c5a3a1654b7a1f08fcc222a102499d Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 28 Feb 2017 09:00:41 -0800 -Subject: [PATCH] libiscsi: fix discovery request timeout regression - ---- - libiscsi/libiscsi.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c -index 755c18c..bb17dfc 100644 ---- a/libiscsi/libiscsi.c -+++ b/libiscsi/libiscsi.c -@@ -136,6 +136,7 @@ int libiscsi_discover_sendtargets(struct libiscsi_context *context, - - /* Fill the drec struct with all needed info */ - memset(&drec, 0, sizeof drec); -+ drec.iscsid_req_tmo = -1; - idbm_sendtargets_defaults(&drec.u.sendtargets); - drec.type = DISCOVERY_TYPE_SENDTARGETS; - strlcpy(drec.address, address, sizeof(drec.address)); -@@ -228,6 +229,7 @@ int libiscsi_discover_firmware(struct libiscsi_context *context, - CHECK(iface_create_ifaces_from_boot_contexts(&ifaces, &targets)); - - memset(&drec, 0, sizeof(drec)); -+ drec.iscsid_req_tmo = -1; - drec.type = DISCOVERY_TYPE_FW; - rc = idbm_bind_ifaces_to_nodes(discovery_fw, &drec, &ifaces, &rec_list); - if (rc) { --- -2.26.2 - diff --git a/0011-libiscsi-format-security-build-errors.patch b/0011-libiscsi-format-security-build-errors.patch deleted file mode 100644 index 421bc3b0d99630227f2cadf4a2fc10cf885db685..0000000000000000000000000000000000000000 --- a/0011-libiscsi-format-security-build-errors.patch +++ /dev/null @@ -1,35 +0,0 @@ -From cf4db608004f7c1f137ed556e3ba6b6f4d65da96 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 28 Feb 2017 10:06:42 -0800 -Subject: [PATCH] libiscsi format-security build errors - ---- - libiscsi/libiscsi.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c -index bb17dfc..7003388 100644 ---- a/libiscsi/libiscsi.c -+++ b/libiscsi/libiscsi.c -@@ -177,7 +177,8 @@ int libiscsi_discover_sendtargets(struct libiscsi_context *context, - *found_nodes = calloc(found, sizeof **found_nodes); - if (*found_nodes == NULL) { - snprintf(context->error_str, -- sizeof(context->error_str), strerror(ENOMEM)); -+ sizeof(context->error_str), -+ "%s", strerror(ENOMEM)); - rc = ENOMEM; - goto leave; - } -@@ -634,7 +635,7 @@ static int get_parameter_helper(void *data, node_rec_t *rec) - info = idbm_recinfo_alloc(MAX_KEYS); - if (!info) { - snprintf(context->error_str, sizeof(context->error_str), -- strerror(ENOMEM)); -+ "%s", strerror(ENOMEM)); - return ENOMEM; - } - --- -2.26.2 - diff --git a/0016-use-var-lib-iscsi-in-libopeniscsiusr.patch b/0011-use-var-lib-iscsi-in-libopeniscsiusr.patch similarity index 55% rename from 0016-use-var-lib-iscsi-in-libopeniscsiusr.patch rename to 0011-use-var-lib-iscsi-in-libopeniscsiusr.patch index 3a780d954c546303cf21803ed467aa1a5dcc9f2c..c0abbd57030d84bd12f7a6b41148c2544cf5edbd 100644 --- a/0016-use-var-lib-iscsi-in-libopeniscsiusr.patch +++ b/0011-use-var-lib-iscsi-in-libopeniscsiusr.patch @@ -1,35 +1,19 @@ -From e186e959ddc2a47e7cfe1f5a8ea4d3fa8248a478 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Wed, 30 May 2018 16:08:30 -0700 -Subject: [PATCH] use /var/lib/iscsi in libopeniscsiusr +From abdce896253f1524a56f174540bd91ecc07c6b52 Mon Sep 17 00:00:00 2001 +From: happy_orange +Date: Thu, 9 Mar 2023 20:28:23 +0800 +Subject: [PATCH 1/1] use /var/lib/iscsi in libopeniscsiusr --- - libopeniscsiusr/idbm.h | 3 ++- libopeniscsiusr/iface.c | 2 +- - libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h | 8 ++++---- + libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h | 6 +++--- libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h | 2 +- - libopeniscsiusr/node.h | 2 +- - 5 files changed, 9 insertions(+), 8 deletions(-) + 3 files changed, 5 insertions(+), 5 deletions(-) -diff --git a/libopeniscsiusr/idbm.h b/libopeniscsiusr/idbm.h -index cc90388..5a4d2fa 100644 ---- a/libopeniscsiusr/idbm.h -+++ b/libopeniscsiusr/idbm.h -@@ -31,7 +31,8 @@ - #include "libopeniscsiusr/libopeniscsiusr_common.h" - - #define ISCSI_CONFIG_ROOT "/etc/iscsi/" --#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces" -+#define ISCSI_VAR_LIB "/var/lib/iscsi/" -+#define IFACE_CONFIG_DIR ISCSI_VAR_LIB"ifaces" - #define AUTH_STR_MAX_LEN 256 - #define BOOT_NAME_MAXLEN 256 - #define IDBM_DUMP_SIZE 8192 diff --git a/libopeniscsiusr/iface.c b/libopeniscsiusr/iface.c -index e7938a5..99ab7b5 100644 +index 006b188..5230f09 100644 --- a/libopeniscsiusr/iface.c +++ b/libopeniscsiusr/iface.c -@@ -381,7 +381,7 @@ int iscsi_default_iface_setup(struct iscsi_context *ctx) +@@ -409,7 +409,7 @@ int iscsi_default_iface_setup(struct iscsi_context *ctx) _good(_iscsi_hids_get(ctx, &hids, &hid_count), rc, out); for (i = 0; i < hid_count; ++i) { @@ -39,7 +23,7 @@ index e7938a5..99ab7b5 100644 _good(_iscsi_ifaces_get_from_sysfs(ctx, hids[i], &ifaces, &iface_count), rc, out); diff --git a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h -index 4395902..81582da 100644 +index a29d5b1..b13e453 100644 --- a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h +++ b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr.h @@ -339,7 +339,7 @@ __DLL_EXPORT void iscsi_session_free(struct iscsi_session *se); @@ -51,15 +35,6 @@ index 4395902..81582da 100644 * * @ctx: * Pointer of 'struct iscsi_context'. -@@ -369,7 +369,7 @@ __DLL_EXPORT int iscsi_default_iface_setup(struct iscsi_context *ctx); - * Retrieves all iSCSI interfaces. For the properties of 'struct iscsi_iface', - * please refer to the functions defined in 'libopeniscsiusr_iface.h' file. - * The returned results contains default iSCSI interfaces(iser and iscsi_tcp) -- * and iSCSI interfaces configured in "/etc/iscsi/ifaces/". -+ * and iSCSI interfaces configured in "/var/lib/iscsi/ifaces/". - * Illegal configuration file will be skipped and warned. - * To generate iSCSI interface configuration when new card installed, please - * use iscsi_default_iface_setup(). @@ -427,7 +427,7 @@ __DLL_EXPORT void iscsi_ifaces_free(struct iscsi_iface **ifaces, * iscsi_iface_get() - Retrieve specified iSCSI interface. * @@ -79,7 +54,7 @@ index 4395902..81582da 100644 * by assert. * @iface: diff --git a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h -index a1a2552..95b0160 100644 +index 9ac1aa5..50f2d1e 100644 --- a/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h +++ b/libopeniscsiusr/libopeniscsiusr/libopeniscsiusr_iface.h @@ -182,7 +182,7 @@ __DLL_EXPORT const char *iscsi_iface_name_get(struct iscsi_iface *iface); @@ -91,19 +66,6 @@ index a1a2552..95b0160 100644 * * @iface: * Pointer of 'struct iscsi_iface'. -diff --git a/libopeniscsiusr/node.h b/libopeniscsiusr/node.h -index 39e07b3..9eba7fa 100644 ---- a/libopeniscsiusr/node.h -+++ b/libopeniscsiusr/node.h -@@ -44,7 +44,7 @@ struct iscsi_node { - char portal[NI_MAXHOST * 2]; - }; - --#define NODE_CONFIG_DIR ISCSI_CONFIG_ROOT"nodes" -+#define NODE_CONFIG_DIR ISCSI_VAR_LIB"nodes" - - /* Might be public in the future */ - __DLL_LOCAL void iscsi_node_free(struct iscsi_node *node); -- -2.26.2 +2.31.1 diff --git a/0017-Coverity-scan-fixes.patch b/0012-Coverity-scan-fixes.patch similarity index 100% rename from 0017-Coverity-scan-fixes.patch rename to 0012-Coverity-scan-fixes.patch diff --git a/0012-libiscsi-fix-build-to-use-libopeniscsiusr.patch b/0012-libiscsi-fix-build-to-use-libopeniscsiusr.patch deleted file mode 100644 index 9b3c34b2140fcc29ae544589d3500208729a0697..0000000000000000000000000000000000000000 --- a/0012-libiscsi-fix-build-to-use-libopeniscsiusr.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a86a677762cf5fd45a43029a4fd3dd83d1a87a98 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Thu, 24 May 2018 15:17:05 -0700 -Subject: [PATCH] libiscsi fix build to use libopeniscsiusr - ---- - libiscsi/Makefile | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/libiscsi/Makefile b/libiscsi/Makefile -index 53f9746..f2cf248 100644 ---- a/libiscsi/Makefile -+++ b/libiscsi/Makefile -@@ -8,7 +8,9 @@ OSNAME=$(shell uname -s) - OPTFLAGS ?= -O2 -g - WARNFLAGS ?= -Wall -Wstrict-prototypes - CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr \ -- -D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden -+ -D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden \ -+ -I../libopeniscsiusr -+LDFLAGS = -L../libopeniscsiusr -lopeniscsiusr - LIB = libiscsi.so.0 - TESTS = tests/test_discovery_sendtargets tests/test_discovery_firmware - TESTS += tests/test_login tests/test_logout tests/test_params -@@ -23,7 +25,7 @@ FW_PARAM_SRCS = fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_sys - # sources shared with the userspace utils, note we build these separately - # to get PIC versions. - COMMON_OBJS = $(patsubst %.o, common-objs/%.o, $(COMMON_SRCS)) --USR_OBJS = $(patsubst %.o, usr-objs/%.o, $(ISCSI_LIB_SRCS) strings.o) -+USR_OBJS = $(patsubst %.o, usr-objs/%.o, $(ISCSI_LIB_SRCS) local_strings.o) - FW_OBJS = $(patsubst %.o, fw-objs/%.o, $(FW_PARAM_SRCS)) - - # Flags for the tests --- -2.26.2 - diff --git a/0019-iscsi_if.h-replace-zero-length-array-with-flexible-a.patch b/0013-iscsi_if.h-replace-zero-length-array-with-flexible-a.patch similarity index 100% rename from 0019-iscsi_if.h-replace-zero-length-array-with-flexible-a.patch rename to 0013-iscsi_if.h-replace-zero-length-array-with-flexible-a.patch diff --git a/0013-libiscsi-fix-build-against-latest-upstream-again.patch b/0013-libiscsi-fix-build-against-latest-upstream-again.patch deleted file mode 100644 index f9f8d07fa2aeec6ce4ba3c5ebc8c4548ad762180..0000000000000000000000000000000000000000 --- a/0013-libiscsi-fix-build-against-latest-upstream-again.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 55af753f593243bcd1ab4c7e82620bdee432915b Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Thu, 7 Nov 2019 09:16:17 -0800 -Subject: [PATCH] libiscsi: fix build against latest upstream, again - ---- - libiscsi/Makefile | 4 ++-- - libiscsi/libiscsi.c | 6 +++--- - 2 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/libiscsi/Makefile b/libiscsi/Makefile -index f2cf248..462d666 100644 ---- a/libiscsi/Makefile -+++ b/libiscsi/Makefile -@@ -10,7 +10,7 @@ WARNFLAGS ?= -Wall -Wstrict-prototypes - CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr \ - -D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden \ - -I../libopeniscsiusr --LDFLAGS = -L../libopeniscsiusr -lopeniscsiusr -+LDFLAGS = -L../libopeniscsiusr -lopeniscsiusr -lkmod -lcrypto - LIB = libiscsi.so.0 - TESTS = tests/test_discovery_sendtargets tests/test_discovery_firmware - TESTS += tests/test_login tests/test_logout tests/test_params -@@ -19,7 +19,7 @@ TESTS += tests/test_set_auth tests/test_get_auth - - COMMON_SRCS = sysdeps.o - # sources shared between iscsid, iscsiadm and iscsistart --ISCSI_LIB_SRCS = netlink.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o io.o auth.o discovery.o login.o log.o md5.o sha1.o iface.o idbm.o sysfs.o iscsi_sysfs.o iscsi_net_util.o iscsid_req.o iser.o uip_mgmt_ipc.o -+ISCSI_LIB_SRCS = netlink.o transport.o cxgbi.o be2iscsi.o iscsi_timer.o initiator_common.o iscsi_err.o session_info.o iscsi_util.o io.o auth.o discovery.o login.o log.o iface.o idbm.o sysfs.o iscsi_sysfs.o iscsi_net_util.o iscsid_req.o iser.o uip_mgmt_ipc.o - FW_PARAM_SRCS = fw_entry.o prom_lex.o prom_parse.tab.o fwparam_ppc.o fwparam_sysfs.o - - # sources shared with the userspace utils, note we build these separately -diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c -index 7003388..c598aee 100644 ---- a/libiscsi/libiscsi.c -+++ b/libiscsi/libiscsi.c -@@ -429,7 +429,7 @@ int libiscsi_node_login(struct libiscsi_context *context, - - CHECK(idbm_for_each_iface(&nr_found, (void*)node->iface, login_helper, - (char *)node->name, node->tpgt, -- (char *)node->address, node->port)) -+ (char *)node->address, node->port, false)) - if (nr_found == 0) { - strcpy(context->error_str, "No such node"); - rc = ENODEV; -@@ -615,7 +615,7 @@ int libiscsi_node_set_parameter(struct libiscsi_context *context, - - CHECK(idbm_for_each_iface(&nr_found, ¶ms, idbm_node_set_param, - (char *)node->name, node->tpgt, -- (char *)node->address, node->port)) -+ (char *)node->address, node->port, false)) - if (nr_found == 0) { - strcpy(context->error_str, "No such node"); - rc = ENODEV; -@@ -677,7 +677,7 @@ int libiscsi_node_get_parameter(struct libiscsi_context *context, - as most settings should be the same independent of the iface. */ - CHECK(idbm_for_each_iface(&nr_found, context, get_parameter_helper, - (char *)node->name, node->tpgt, -- (char *)node->address, node->port)) -+ (char *)node->address, node->port, false)) - if (nr_found == 0) { - strcpy(context->error_str, "No such node"); - rc = ENODEV; --- -2.26.2 - diff --git a/0021-minor-service-file-updates.patch b/0014-minor-service-file-updates.patch similarity index 54% rename from 0021-minor-service-file-updates.patch rename to 0014-minor-service-file-updates.patch index bb0caa6abcd9c8e63746c46bea249ba45ceebf3f..06892949e8d5f013ba78af738706dd28633923ff 100644 --- a/0021-minor-service-file-updates.patch +++ b/0014-minor-service-file-updates.patch @@ -1,30 +1,30 @@ -From b8c6c1f3bed0e5fcc0d02c56834fa60850a11b5f Mon Sep 17 00:00:00 2001 +From 405c79b48a3d04f8aeb9017226a73bb6d2493a5f Mon Sep 17 00:00:00 2001 From: Chris Leech -Date: Thu, 18 Feb 2021 14:04:32 -0800 +Date: Thu, 9 Mar 2023 19:15:27 +0800 Subject: [PATCH 1/1] minor service file updates --- - etc/systemd/iscsi-init.service | 1 + - etc/systemd/iscsi.service | 2 +- - etc/systemd/iscsid.service | 3 +-- + etc/systemd/iscsi-init.service.template | 1 + + etc/systemd/iscsi.service.template | 2 +- + etc/systemd/iscsid.service.template | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) -diff --git a/etc/systemd/iscsi-init.service b/etc/systemd/iscsi-init.service -index 17792da..f635c41 100644 ---- a/etc/systemd/iscsi-init.service -+++ b/etc/systemd/iscsi-init.service +diff --git a/etc/systemd/iscsi-init.service.template b/etc/systemd/iscsi-init.service.template +index 51dd052..160e579 100644 +--- a/etc/systemd/iscsi-init.service.template ++++ b/etc/systemd/iscsi-init.service.template @@ -1,6 +1,7 @@ [Unit] Description=One time configuration for iscsi.service ConditionPathExists=!/etc/iscsi/initiatorname.iscsi +Before=iscsid.service DefaultDependencies=no - After=root.mount - -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index 175cb2c..6c542d2 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service + RequiresMountsFor=/etc/iscsi + # systemd-remount-fs.service is optionally pulled in by +diff --git a/etc/systemd/iscsi.service.template b/etc/systemd/iscsi.service.template +index 125d225..08adff7 100644 +--- a/etc/systemd/iscsi.service.template ++++ b/etc/systemd/iscsi.service.template @@ -4,7 +4,7 @@ Documentation=man:iscsiadm(8) man:iscsid(8) DefaultDependencies=no Before=remote-fs-pre.target @@ -34,10 +34,10 @@ index 175cb2c..6c542d2 100644 ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes [Service] -diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service +diff --git a/etc/systemd/iscsid.service.template b/etc/systemd/iscsid.service.template index 324c593..df0bd83 100644 ---- a/etc/systemd/iscsid.service -+++ b/etc/systemd/iscsid.service +--- a/etc/systemd/iscsid.service.template ++++ b/etc/systemd/iscsid.service.template @@ -4,7 +4,7 @@ Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8) DefaultDependencies=no After=network-online.target iscsiuio.service iscsi-init.service @@ -53,5 +53,5 @@ index 324c593..df0bd83 100644 WantedBy=multi-user.target -Also=iscsid.socket -- -2.27.0 +2.31.1 diff --git a/0015-try-not-to-require-network-online.patch b/0015-try-not-to-require-network-online.patch new file mode 100644 index 0000000000000000000000000000000000000000..c8a30b1a5950eec9e0bdb064f22d0a926d330e54 --- /dev/null +++ b/0015-try-not-to-require-network-online.patch @@ -0,0 +1,46 @@ +From 96cde94de6794b9129c2cbb05cea3bce4f032c75 Mon Sep 17 00:00:00 2001 +Date: Fri, 10 Mar 2023 11:11:23 +0800 +Subject: [PATCH 1/1] try not to require network online + +--- + etc/Makefile | 3 ++- + etc/systemd/iscsi-starter.service.template | 13 +++++++++++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + create mode 100644 etc/systemd/iscsi-starter.service.template + +diff --git a/etc/Makefile b/etc/Makefile +index 6dd6a41..a539bed 100644 +--- a/etc/Makefile ++++ b/etc/Makefile +@@ -27,7 +27,8 @@ SYSTEMD_SOURCES = $(addprefix systemd/,$(SYSTEMD_SOURCE_FILES)) + SYSTEMD_TEMPLATE_FILES = iscsi-init.service.template \ + iscsid.service.template \ + iscsi.service.template \ +- iscsiuio.service.template ++ iscsiuio.service.template \ ++ iscsi-starter.service.template + SYSTEMD_TEMPLATES = $(addprefix systemd/,$(SYSTEMD_TEMPLATE_FILES)) + SYSTEMD_RULES_FILES = ibft-rule-generator + SYSTEMD_RULES_SOURCES = $(addprefix systemd/,$(SYSTEMD_RULES_FILES)) +diff --git a/etc/systemd/iscsi-starter.service.template b/etc/systemd/iscsi-starter.service.template +new file mode 100644 +index 0000000..db24e5e +--- /dev/null ++++ b/etc/systemd/iscsi-starter.service.template +@@ -0,0 +1,13 @@ ++[Unit] ++DefaultDependencies=no ++Before=sysinit.target iscsi.service ++RequiresMountsFor=/var/lib/iscsi/nodes ++ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes ++ ++[Service] ++Type=oneshot ++RemainAfterExit=true ++ExecStart=systemctl start --no-block --job-mode=fail iscsi.service ++ ++[Install] ++WantedBy=sysinit.target +-- +2.31.1 + diff --git a/0016-add-some-service-in-system.patch b/0016-add-some-service-in-system.patch new file mode 100644 index 0000000000000000000000000000000000000000..7fb2e03341d08f4ef7ab8edf628bfb0b858e0c84 --- /dev/null +++ b/0016-add-some-service-in-system.patch @@ -0,0 +1,115 @@ +From a29ea3e4f2f8b31a71ef14509dbf12a50c5a4f85 Mon Sep 17 00:00:00 2001 +Date: Fri, 10 Mar 2023 11:30:25 +0800 +Subject: [PATCH 1/1] add some service in system + +--- + etc/Makefile | 4 ++- + etc/systemd/iscsi-mark-root-nodes | 35 +++++++++++++++++++++ + etc/systemd/iscsi-onboot.service.template | 15 +++++++++ + etc/systemd/iscsi-shutdown.service.template | 15 +++++++++ + 4 files changed, 68 insertions(+), 1 deletion(-) + create mode 100644 etc/systemd/iscsi-mark-root-nodes + create mode 100644 etc/systemd/iscsi-onboot.service.template + create mode 100644 etc/systemd/iscsi-shutdown.service.template + +diff --git a/etc/Makefile b/etc/Makefile +index a539bed..f327f27 100644 +--- a/etc/Makefile ++++ b/etc/Makefile +@@ -28,7 +28,9 @@ SYSTEMD_TEMPLATE_FILES = iscsi-init.service.template \ + iscsid.service.template \ + iscsi.service.template \ + iscsiuio.service.template \ +- iscsi-starter.service.template ++ iscsi-starter.service.template \ ++ iscsi-onboot.service.template \ ++ iscsi-shutdown.service.template + SYSTEMD_TEMPLATES = $(addprefix systemd/,$(SYSTEMD_TEMPLATE_FILES)) + SYSTEMD_RULES_FILES = ibft-rule-generator + SYSTEMD_RULES_SOURCES = $(addprefix systemd/,$(SYSTEMD_RULES_FILES)) +diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes +new file mode 100644 +index 0000000..a083ea6 +--- /dev/null ++++ b/etc/systemd/iscsi-mark-root-nodes +@@ -0,0 +1,35 @@ +++#!/bin/bash ++ ++SCSIADM=/usr/sbin/iscsiadm ++start_iscsid=0 ++start_iscsiuio=0 ++ ++while read t num p target flash; do ++ # strip tag number from portal, keep "ip:port" ++ portal=${p%,*} ++ transport=${t%:} ++ ++ # use session number to find the iface name in use ++ num=${num#[}; num=${num%]} ++ iface=$(iscsiadm -m session -r $num | grep iface.iscsi_ifacename | cut -d= -f2) ++ ++ $ISCSIADM -m node -p $portal -T $target -I $iface -o update -n node.startup -v onboot ++ ++ start_iscsid=1 ++ ++ if [ "$transport" = bnx2i ] || [ "$transport" = qedi ]; then ++ start_iscsiuio=1 ++ fi ++done < <( $ISCSIADM -m session ) ++ ++# force iscsid and iscsiuio to start if needed for ++# recovering sessions created in the initrd ++ ++if [ "$start_iscsid" -eq 1 ]; then ++ systemctl --no-block start iscsid.service ++fi ++if [ "$start_iscsiuio" -eq 1 ]; then ++ systemctl --no-block start iscsiuio.service ++fi ++i]} ++ +diff --git a/etc/systemd/iscsi-onboot.service.template b/etc/systemd/iscsi-onboot.service.template +new file mode 100644 +index 0000000..42ced68 +--- /dev/null ++++ b/etc/systemd/iscsi-onboot.service.template +@@ -0,0 +1,15 @@ ++[Unit] ++Description=Special handling of early boot iSCSI sessions ++Documentation=man:iscsiadm(8) man:iscsid(8) ++DefaultDependencies=no ++RefuseManualStart=true ++Before=iscsi.service ++After=systemd-remount-fs.service ++ConditionDirectoryNotEmpty=/sys/class/iscsi_session ++ ++[Service] ++Type=oneshot ++ExecStart=-/usr/libexec/iscsi-mark-root-nodes ++ ++[Install] ++WantedBy=sysinit.target +diff --git a/etc/systemd/iscsi-shutdown.service.template b/etc/systemd/iscsi-shutdown.service.template +new file mode 100644 +index 0000000..caee933 +--- /dev/null ++++ b/etc/systemd/iscsi-shutdown.service.template +@@ -0,0 +1,15 @@ ++[Unit] ++Description=Logout off all iSCSI sessions on shutdown ++Documentation=man:iscsid(8) man:iscsiadm(8) ++DefaultDependencies=no ++Conflicts=shutdown.target ++After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service ++Before=remote-fs-pre.target ++Wants=remote-fs-pre.target ++RefuseManualStop=yes ++ ++[Service] ++Type=oneshot ++RemainAfterExit=true ++ExecStart=-/usr/bin/true ++ExecStop=-/usr/sbin/iscsiadm -m node --logoutall=all +-- +2.31.1 + diff --git a/0018-fix-upstream-build-breakage-of-iscsiuio-LDFLAGS.patch b/0018-fix-upstream-build-breakage-of-iscsiuio-LDFLAGS.patch deleted file mode 100644 index 142fcdea05b2b2cd447844c47fae0cfb1a329f18..0000000000000000000000000000000000000000 --- a/0018-fix-upstream-build-breakage-of-iscsiuio-LDFLAGS.patch +++ /dev/null @@ -1,25 +0,0 @@ -From b50ab4a08a12593985b14aece5f689e485647b1c Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Wed, 16 Oct 2019 23:17:20 -0700 -Subject: [PATCH 1/1] fix upstream build breakage of iscsiuio LDFLAGS - ---- - iscsiuio/configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/iscsiuio/configure.ac b/iscsiuio/configure.ac -index 9b85448..5dc188b 100644 ---- a/iscsiuio/configure.ac -+++ b/iscsiuio/configure.ac -@@ -72,7 +72,7 @@ AC_ARG_WITH([systemd], - *) AC_MSG_ERROR([bad value $withval for --with-systemd]) ;; - esac],[with_libsystemd=auto]) - AS_IF([test "$with_libsystemd" != no],[ -- PKG_CHECK_MODULES([LIBSYSTEMD],[libsystemd],[LDFLAGS=$LIBSYSTEMD_LIBS],[ -+ PKG_CHECK_MODULES([LIBSYSTEMD],[libsystemd],[LDFLAGS="$LDFLAGS $LIBSYSTEMD_LIBS"],[ - if test "$with_libsystemd" = yes; then - AC_MSG_ERROR([could not find libsystemd using pkg-config]) - else --- -2.26.3 - diff --git a/0020-stop-using-Werror-for-now.patch b/0020-stop-using-Werror-for-now.patch deleted file mode 100644 index 55a1f3cebfaa60d8afe08319738f30188b122993..0000000000000000000000000000000000000000 --- a/0020-stop-using-Werror-for-now.patch +++ /dev/null @@ -1,39 +0,0 @@ -From af428f588f8023784c6f4b0a25d13b70fb7216ab Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 3 Mar 2020 10:35:40 -0800 -Subject: [PATCH] stop using Werror for now - ---- - usr/Makefile | 2 +- - usr/initiator.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/usr/Makefile b/usr/Makefile -index 020ff7e..f203a19 100644 ---- a/usr/Makefile -+++ b/usr/Makefile -@@ -35,7 +35,7 @@ endif - PKG_CONFIG = /usr/bin/pkg-config - - CFLAGS ?= -O2 -g --WARNFLAGS ?= -Wall -Wextra -Werror -Wstrict-prototypes -fno-common -+WARNFLAGS ?= -Wall -Wextra -Wstrict-prototypes -fno-common - CFLAGS += $(WARNFLAGS) -I../include -I. -D_GNU_SOURCE \ - -I$(TOPDIR)/libopeniscsiusr -DISNS_ENABLE - CFLAGS += $(shell $(PKG_CONFIG) --cflags libkmod) -diff --git a/usr/initiator.c b/usr/initiator.c -index 40d297f..5ede26c 100644 ---- a/usr/initiator.c -+++ b/usr/initiator.c -@@ -581,7 +581,7 @@ __session_conn_reopen(iscsi_conn_t *conn, queue_task_t *qtask, int do_stop, - int redirected) - { - iscsi_session_t *session = conn->session; -- uint32_t delay; -+ uint32_t delay = 0; - - log_debug(1, "re-opening session %d (reopen_cnt %d)", session->id, - session->reopen_cnt); --- -2.27.0 - diff --git a/1001-add-ISCSI_VERSION_STR-define.patch b/1001-add-ISCSI_VERSION_STR-define.patch new file mode 100644 index 0000000000000000000000000000000000000000..3427db4b681f36b5993d3fcbdb31d890d4a7270c --- /dev/null +++ b/1001-add-ISCSI_VERSION_STR-define.patch @@ -0,0 +1,25 @@ +From 3518aebee85edf2da8df1cbcad1bc0f3588405a5 Mon Sep 17 00:00:00 2001 +From: happy_orange +Date: Fri, 10 Mar 2023 17:27:55 +0800 +Subject: [PATCH 1/1] add ISCSI_VERSION_STR define + +--- + usr/version.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usr/version.h b/usr/version.h +index f8be671..328d650 100644 +--- a/usr/version.h ++++ b/usr/version.h +@@ -9,7 +9,7 @@ + * Version string should be set by the build system, else we have problems + */ + #ifndef ISCSI_VERSION_STR +-#error Must set ISCSI_VERSION_STR ++#define ISCSI_VERSION_STR "2.1.8" + #endif + #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" + +-- +2.31.1 + diff --git a/1002-fix-the-libiscsi-build-error.patch b/1002-fix-the-libiscsi-build-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..12925dba0910d467e0b166f0ead2c9b9b8ba5019 --- /dev/null +++ b/1002-fix-the-libiscsi-build-error.patch @@ -0,0 +1,36 @@ +From 152ac0d58d3f2915b6b9af98fb2ed47aeede9972 Mon Sep 17 00:00:00 2001 +From: happy_orange +Date: Tue, 14 Mar 2023 20:16:29 +0800 +Subject: [PATCH 1/1] fix the libiscsi build error + +--- + libiscsi/Makefile | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/libiscsi/Makefile b/libiscsi/Makefile +index f28a62d..e0df9f0 100644 +--- a/libiscsi/Makefile ++++ b/libiscsi/Makefile +@@ -4,11 +4,18 @@ ifeq ($(TOPDIR),) + TOPDIR = .. + endif + ++#ifndef ISCSI_DB_ROOT ++#define ISCSI_DB_ROOT "/var/lib/iscsi" ++#endif ++ ++ISCSI_VERSION_STR ?= 2.1.8 + OSNAME=$(shell uname -s) + OPTFLAGS ?= -O2 -g + WARNFLAGS ?= -Wall -Wstrict-prototypes + CFLAGS = $(OPTFLAGS) $(WARNFLAGS) -I../include -I../usr \ +- -D$(OSNAME) -fPIC -D_GNU_SOURCE -fvisibility=hidden \ ++ -D$(OSNAME) -fPIC -D_GNU_SOURCE -DISNS_ENABLE \ ++ -fvisibility=hidden -DISCSI_VERSION_STR=\"$(ISCSI_VERSION_STR)\"\ ++ -DSBINDIR=\"/sbin\" -DISCSI_DB_ROOT=\"$(ISCSI_DB_ROOT)\" \ + -I../libopeniscsiusr + LDFLAGS = -L../libopeniscsiusr -lopeniscsiusr -lkmod -lcrypto + LIB = libiscsi.so.0 +-- +2.31.1 + diff --git a/1003-change-the-sbin-dir-to-usr-sbin.patch b/1003-change-the-sbin-dir-to-usr-sbin.patch new file mode 100644 index 0000000000000000000000000000000000000000..2ab79418e0decffb1aa4f86d9386e076e1572c7a --- /dev/null +++ b/1003-change-the-sbin-dir-to-usr-sbin.patch @@ -0,0 +1,39 @@ +From 6b04c754f0fa06c88c7248705c5b7cc8cfe75b69 Mon Sep 17 00:00:00 2001 +From: happy_orange +Date: Tue, 14 Mar 2023 20:26:32 +0800 +Subject: [PATCH 1/1] change the sbin dir to usr/sbin + +--- + Makefile | 2 +- + libopeniscsiusr/Makefile | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index dad878f..62181f6 100644 +--- a/Makefile ++++ b/Makefile +@@ -10,7 +10,7 @@ DESTDIR ?= + ISCSI_VERSION_STR ?= 2.1.8 + + prefix = /usr +-exec_prefix = ++exec_prefix = $(prefix) + mandir = $(prefix)/share/man + etcdir = /etc + +diff --git a/libopeniscsiusr/Makefile b/libopeniscsiusr/Makefile +index 0d215fc..0318396 100644 +--- a/libopeniscsiusr/Makefile ++++ b/libopeniscsiusr/Makefile +@@ -11,7 +11,7 @@ endif + DESTDIR ?= + prefix ?= /usr + INSTALL ?= install +-exec_prefix = ++exec_prefix = $(prefix) + etcdir = /etc + SBINDIR ?= $(exec_prefix)/sbin + DBROOT ?= $(etcdir)/iscsi +-- +2.31.1 + diff --git a/2.1.8.tar.gz b/2.1.8.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..b2f8a4028597203290aedd527fb7d2f99752b964 Binary files /dev/null and b/2.1.8.tar.gz differ diff --git a/iscsi-initiator-utils-2.1.6.tar.gz b/iscsi-initiator-utils-2.1.6.tar.gz deleted file mode 100644 index 37308bdb5215bda7450b954e960de64657cf96c2..0000000000000000000000000000000000000000 Binary files a/iscsi-initiator-utils-2.1.6.tar.gz and /dev/null differ diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec index 212c30f6b6edfed3022e1ee40bf62044603036ba..a96b50b7cb8eca276271235fe547d2cb8dce2fb7 100644 --- a/iscsi-initiator-utils.spec +++ b/iscsi-initiator-utils.spec @@ -1,15 +1,16 @@ -%define anolis_release 3 +%define anolis_release 1 Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils -Version: 2.1.6 +Version: 2.1.8 Release: %{anolis_release}%{?dist} License: GPLv2+ URL: https://github.com/open-iscsi/open-iscsi -Source0: %{url}/archive/refs/tags/%{version}.tar.gz#/iscsi-initiator-utils-%{version}.tar.gz +Source0: https://github.com/open-iscsi/open-iscsi/archive/refs/tags/%{version}.tar.gz Source1: 04-iscsi Source2: iscsi-tmpfiles.conf + Patch0001: 0001-unit-file-tweaks.patch Patch0002: 0002-idmb_rec_write-check-for-tpgt-first.patch Patch0003: 0003-idbm_rec_write-seperate-old-and-new-style-writes.patch @@ -17,30 +18,26 @@ Patch0004: 0004-idbw_rec_write-pick-tpgt-from-existing-record.patch Patch0005: 0005-update-initscripts-and-docs.patch Patch0006: 0006-use-var-for-config.patch Patch0007: 0007-libiscsi.patch -Patch0008: 0008-Add-macros-to-release-GIL-lock.patch -Patch0009: 0009-libiscsi-introduce-sessions-API.patch -Patch0010: 0010-libiscsi-fix-discovery-request-timeout-regression.patch -Patch0011: 0011-libiscsi-format-security-build-errors.patch -Patch0012: 0012-libiscsi-fix-build-to-use-libopeniscsiusr.patch -Patch0013: 0013-libiscsi-fix-build-against-latest-upstream-again.patch -Patch0014: 0014-remove-the-offload-boot-supported-ifdef.patch -Patch0015: 0015-Revert-iscsiadm-return-error-when-login-fails.patch -Patch0016: 0016-use-var-lib-iscsi-in-libopeniscsiusr.patch -Patch0017: 0017-Coverity-scan-fixes.patch -Patch0018: 0018-fix-upstream-build-breakage-of-iscsiuio-LDFLAGS.patch -Patch0019: 0019-iscsi_if.h-replace-zero-length-array-with-flexible-a.patch -Patch0020: 0020-stop-using-Werror-for-now.patch -Patch0021: 0021-minor-service-file-updates.patch - +Patch0008: 0008-libiscsi-introduce-sessions-API.patch +Patch0009: 0009-remove-the-offload-boot-supported-ifdef.patch +Patch0010: 0010-Revert-iscsiadm-return-error-when-login-fails.patch +Patch0011: 0011-use-var-lib-iscsi-in-libopeniscsiusr.patch +Patch0012: 0012-Coverity-scan-fixes.patch +Patch0013: 0013-iscsi_if.h-replace-zero-length-array-with-flexible-a.patch +Patch0014: 0014-minor-service-file-updates.patch +Patch0015: 0015-try-not-to-require-network-online.patch +Patch0016: 0016-add-some-service-in-system.patch +#Patch0017: 0017-add-ISCSI_VERSION_STR-define.patch + +Patch1001: 1001-add-ISCSI_VERSION_STR-define.patch +Patch1002: 1002-fix-the-libiscsi-build-error.patch +Patch1003: 1003-change-the-sbin-dir-to-usr-sbin.patch BuildRequires: flex bison doxygen kmod-devel systemd-units BuildRequires: autoconf automake libtool libmount-devel openssl-devel -BuildRequires: isns-utils-devel pkg-config +BuildRequires: isns-utils-devel BuildRequires: systemd-devel Requires: %{name}-iscsiuio >= %{version}-%{release} -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd # Old NetworkManager expects the dispatcher scripts in a different place Conflicts: NetworkManager < 1.20 @@ -72,19 +69,18 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package -n python3-%{name} -%{?python_provide:%python_provide python3-%{name}} Summary: Python %{python3_version} bindings to %{name} Requires: %{name} = %{version}-%{release} BuildRequires: python3-devel BuildRequires: python3-setuptools -BuildRequires: make +#BuildRequires: make %description -n python3-%{name} The %{name}-python3 package contains Python %{python3_version} bindings to the libiscsi interface for interacting with %{name} %prep -%autosetup -p1 -n open-iscsi-2.1.6 +%autosetup -p1 -n open-iscsi-%{version} # change exec_prefix, there's no easy way to override %{__sed} -i -e 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile @@ -101,13 +97,12 @@ autoreconf --install cd .. %{__make} OPTFLAGS="%{optflags} %{?__global_ldflags}" -pushd libiscsi +pushd libiscsi %py3_build touch -r libiscsi.doxy html/* popd - %install %{__make} DESTDIR=%{?buildroot} LIB_DIR=%{_libdir} \ install_programs \ @@ -119,8 +114,10 @@ popd rm $RPM_BUILD_ROOT%{_mandir}/man8/iscsi_discovery.8 rm $RPM_BUILD_ROOT%{_mandir}/man8/iscsi_fw_login.8 %{__install} -pm 755 usr/iscsistart $RPM_BUILD_ROOT%{_sbindir} +%{__install} -pm 755 iscsiuio/src/unix/iscsiuio $RPM_BUILD_ROOT%{_sbindir} %{__install} -pm 644 doc/iscsistart.8 $RPM_BUILD_ROOT%{_mandir}/man8 %{__install} -pm 644 doc/iscsi-iname.8 $RPM_BUILD_ROOT%{_mandir}/man8 +%{__install} -pm 644 iscsiuio/docs/iscsiuio.8 $RPM_BUILD_ROOT%{_mandir}/man8 %{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d %{__install} -pm 644 iscsiuio/iscsiuiolog $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d @@ -139,6 +136,7 @@ touch $RPM_BUILD_ROOT%{_rundir}/lock/iscsi/lock %{__install} -d $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsi.service $RPM_BUILD_ROOT%{_unitdir} +%{__install} -pm 644 etc/systemd/iscsi-starter.service $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsi-init.service $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsi-onboot.service $RPM_BUILD_ROOT%{_unitdir} %{__install} -pm 644 etc/systemd/iscsi-shutdown.service $RPM_BUILD_ROOT%{_unitdir} @@ -162,22 +160,25 @@ touch $RPM_BUILD_ROOT%{_rundir}/lock/iscsi/lock %{__install} -d $RPM_BUILD_ROOT%{_includedir} %{__install} -pm 644 libiscsi/libiscsi.h $RPM_BUILD_ROOT%{_includedir} +mkdir -p $RPM_BUILD_ROOT/%{_udevrulesdir} +mv $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/50-iscsi-firmware-login.rules $RPM_BUILD_ROOT/%{_udevrulesdir}/50-iscsi-firmware-login.rules +rm -rf $RPM_BUILD_ROOT/%{_sysconfdir}/udev + %{__install} -d $RPM_BUILD_ROOT%{python3_sitearch} pushd libiscsi - %py3_install popd %generate_compatibility_deps %post -%systemd_post iscsi.service iscsid.service iscsid.socket iscsi-onboot.service iscsi-init.service iscsi-shutdown.service +%systemd_post iscsi.service iscsi-starter.service iscsid.service iscsid.socket iscsi-onboot.service iscsi-init.service iscsi-shutdown.service %preun -%systemd_preun iscsi.service iscsid.service iscsid.socket iscsi-onboot.service iscsi-init.service iscsi-shutdown.service +%systemd_preun iscsi.service iscsi-starter.service iscsid.service iscsid.socket iscsi-onboot.service iscsi-init.service iscsi-shutdown.service %postun -%systemd_postun iscsi.service iscsid.service iscsid.socket iscsi-onboot.service iscsi-init.service iscsi-shutdown.service +%systemd_postun iscsi.service iscsi-starter.service iscsid.service iscsid.socket iscsi-onboot.service iscsi-init.service iscsi-shutdown.service %post iscsiuio %systemd_post iscsiuio.service iscsiuio.socket @@ -188,28 +189,8 @@ popd %postun iscsiuio %systemd_postun iscsiuio.service iscsiuio.socket -%triggerun -- iscsi-initiator-utils < 6.2.0.873-25 - -if [ $1 -gt 0 ]; then - /usr/bin/systemctl -q is-active iscsi.service - if [ $? -eq 0 ]; then - /usr/bin/systemctl -q is-active remote-fs-pre.target - if [ $? -ne 0 ]; then - SRC=`/usr/bin/systemctl show --property FragmentPath remote-fs-pre.target | cut -d= -f2` - DST=/run/systemd/system/remote-fs-pre.target - if [ $SRC != $DST ]; then - cp $SRC $DST - fi - sed -i 's/RefuseManualStart=yes/RefuseManualStart=no/' $DST - /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : - /usr/bin/systemctl start remote-fs-pre.target >/dev/null 2>&1 || : - fi - fi -fi - -if [ $1 -gt 0 ]; then - systemctl start iscsi-shutdown.service >/dev/null 2>&1 || : -fi +%triggerun -- iscsi-initiator-utils < 2.1.4 +systemctl --no-reload preset iscsi.service iscsi-starter.service &>/dev/null || : %files %dir %{abidir} @@ -224,6 +205,7 @@ fi %ghost %attr(0700, root, root) %{_rundir}/lock/iscsi %ghost %attr(0600, root, root) %{_rundir}/lock/iscsi/lock %{_unitdir}/iscsi.service +%{_unitdir}/iscsi-starter.service %{_unitdir}/iscsi-onboot.service %{_unitdir}/iscsi-init.service %{_unitdir}/iscsi-shutdown.service @@ -256,6 +238,8 @@ fi %{_libdir}/libopeniscsiusr.so.* %{abidir}/libopeniscsiusr.dump %{abidir}/libiscsi.dump +%{_mandir}/man3/* +%{_udevrulesdir}/50-iscsi-firmware-login.rules %files iscsiuio %{_sbindir}/iscsiuio @@ -282,6 +266,9 @@ fi %{abidir}/libiscsi.cpython-310-%{_arch}-linux-gnu.dump %changelog +* Tue Mar 07 2023 happy_orange - 2.1.8-1 +- update to 2.1.8 + * Thu Dec 01 2022 Chunmei Xu - 2.1.6-3 - fix iscsi-init.service start failed