From e8d2112810030c9bd5eb9390420c7f986684a933 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Jun 19 2018 21:49:00 +0000 Subject: rebase to 2.0.876 --- diff --git a/0001-idmb_rec_write-check-for-tpgt-first.patch b/0001-idmb_rec_write-check-for-tpgt-first.patch index cab0a97..3a8a16f 100644 --- a/0001-idmb_rec_write-check-for-tpgt-first.patch +++ b/0001-idmb_rec_write-check-for-tpgt-first.patch @@ -1,4 +1,4 @@ -From 9d49de368fbe87827d1819298cb9f3328e825f05 Mon Sep 17 00:00:00 2001 +From ea8792d568c8d308fde2234c18983b131b0247d5 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Tue, 13 Aug 2013 10:59:44 -0700 Subject: [PATCH 01/22] idmb_rec_write, check for tpgt first @@ -11,10 +11,10 @@ for splitting it up. 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/usr/idbm.c b/usr/idbm.c -index 3b8a5a2..1c59033 100644 +index 5532202cb959..b5b86269f6bf 100644 --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -2041,6 +2041,10 @@ static int idbm_rec_write(node_rec_t *rec) +@@ -2049,6 +2049,10 @@ static int idbm_rec_write(node_rec_t *rec) if (rc) goto free_portal; @@ -25,7 +25,7 @@ index 3b8a5a2..1c59033 100644 rc = stat(portal, &statb); if (rc) { rc = 0; -@@ -2049,23 +2053,11 @@ static int idbm_rec_write(node_rec_t *rec) +@@ -2057,22 +2061,10 @@ static int idbm_rec_write(node_rec_t *rec) * set the tgpt. In new versions you must pass all the info in * from the start */ @@ -38,7 +38,7 @@ index 3b8a5a2..1c59033 100644 } if (!S_ISDIR(statb.st_mode)) { - /* +- /* - * older iscsiadm versions had you create the config then set - * set the tgpt. In new versions you must pass all the info in - * from the start @@ -46,10 +46,9 @@ index 3b8a5a2..1c59033 100644 - if (rec->tpgt == PORTAL_GROUP_TAG_UNKNOWN) - /* drop down to old style portal as config */ - goto open_conf; -- /* + /* * Old style portal as a file, but with tpgt. Let's update it. */ - if (unlink(portal)) { -- -2.9.3 +2.14.3 diff --git a/0002-idbm_rec_write-seperate-old-and-new-style-writes.patch b/0002-idbm_rec_write-seperate-old-and-new-style-writes.patch index c6adac9..7003d9b 100644 --- a/0002-idbm_rec_write-seperate-old-and-new-style-writes.patch +++ b/0002-idbm_rec_write-seperate-old-and-new-style-writes.patch @@ -1,4 +1,4 @@ -From 33ea65a592d9666b3353736db0a33041089c211c Mon Sep 17 00:00:00 2001 +From ca58932fdba91911ceb7fe59bff3206c073671cf Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Tue, 13 Aug 2013 11:34:31 -0700 Subject: [PATCH 02/22] idbm_rec_write, seperate old and new style writes @@ -9,10 +9,10 @@ Duplicates a small bit of code, but easier to understand and extened. 1 file changed, 79 insertions(+), 37 deletions(-) diff --git a/usr/idbm.c b/usr/idbm.c -index 1c59033..76816f2 100644 +index b5b86269f6bf..d69a5c5c41a2 100644 --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -2000,7 +2000,7 @@ mkdir_portal: +@@ -2008,7 +2008,7 @@ mkdir_portal: return f; } @@ -21,7 +21,7 @@ index 1c59033..76816f2 100644 { struct stat statb; FILE *f; -@@ -2012,38 +2012,8 @@ static int idbm_rec_write(node_rec_t *rec) +@@ -2020,38 +2020,8 @@ static int idbm_rec_write(node_rec_t *rec) log_error("Could not alloc portal"); return ISCSI_ERR_NOMEM; } @@ -60,7 +60,7 @@ index 1c59033..76816f2 100644 rc = stat(portal, &statb); if (rc) { -@@ -2064,11 +2034,11 @@ static int idbm_rec_write(node_rec_t *rec) +@@ -2072,11 +2042,11 @@ static int idbm_rec_write(node_rec_t *rec) log_error("Could not convert %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; @@ -74,7 +74,7 @@ index 1c59033..76816f2 100644 } mkdir_portal: -@@ -2079,24 +2049,96 @@ mkdir_portal: +@@ -2087,24 +2057,96 @@ mkdir_portal: log_error("Could not make dir %s: %s", portal, strerror(errno)); rc = ISCSI_ERR_IDBM; @@ -176,5 +176,5 @@ index 1c59033..76816f2 100644 free_portal: free(portal); -- -2.9.3 +2.14.3 diff --git a/0003-idbw_rec_write-pick-tpgt-from-existing-record.patch b/0003-idbw_rec_write-pick-tpgt-from-existing-record.patch index 8514f4f..63e11a9 100644 --- a/0003-idbw_rec_write-pick-tpgt-from-existing-record.patch +++ b/0003-idbw_rec_write-pick-tpgt-from-existing-record.patch @@ -1,4 +1,4 @@ -From b9648028e0b3ac8ec5967bc47d9575cbcc5ac6f6 Mon Sep 17 00:00:00 2001 +From f5cb52d3b964fea4d634e3130e3e9e1f4ad7d924 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Tue, 13 Aug 2013 12:39:07 -0700 Subject: [PATCH 03/22] idbw_rec_write, pick tpgt from existing record @@ -12,7 +12,7 @@ updated new style record instead. 1 file changed, 40 insertions(+) diff --git a/usr/idbm.c b/usr/idbm.c -index 76816f2..cdf94b6 100644 +index d69a5c5c41a2..e36826432cef 100644 --- a/usr/idbm.c +++ b/usr/idbm.c @@ -27,6 +27,7 @@ @@ -32,7 +32,7 @@ index 76816f2..cdf94b6 100644 static void idbm_recinfo_discovery(discovery_rec_t *r, recinfo_t *ri) { -@@ -2076,12 +2079,49 @@ static int idbm_rec_write_old(node_rec_t *rec) +@@ -2084,12 +2087,49 @@ static int idbm_rec_write_old(node_rec_t *rec) FILE *f; char *portal; int rc = 0; @@ -83,5 +83,5 @@ index 76816f2..cdf94b6 100644 rec->name, rec->conn[0].address, rec->conn[0].port); -- -2.9.3 +2.14.3 diff --git a/0004-update-systemd-service-files-add-iscsi.service-for-s.patch b/0004-update-systemd-service-files-add-iscsi.service-for-s.patch index 08c3377..7dd6b3c 100644 --- a/0004-update-systemd-service-files-add-iscsi.service-for-s.patch +++ b/0004-update-systemd-service-files-add-iscsi.service-for-s.patch @@ -1,4 +1,4 @@ -From b3b8d7d3738dc29600ea9a2f4c61df578212294c Mon Sep 17 00:00:00 2001 +From d32c2d688d0186e5729b75be35b0474f2c6a3b85 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Wed, 19 Dec 2012 15:07:36 -0800 Subject: [PATCH 04/22] update systemd service files, add iscsi.service for @@ -16,7 +16,7 @@ Signed-off-by: Chris Leech diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service new file mode 100644 -index 0000000..bbd52fd +index 000000000000..bbd52fd66890 --- /dev/null +++ b/etc/systemd/iscsi.service @@ -0,0 +1,19 @@ @@ -41,7 +41,7 @@ index 0000000..bbd52fd +WantedBy=sysinit.target diff --git a/etc/systemd/iscsi_mark_root_nodes b/etc/systemd/iscsi_mark_root_nodes new file mode 100755 -index 0000000..c68475c +index 000000000000..c68475c44de5 --- /dev/null +++ b/etc/systemd/iscsi_mark_root_nodes @@ -0,0 +1,14 @@ @@ -60,7 +60,7 @@ index 0000000..c68475c +done < $SESSION_FILE + diff --git a/etc/systemd/iscsid.service b/etc/systemd/iscsid.service -index 028e0b3..653dd08 100644 +index 028e0b3f4e59..653dd085bbdd 100644 --- a/etc/systemd/iscsid.service +++ b/etc/systemd/iscsid.service @@ -1,7 +1,10 @@ @@ -77,7 +77,7 @@ index 028e0b3..653dd08 100644 [Service] Type=forking diff --git a/etc/systemd/iscsid.socket b/etc/systemd/iscsid.socket -index 832451d..58a8d12 100644 +index 832451d7a0ce..58a8d1239996 100644 --- a/etc/systemd/iscsid.socket +++ b/etc/systemd/iscsid.socket @@ -1,6 +1,6 @@ @@ -89,5 +89,5 @@ index 832451d..58a8d12 100644 [Socket] ListenStream=@ISCSIADM_ABSTRACT_NAMESPACE -- -2.9.3 +2.14.3 diff --git a/0005-iscsi-boot-related-service-file-updates.patch b/0005-iscsi-boot-related-service-file-updates.patch index e086803..e38d231 100644 --- a/0005-iscsi-boot-related-service-file-updates.patch +++ b/0005-iscsi-boot-related-service-file-updates.patch @@ -1,4 +1,4 @@ -From 945365b60cba1c3eab57713d2ee58d337d44327a Mon Sep 17 00:00:00 2001 +From 761c85d71a09a4b07d361351006520599f6db31c Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Mon, 19 Aug 2013 07:18:25 -0700 Subject: [PATCH 05/22] iscsi boot related service file updates @@ -16,7 +16,7 @@ don't rely on session list passed from initrd, never got fully implemented diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes new file mode 100644 -index 0000000..157be62 +index 000000000000..157be62b4041 --- /dev/null +++ b/etc/systemd/iscsi-mark-root-nodes @@ -0,0 +1,13 @@ @@ -34,7 +34,7 @@ index 0000000..157be62 +systemctl start iscsid.service + diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index bbd52fd..0309e2f 100644 +index bbd52fd66890..0309e2fc9892 100644 --- a/etc/systemd/iscsi.service +++ b/etc/systemd/iscsi.service @@ -10,10 +10,11 @@ ConditionPathExists=/etc/iscsi/initiatorname.iscsi @@ -52,7 +52,7 @@ index bbd52fd..0309e2f 100644 WantedBy=sysinit.target diff --git a/etc/systemd/iscsi_mark_root_nodes b/etc/systemd/iscsi_mark_root_nodes deleted file mode 100755 -index c68475c..0000000 +index c68475c44de5..000000000000 --- a/etc/systemd/iscsi_mark_root_nodes +++ /dev/null @@ -1,14 +0,0 @@ @@ -71,5 +71,5 @@ index c68475c..0000000 -done < $SESSION_FILE - -- -2.9.3 +2.14.3 diff --git a/0006-update-initscripts-and-docs.patch b/0006-update-initscripts-and-docs.patch index 053c565..f292064 100644 --- a/0006-update-initscripts-and-docs.patch +++ b/0006-update-initscripts-and-docs.patch @@ -1,31 +1,31 @@ -From c857ddd55cab3c9f67d496ca9f1666c4999aa376 Mon Sep 17 00:00:00 2001 +From c1fcc406734bf5eab0472193ea5e0247d3710250 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Mon, 19 Nov 2012 16:37:13 -0800 Subject: [PATCH 06/22] update initscripts and docs --- - README | 9 +++------ - etc/iscsid.conf | 23 +++++++++++------------ + README | 10 ++++------ + etc/iscsid.conf | 21 ++++++++++----------- usr/idbm.c | 4 ++++ - 3 files changed, 18 insertions(+), 18 deletions(-) + 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/README b/README -index 278292b..3757b2d 100644 +index 2499d9a7b638..c05814a2593b 100644 --- a/README +++ b/README -@@ -74,11 +74,6 @@ the cache sync command will fail. +@@ -77,11 +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. -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, +-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: - -@@ -1132,7 +1127,7 @@ Red Hat or Fedora: + The userspace components iscsid, iscsiadm and iscsistart require the + open-isns library, which can be found here: + https://github.com/gonzoleeman/open-isns/releases +@@ -1151,7 +1146,7 @@ Red Hat or Fedora: ----------------- To start open-iscsi in Red Hat/Fedora you can do: @@ -34,33 +34,30 @@ index 278292b..3757b2d 100644 To get open-iscsi to automatically start at run time you may have to run: -@@ -1340,6 +1335,8 @@ iscsid will only perform rediscovery when it gets a SCN from the server. +@@ -1353,6 +1348,9 @@ iscsid will only perform rediscovery when it gets a SCN from the server. # linux-isns (SLES's iSNS server) where it sometimes does not send SCN # events in the proper format, so they may not get handled. +To set the startup value, so that nodes are not logged into automatically +use the value "manual". - - Example: ++ + Examples -------- + diff --git a/etc/iscsid.conf b/etc/iscsid.conf -index f7ecb6b..46da83f 100644 +index fee11482a09b..3539ac4cd578 100644 --- a/etc/iscsid.conf +++ b/etc/iscsid.conf -@@ -17,10 +17,10 @@ - # maintainers. +@@ -19,7 +19,7 @@ + # the time then leave this attribute commented out. # # Default for Fedora and RHEL. (uncomment to activate). --# iscsid.startup = /etc/rc.d/init.d/iscsid force-start -+iscsid.startup = /etc/rc.d/init.d/iscsid force-start +-# iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.soccket ++iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket # - # Default for upstream open-iscsi scripts (uncomment to activate). --iscsid.startup = /sbin/iscsid -+# iscsid.startup = /sbin/iscsid - - # Check for active mounts on devices reachable through a session - # and refuse to logout if there are any. Defaults to "No". -@@ -39,8 +39,8 @@ iscsid.startup = /sbin/iscsid + # Default if you are not using systemd (uncomment to activate) + # iscsid.startup = /usr/bin/service start iscsid +@@ -41,8 +41,8 @@ # To request that the iscsi initd scripts startup a session set to "automatic". # node.startup = automatic # @@ -71,7 +68,7 @@ index f7ecb6b..46da83f 100644 # For "automatic" startup nodes, setting this to "Yes" will try logins on each # available iface until one succeeds, and then stop. The default "No" will try -@@ -262,28 +262,27 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0 +@@ -264,28 +264,27 @@ node.conn[0].iscsi.MaxXmitDataSegmentLength = 0 discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 32768 # To allow the targets to control the setting of the digest checking, @@ -108,10 +105,10 @@ index f7ecb6b..46da83f 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 cdf94b6..8e3fd89 100644 +index e36826432cef..c476d45f87c6 100644 --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -512,9 +512,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri) +@@ -517,9 +517,13 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri) IDBM_SHOW, "None", "CRC32C", "CRC32C,None", "None,CRC32C", num, 1); sprintf(key, CONN_DATA_DIGEST, i); @@ -126,5 +123,5 @@ index cdf94b6..8e3fd89 100644 __recinfo_int_o2(key, ri, r, conn[i].iscsi.IFMarker, IDBM_SHOW, "No", "Yes", num, 1); -- -2.9.3 +2.14.3 diff --git a/0007-use-var-for-config.patch b/0007-use-var-for-config.patch index 5ae0e50..c1b4dd0 100644 --- a/0007-use-var-for-config.patch +++ b/0007-use-var-for-config.patch @@ -1,4 +1,4 @@ -From 30345def1a6c09f83628dc161d65cc0e90d665f1 Mon Sep 17 00:00:00 2001 +From 1f89448f9c2338112129b16534a6d66f8ab47b98 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Mon, 19 Nov 2012 16:38:45 -0800 Subject: [PATCH 07/22] use var for config @@ -8,14 +8,14 @@ Subject: [PATCH 07/22] use var for config doc/iscsiadm.8 | 8 ++++---- usr/idbm.c | 6 +++--- usr/idbm.h | 13 +++++++------ - usr/iface.h | 4 +++- - 5 files changed, 33 insertions(+), 31 deletions(-) + usr/iface.h | 3 ++- + 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/README b/README -index 3757b2d..fa38c8c 100644 +index c05814a2593b..326c3b01e608 100644 --- a/README +++ b/README -@@ -170,8 +170,7 @@ Usage: iscsid [OPTION] +@@ -172,8 +172,7 @@ Usage: iscsid [OPTION] Open-iSCSI persistent configuration is stored in a number of directories under a configuration root directory, using a flat-file @@ -25,116 +25,118 @@ index 3757b2d..fa38c8c 100644 Configuration is contained in directories for: -@@ -489,7 +488,7 @@ a scsi_host per HBA port). +@@ -561,7 +560,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 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: + Prep + ---- +@@ -594,7 +593,7 @@ Running + The command + iscsiadm -m iface -@@ -523,29 +522,29 @@ Running: - 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 +-will report iface configurations that are setup in /etc/iscsi/ifaces: ++will report iface configurations that are setup in /var/lib/iscsi/ifaces: --Will report iface configurations that are setup in /etc/iscsi/ifaces. -+Will report iface configurations that are setup in /var/lib/iscsi/ifaces. - The format is: - - iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname + 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 +@@ -604,10 +603,10 @@ The format 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. - For each network object you wish to bind a session to you must create + For each network object you wish to bind a session to, you must create -a separate iface config in /etc/iscsi/ifaces and each iface config file +a separate iface config in /var/lib/iscsi/ifaces and each iface config file must have a unique name which is less than or equal to 64 characters. - Example: + Example +@@ -615,12 +614,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: + 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: - iface.transport_name = tcp - iface.hwaddress = 00:0F:1F:92:6B:BF + 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: - iface.transport_name = tcp - iface.hwaddress = 00:C0:DD:08:63:E7 -@@ -595,7 +594,7 @@ cxgb3i.00:07:43:05:97:07 cxgb3i,00:07:43:05:97:07,,, - qla4xxx.00:0e:1e:04:8b:2e qla4xxx,00:0e:1e:04:8b:2e,,, - + iface.transport_name = tcp + iface.hwaddress = 00:C0:DD:08:63:E7 +@@ -662,7 +661,7 @@ port. The iface name will be of the form: + Running the following command: + iscsiadm -m iface --Will report iface configurations that are setup in /etc/iscsi/ifaces. -+Will report iface configurations that are setup in /var/lib/iscsi/ifaces. - The format is: +-will report iface configurations that are setup in /etc/iscsi/ifaces: ++will report iface configurations that are setup in /var/lib/iscsi/ifaces: - iface_name transport_name,hwaddress,ipaddress,net_ifacename,initiatorname -@@ -681,7 +680,7 @@ need a separate network connection to the target for discovery purposes. + default tcp,,,, + iser iser,,,, +@@ -742,7 +741,7 @@ need a separate network connection to the target for discovery purposes. *This will be fixed in the next 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 -+will check for interfaces in /var/lib/iscsi/ifaces that are using - tcp for the iface.transport and it will bind the portals that are discovered ++will check for interfaces in /var/lib/iscsi/iscsi/ifaces that are using + 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 overriden by passing in the interfaces you want to use. For the case -@@ -699,7 +698,7 @@ we do not bind a session to an iface, then you can use the special iface - - iscsiadm -m discoverydb -t st -p ip:port -I default --discover -P 1 + be overridden by passing in the interfaces you want to use. For the case +@@ -757,7 +756,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": + 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 +And if you did not define any interfaces in /var/lib/iscsi/ifaces and do not pass anything into iscsiadm, running iscsiadm will do the default - behavior, where we allow the network subsystem to decide which - device to use. -@@ -741,7 +740,7 @@ To now log into targets it is the same as with software iscsi. See section + behavior, allowing the network subsystem to decide which device to use. - ./iscsiadm -m discoverydb -t st -p 192.168.1.1:3260 --discover +@@ -793,7 +792,7 @@ Discovery mode + ID [192.168.1.1:3260]: + 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 -@@ -750,7 +749,7 @@ To now log into targets it is the same as with software iscsi. See section - The argument to -p may also be a hostname instead of an address. - ./iscsiadm -m discoverydb -t st -p smoehost --discover +@@ -802,7 +801,7 @@ Discovery mode + The argument to -p may also be a hostname instead of an address: + 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 -@@ -806,7 +805,7 @@ To now log into targets it is the same as with software iscsi. See section - This command will perform discovery, but not manipulate the node DB. +@@ -853,7 +852,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 -+ wish to only use a subset of the interfaces in /var/lib/iscsi/ifaces - then you can pass them in during discovery: + - 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 - ./iscsiadm -m discoverydb -t sendtargets -p 192.168.1.1:3260 \ -@@ -1207,8 +1206,8 @@ where targetname is the name of the target and ip_address:port is the address - and port of the portal. tpgt, is the portal group tag of +@@ -1223,8 +1222,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. And iface name is the name of the iscsi interface + 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 +/var/lib/iscsi/ifaces or passed in, the default behavior is used. - Default here is iscsi_tcp/tcp to be used over which ever NIC the + Default here is iscsi_tcp/tcp to be used over whichever NIC the network layer decides is best. -@@ -1323,7 +1322,7 @@ If set, iscsid will perform discovery to the address every +@@ -1336,7 +1335,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 @@ -144,7 +146,7 @@ index 3757b2d..fa38c8c 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 a82805e..758a47c 100644 +index a82805e28fb9..758a47c2d1fe 100644 --- a/doc/iscsiadm.8 +++ b/doc/iscsiadm.8 @@ -241,7 +241,7 @@ This option is only valid for ping submode. @@ -179,10 +181,10 @@ index a82805e..758a47c 100644 .SH "SEE ALSO" diff --git a/usr/idbm.c b/usr/idbm.c -index 8e3fd89..934c657 100644 +index c476d45f87c6..a853c2d0c5c2 100644 --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -2917,9 +2917,9 @@ free_info: +@@ -2933,9 +2933,9 @@ free_info: int idbm_init(idbm_get_config_file_fn *fn) { /* make sure root db dir is there */ @@ -196,7 +198,7 @@ index 8e3fd89..934c657 100644 return errno; } diff --git a/usr/idbm.h b/usr/idbm.h -index b9020fe..b89ddff 100644 +index 411dd8230ece..211532f74f09 100644 --- a/usr/idbm.h +++ b/usr/idbm.h @@ -29,12 +29,13 @@ @@ -220,20 +222,20 @@ index b9020fe..b89ddff 100644 #define ISNS_CONFIG_NAME "isns_config" diff --git a/usr/iface.h b/usr/iface.h -index 01f7074..f396918 100644 +index e3c1b6824de4..b2bdd4c4f0b8 100644 --- a/usr/iface.h +++ b/usr/iface.h -@@ -20,7 +20,9 @@ - #ifndef ISCSI_IFACE_H +@@ -21,8 +21,9 @@ #define ISCSI_IFACE_H --#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces" + #include +#include "idbm.h" -+ + +-#define IFACE_CONFIG_DIR ISCSI_CONFIG_ROOT"ifaces" +#define IFACE_CONFIG_DIR ISCSIVAR"ifaces" struct iface_rec; struct list_head; -- -2.9.3 +2.14.3 diff --git a/0008-use-red-hat-for-name.patch b/0008-use-red-hat-for-name.patch index a8870b0..a6c1caa 100644 --- a/0008-use-red-hat-for-name.patch +++ b/0008-use-red-hat-for-name.patch @@ -1,4 +1,4 @@ -From 6eae13ab3f4ba35d45a4c1afb38c9a75a1797afc Mon Sep 17 00:00:00 2001 +From f5c1f745983869aefea5a089b78b629aa87c0fb3 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Mon, 19 Nov 2012 16:40:04 -0800 Subject: [PATCH 08/22] use red hat for name @@ -8,7 +8,7 @@ Subject: [PATCH 08/22] use red hat for name 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/iscsi-iname.c b/utils/iscsi-iname.c -index 6347edc..cb2f6c8 100644 +index 6347edc46293..cb2f6c8b8651 100644 --- a/utils/iscsi-iname.c +++ b/utils/iscsi-iname.c @@ -73,7 +73,7 @@ main(int argc, char *argv[]) @@ -21,5 +21,5 @@ index 6347edc..cb2f6c8 100644 /* try to feed some entropy from the pool to MD5 in order to get -- -2.9.3 +2.14.3 diff --git a/0009-libiscsi.patch b/0009-libiscsi.patch index 3b570b7..9cf5f45 100644 --- a/0009-libiscsi.patch +++ b/0009-libiscsi.patch @@ -1,4 +1,4 @@ -From 9054091af1a23dca6482087a4104ca31a1598e74 Mon Sep 17 00:00:00 2001 +From 4eddf9bc59660d39ae6feee8358c3de5029b6c9a Mon Sep 17 00:00:00 2001 From: rpm-build Date: Mon, 26 Jan 2015 12:57:11 -0800 Subject: [PATCH 09/22] libiscsi @@ -45,10 +45,10 @@ Subject: [PATCH 09/22] libiscsi create mode 100644 libiscsi/tests/test_set_auth.c diff --git a/Makefile b/Makefile -index c8cd00e..cf028cf 100644 +index 33a23f9e3efa..6c94ca96016e 100644 --- a/Makefile +++ b/Makefile -@@ -43,6 +43,7 @@ user: iscsiuio/Makefile +@@ -52,6 +52,7 @@ user: iscsiuio/Makefile $(MAKE) -C usr $(MAKE) -C utils $(MAKE) -C iscsiuio @@ -56,7 +56,7 @@ index c8cd00e..cf028cf 100644 @echo @echo "Compilation complete Output file" @echo "----------------------------------- ----------------" -@@ -71,6 +72,7 @@ kernel: force +@@ -72,6 +73,7 @@ iscsiuio/configure iscsiuio/Makefile.in: iscsiuio/configure.ac iscsiuio/Makefile force: ; clean: @@ -66,7 +66,7 @@ index c8cd00e..cf028cf 100644 $(MAKE) -C utils clean diff --git a/libiscsi/Makefile b/libiscsi/Makefile new file mode 100644 -index 0000000..317a7ec +index 000000000000..317a7ec4db30 --- /dev/null +++ b/libiscsi/Makefile @@ -0,0 +1,61 @@ @@ -133,7 +133,7 @@ index 0000000..317a7ec +-include .depend ../usr/.depend diff --git a/libiscsi/libiscsi.c b/libiscsi/libiscsi.c new file mode 100644 -index 0000000..064e4b5 +index 000000000000..064e4b570d0b --- /dev/null +++ b/libiscsi/libiscsi.c @@ -0,0 +1,617 @@ @@ -756,7 +756,7 @@ index 0000000..064e4b5 +} diff --git a/libiscsi/libiscsi.doxy b/libiscsi/libiscsi.doxy new file mode 100644 -index 0000000..7a5ff7f +index 000000000000..7a5ff7f7cd5a --- /dev/null +++ b/libiscsi/libiscsi.doxy @@ -0,0 +1,1473 @@ @@ -2235,7 +2235,7 @@ index 0000000..7a5ff7f +SEARCHENGINE = NO diff --git a/libiscsi/libiscsi.h b/libiscsi/libiscsi.h new file mode 100644 -index 0000000..756590e +index 000000000000..756590e14d8b --- /dev/null +++ b/libiscsi/libiscsi.h @@ -0,0 +1,344 @@ @@ -2585,7 +2585,7 @@ index 0000000..756590e +#endif diff --git a/libiscsi/no_date_footer.html b/libiscsi/no_date_footer.html new file mode 100644 -index 0000000..1e0c6c4 +index 000000000000..1e0c6c4ab49e --- /dev/null +++ b/libiscsi/no_date_footer.html @@ -0,0 +1,6 @@ @@ -2597,7 +2597,7 @@ index 0000000..1e0c6c4 + diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c new file mode 100644 -index 0000000..8800853 +index 000000000000..88008538f04f --- /dev/null +++ b/libiscsi/pylibiscsi.c @@ -0,0 +1,709 @@ @@ -3312,7 +3312,7 @@ index 0000000..8800853 +} diff --git a/libiscsi/setup.py b/libiscsi/setup.py new file mode 100644 -index 0000000..caa4e66 +index 000000000000..caa4e66ca906 --- /dev/null +++ b/libiscsi/setup.py @@ -0,0 +1,9 @@ @@ -3327,7 +3327,7 @@ index 0000000..caa4e66 + description = 'libiscsi python bindings', ext_modules = [module1]) diff --git a/libiscsi/tests/test_discovery_firmware.c b/libiscsi/tests/test_discovery_firmware.c new file mode 100644 -index 0000000..76e852a +index 000000000000..76e852a37019 --- /dev/null +++ b/libiscsi/tests/test_discovery_firmware.c @@ -0,0 +1,53 @@ @@ -3386,7 +3386,7 @@ index 0000000..76e852a +} diff --git a/libiscsi/tests/test_discovery_sendtargets.c b/libiscsi/tests/test_discovery_sendtargets.c new file mode 100644 -index 0000000..1a3c12e +index 000000000000..1a3c12ef684b --- /dev/null +++ b/libiscsi/tests/test_discovery_sendtargets.c @@ -0,0 +1,60 @@ @@ -3452,7 +3452,7 @@ index 0000000..1a3c12e +} diff --git a/libiscsi/tests/test_get_auth.c b/libiscsi/tests/test_get_auth.c new file mode 100644 -index 0000000..5e234da +index 000000000000..5e234dadd0de --- /dev/null +++ b/libiscsi/tests/test_get_auth.c @@ -0,0 +1,70 @@ @@ -3528,7 +3528,7 @@ index 0000000..5e234da +} diff --git a/libiscsi/tests/test_get_initiator_name.c b/libiscsi/tests/test_get_initiator_name.c new file mode 100644 -index 0000000..997c053 +index 000000000000..997c053e5bf6 --- /dev/null +++ b/libiscsi/tests/test_get_initiator_name.c @@ -0,0 +1,38 @@ @@ -3572,7 +3572,7 @@ index 0000000..997c053 +} diff --git a/libiscsi/tests/test_get_network_config.c b/libiscsi/tests/test_get_network_config.c new file mode 100644 -index 0000000..2dedd61 +index 000000000000..2dedd6102858 --- /dev/null +++ b/libiscsi/tests/test_get_network_config.c @@ -0,0 +1,45 @@ @@ -3623,7 +3623,7 @@ index 0000000..2dedd61 +} diff --git a/libiscsi/tests/test_login.c b/libiscsi/tests/test_login.c new file mode 100644 -index 0000000..3eb70d6 +index 000000000000..3eb70d63e111 --- /dev/null +++ b/libiscsi/tests/test_login.c @@ -0,0 +1,52 @@ @@ -3681,7 +3681,7 @@ index 0000000..3eb70d6 +} diff --git a/libiscsi/tests/test_logout.c b/libiscsi/tests/test_logout.c new file mode 100644 -index 0000000..b734dca +index 000000000000..b734dca58773 --- /dev/null +++ b/libiscsi/tests/test_logout.c @@ -0,0 +1,51 @@ @@ -3738,7 +3738,7 @@ index 0000000..b734dca +} diff --git a/libiscsi/tests/test_params.c b/libiscsi/tests/test_params.c new file mode 100644 -index 0000000..d3223be +index 000000000000..d3223be1e894 --- /dev/null +++ b/libiscsi/tests/test_params.c @@ -0,0 +1,103 @@ @@ -3847,7 +3847,7 @@ index 0000000..d3223be +} diff --git a/libiscsi/tests/test_set_auth.c b/libiscsi/tests/test_set_auth.c new file mode 100644 -index 0000000..a21f888 +index 000000000000..a21f88806ab9 --- /dev/null +++ b/libiscsi/tests/test_set_auth.c @@ -0,0 +1,58 @@ @@ -3910,20 +3910,20 @@ index 0000000..a21f888 + return rc; +} diff --git a/usr/Makefile b/usr/Makefile -index c1866b6..6d3ce2e 100644 +index f9445adabbb0..8751d0d05468 100644 --- a/usr/Makefile +++ b/usr/Makefile -@@ -30,7 +30,7 @@ endif - +@@ -35,7 +35,7 @@ endif CFLAGS ?= -O2 -g WARNFLAGS ?= -Wall -Wstrict-prototypes --CFLAGS += $(WARNFLAGS) -I../include -I. -D$(OSNAME) $(IPC_CFLAGS) -+CFLAGS += $(WARNFLAGS) -I../include -I. -D$(OSNAME) $(IPC_CFLAGS) -DISNS_ENABLE + CFLAGS += $(WARNFLAGS) -I../include -I. -D_GNU_SOURCE \ +- -I$(TOPDIR)/libopeniscsiusr ++ -I$(TOPDIR)/libopeniscsiusr -DISNS_ENABLE + ISCSI_LIB = -L$(TOPDIR)/libopeniscsiusr -lopeniscsiusr PROGRAMS = iscsid iscsiadm iscsistart - # libc compat files diff --git a/usr/discovery.c b/usr/discovery.c -index 593d226..de8267f 100644 +index 8001af6fe452..02b77f02b644 100644 --- a/usr/discovery.c +++ b/usr/discovery.c @@ -36,6 +36,7 @@ @@ -3947,7 +3947,7 @@ index 593d226..de8267f 100644 #ifdef SLP_ENABLE #include "iscsi-slp-discovery.h" -@@ -98,6 +101,7 @@ static int request_initiator_name(void) +@@ -98,6 +101,7 @@ static int request_initiator_name(int tmo) return 0; } @@ -3964,10 +3964,10 @@ index 593d226..de8267f 100644 int discovery_fw(void *data, struct iface_rec *iface, struct list_head *rec_list) diff --git a/usr/idbm.c b/usr/idbm.c -index 934c657..2e067df 100644 +index a853c2d0c5c2..9c9c2598a6b0 100644 --- a/usr/idbm.c +++ b/usr/idbm.c -@@ -1709,9 +1709,9 @@ int idbm_print_all_discovery(int info_level) +@@ -1716,9 +1716,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. */ @@ -3981,7 +3981,7 @@ index 934c657..2e067df 100644 DIR *iface_dirfd; struct dirent *iface_dent; diff --git a/usr/idbm.h b/usr/idbm.h -index b89ddff..3631262 100644 +index 211532f74f09..1918b142542b 100644 --- a/usr/idbm.h +++ b/usr/idbm.h @@ -102,6 +102,9 @@ struct rec_op_data { @@ -3995,10 +3995,10 @@ index b89ddff..3631262 100644 idbm_portal_op_fn *fn, char *targetname); extern int idbm_for_each_node(int *found, void *data, diff --git a/usr/iscsi_ipc.h b/usr/iscsi_ipc.h -index 5087b5c..a6dc40a 100644 +index 47857dd9b0ca..fb8e96552551 100644 --- a/usr/iscsi_ipc.h +++ b/usr/iscsi_ipc.h -@@ -166,4 +166,6 @@ struct iscsi_ipc { +@@ -162,4 +162,6 @@ struct iscsi_ipc { char *host_stats); }; @@ -4006,5 +4006,5 @@ index 5087b5c..a6dc40a 100644 + #endif /* ISCSI_IPC_H */ -- -2.9.3 +2.14.3 diff --git a/0010-remove-the-offload-boot-supported-ifdef.patch b/0010-remove-the-offload-boot-supported-ifdef.patch index ec9163b..f99faac 100644 --- a/0010-remove-the-offload-boot-supported-ifdef.patch +++ b/0010-remove-the-offload-boot-supported-ifdef.patch @@ -1,4 +1,4 @@ -From 155942be75270dd7898c5b497d24f06f3b8e8457 Mon Sep 17 00:00:00 2001 +From 39f702aa77c9f5ffefccae9788006d08ec7f30a4 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Mon, 19 Nov 2012 17:09:24 -0800 Subject: [PATCH 10/22] remove the offload boot supported ifdef @@ -8,10 +8,10 @@ Subject: [PATCH 10/22] remove the offload boot supported ifdef 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/usr/iface.c b/usr/iface.c -index 74e63f6..f5c0d0d 100644 +index 44c098650b9e..129c4002dc63 100644 --- a/usr/iface.c +++ b/usr/iface.c -@@ -996,6 +996,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface, +@@ -993,6 +993,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface, { struct iscsi_transport *t = NULL; uint32_t hostno; @@ -19,7 +19,7 @@ index 74e63f6..f5c0d0d 100644 if (strlen(context->initiatorname)) strlcpy(iface->iname, context->initiatorname, -@@ -1009,10 +1010,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface, +@@ -1006,10 +1007,7 @@ int iface_setup_from_boot_context(struct iface_rec *iface, return 0; } } else if (strlen(context->iface)) { @@ -30,7 +30,7 @@ index 74e63f6..f5c0d0d 100644 memset(transport_name, 0, ISCSI_TRANSPORT_NAME_MAXLEN); /* make sure offload driver is loaded */ -@@ -1038,9 +1036,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface, +@@ -1035,9 +1033,6 @@ int iface_setup_from_boot_context(struct iface_rec *iface, } strlcpy(iface->netdev, context->iface, sizeof(iface->netdev)); @@ -41,5 +41,5 @@ index 74e63f6..f5c0d0d 100644 return 0; -- -2.9.3 +2.14.3 diff --git a/0011-iscsiuio-systemd-unit-files.patch b/0011-iscsiuio-systemd-unit-files.patch index fe77286..f7ecd1d 100644 --- a/0011-iscsiuio-systemd-unit-files.patch +++ b/0011-iscsiuio-systemd-unit-files.patch @@ -1,4 +1,4 @@ -From 105bdf7e73e513f6d830d8d59e9bd5c21f77c04e Mon Sep 17 00:00:00 2001 +From f8cb83bf6967fea8b7f0a4fc95a99df1986f7f15 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Tue, 22 Jan 2013 14:27:12 -0800 Subject: [PATCH 11/22] iscsiuio systemd unit files @@ -12,7 +12,7 @@ Subject: [PATCH 11/22] iscsiuio systemd unit files diff --git a/etc/systemd/iscsiuio.service b/etc/systemd/iscsiuio.service new file mode 100644 -index 0000000..f0410b7 +index 000000000000..f0410b76b80e --- /dev/null +++ b/etc/systemd/iscsiuio.service @@ -0,0 +1,17 @@ @@ -35,7 +35,7 @@ index 0000000..f0410b7 +WantedBy=multi-user.target diff --git a/etc/systemd/iscsiuio.socket b/etc/systemd/iscsiuio.socket new file mode 100644 -index 0000000..d42cedc +index 000000000000..d42cedc161a3 --- /dev/null +++ b/etc/systemd/iscsiuio.socket @@ -0,0 +1,9 @@ @@ -49,5 +49,5 @@ index 0000000..d42cedc +[Install] +WantedBy=sockets.target -- -2.9.3 +2.14.3 diff --git a/0012-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch b/0012-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch new file mode 100644 index 0000000..2d39c0f --- /dev/null +++ b/0012-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch @@ -0,0 +1,30 @@ +From 3e34fefae3f44bfd1ee24931663b92ff4f76d3ad Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Tue, 28 May 2013 13:12:27 -0700 +Subject: [PATCH 12/22] Don't check for autostart sessions if iscsi is not used + (bug #951951) + +Change conditional startup in iscsi.service to check for a non-empty +nodes directory, instead of initiator-name. This fits better with what +it's doing, as there's no need to scan for autostart node records if +there are no node records at all. +--- + etc/systemd/iscsi.service | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service +index 0309e2fc9892..d5712bd3779b 100644 +--- a/etc/systemd/iscsi.service ++++ b/etc/systemd/iscsi.service +@@ -5,7 +5,7 @@ DefaultDependencies=no + Conflicts=shutdown.target + After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service + Before=remote-fs-pre.target +-ConditionPathExists=/etc/iscsi/initiatorname.iscsi ++ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes + + [Service] + Type=oneshot +-- +2.14.3 + diff --git a/0012-disable-iscsid.startup-from-iscsiadm-prefer-systemd-.patch b/0012-disable-iscsid.startup-from-iscsiadm-prefer-systemd-.patch deleted file mode 100644 index 531eb0b..0000000 --- a/0012-disable-iscsid.startup-from-iscsiadm-prefer-systemd-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From a76b5c01d4581cdf695d7691a79008b533efe95b Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Thu, 21 Feb 2013 21:05:39 -0800 -Subject: [PATCH 12/22] disable iscsid.startup from iscsiadm, prefer systemd - socket activation - ---- - etc/iscsid.conf | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/etc/iscsid.conf b/etc/iscsid.conf -index 46da83f..f4c6d7c 100644 ---- a/etc/iscsid.conf -+++ b/etc/iscsid.conf -@@ -17,7 +17,7 @@ - # maintainers. - # - # Default for Fedora and RHEL. (uncomment to activate). --iscsid.startup = /etc/rc.d/init.d/iscsid force-start -+#iscsid.startup = /bin/systemctl start iscsid.service - # - # Default for upstream open-iscsi scripts (uncomment to activate). - # iscsid.startup = /sbin/iscsid --- -2.9.3 - diff --git a/0013-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch b/0013-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch deleted file mode 100644 index 2229179..0000000 --- a/0013-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch +++ /dev/null @@ -1,30 +0,0 @@ -From d0eb66bf5a232653ee81b23997897d1062826666 Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Tue, 28 May 2013 13:12:27 -0700 -Subject: [PATCH 13/22] Don't check for autostart sessions if iscsi is not used - (bug #951951) - -Change conditional startup in iscsi.service to check for a non-empty -nodes directory, instead of initiator-name. This fits better with what -it's doing, as there's no need to scan for autostart node records if -there are no node records at all. ---- - etc/systemd/iscsi.service | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index 0309e2f..d5712bd 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service -@@ -5,7 +5,7 @@ DefaultDependencies=no - Conflicts=shutdown.target - After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service - Before=remote-fs-pre.target --ConditionPathExists=/etc/iscsi/initiatorname.iscsi -+ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes - - [Service] - Type=oneshot --- -2.9.3 - diff --git a/0013-Revert-iscsiadm-return-error-when-login-fails.patch b/0013-Revert-iscsiadm-return-error-when-login-fails.patch new file mode 100644 index 0000000..6cfd4b6 --- /dev/null +++ b/0013-Revert-iscsiadm-return-error-when-login-fails.patch @@ -0,0 +1,34 @@ +From fc947d9c6d995455456cc68a22911ff336ddd4a7 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Mon, 24 Feb 2014 09:33:33 -0800 +Subject: [PATCH 13/22] Revert "iscsiadm: return error when login fails" + +This reverts commit fc2a8e9a2911bc76f961fe3e4a159fab9b8b9691. + +Done to address RHBZ #1015563 +--- + usr/session_mgmt.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c +index 596085b1f640..07f587d2bafb 100644 +--- a/usr/session_mgmt.c ++++ b/usr/session_mgmt.c +@@ -178,12 +178,12 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec) + goto done; + } + if (session_count >= rec->session.nr_sessions) { +- log_warning("%s: %d session%s requested, but %d " ++ log_debug(1, "%s: %d session%s requested, but %d " + "already present.", + rec->iface.name, rec->session.nr_sessions, + rec->session.nr_sessions == 1 ? "" : "s", + session_count); +- rc = ISCSI_ERR_SESS_EXISTS; ++ rc = 0; + goto done; + } + +-- +2.14.3 + diff --git a/0014-start-socket-listeners-on-iscsiadm-command.patch b/0014-start-socket-listeners-on-iscsiadm-command.patch deleted file mode 100644 index 690dcac..0000000 --- a/0014-start-socket-listeners-on-iscsiadm-command.patch +++ /dev/null @@ -1,28 +0,0 @@ -From fc105639723f891f1cda717e52baf7234310dfed Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Mon, 25 Nov 2013 22:28:12 -0800 -Subject: [PATCH 14/22] start socket listeners on iscsiadm command - -fix for trying to run iscsiadm commands right after installing the rpm -without manually starting the systemd units ---- - etc/iscsid.conf | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/etc/iscsid.conf b/etc/iscsid.conf -index f4c6d7c..bfabf7f 100644 ---- a/etc/iscsid.conf -+++ b/etc/iscsid.conf -@@ -17,7 +17,8 @@ - # maintainers. - # - # Default for Fedora and RHEL. (uncomment to activate). --#iscsid.startup = /bin/systemctl start iscsid.service -+# Use socket activation, but try to make sure the socket units are listening -+iscsid.startup = /bin/systemctl start iscsid.socket iscsiuio.socket - # - # Default for upstream open-iscsi scripts (uncomment to activate). - # iscsid.startup = /sbin/iscsid --- -2.9.3 - diff --git a/0014-update-handling-of-boot-sessions.patch b/0014-update-handling-of-boot-sessions.patch new file mode 100644 index 0000000..25f9416 --- /dev/null +++ b/0014-update-handling-of-boot-sessions.patch @@ -0,0 +1,55 @@ +From ae822182f7106f2382a499924aed455dd66f417c Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Wed, 26 Feb 2014 16:33:48 -0800 +Subject: [PATCH 14/22] update handling of boot sessions + +force start iscsiuio if needed, socket activation does not seem to be +working for recovery +--- + etc/systemd/iscsi-mark-root-nodes | 29 +++++++++++++++++++++++------ + 1 file changed, 23 insertions(+), 6 deletions(-) + +diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes +index 157be62b4041..60dcd70e49fd 100644 +--- a/etc/systemd/iscsi-mark-root-nodes ++++ b/etc/systemd/iscsi-mark-root-nodes +@@ -1,13 +1,30 @@ + #!/bin/bash + + ISCSIADM=/sbin/iscsiadm ++start_iscsid=0 ++start_iscsiuio=0 + +-$ISCSIADM -m session >/dev/null 2>&1 || exit 0 ++while read t num p target flash; do ++ # strip tag number from portal, keep "ip:port" ++ portal=${p%,*} ++ transport=${t%:} + +-$ISCSIADM -m session | while read t num i target; do +- ip=${i%:*} +- $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot +-done ++ $ISCSIADM -m node -p $portal -T $target -o update -n node.startup -v onboot + +-systemctl start iscsid.service ++ start_iscsid=1 ++ ++ if [ "$transport" = bnx2i ]; 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 + +-- +2.14.3 + diff --git a/0015-Revert-iscsiadm-return-error-when-login-fails.patch b/0015-Revert-iscsiadm-return-error-when-login-fails.patch deleted file mode 100644 index 3057bb8..0000000 --- a/0015-Revert-iscsiadm-return-error-when-login-fails.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 2200edaea16c00e439ea665786430ebc9bd26cf0 Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Mon, 24 Feb 2014 09:33:33 -0800 -Subject: [PATCH 15/22] Revert "iscsiadm: return error when login fails" - -This reverts commit fc2a8e9a2911bc76f961fe3e4a159fab9b8b9691. - -Done to address RHBZ #1015563 ---- - usr/session_mgmt.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/usr/session_mgmt.c b/usr/session_mgmt.c -index 596085b..07f587d 100644 ---- a/usr/session_mgmt.c -+++ b/usr/session_mgmt.c -@@ -178,12 +178,12 @@ int iscsi_login_portal(void *data, struct list_head *list, struct node_rec *rec) - goto done; - } - if (session_count >= rec->session.nr_sessions) { -- log_warning("%s: %d session%s requested, but %d " -+ log_debug(1, "%s: %d session%s requested, but %d " - "already present.", - rec->iface.name, rec->session.nr_sessions, - rec->session.nr_sessions == 1 ? "" : "s", - session_count); -- rc = ISCSI_ERR_SESS_EXISTS; -+ rc = 0; - goto done; - } - --- -2.9.3 - diff --git a/0015-update-iscsi.service-for-boot-session-recovery.patch b/0015-update-iscsi.service-for-boot-session-recovery.patch new file mode 100644 index 0000000..4247214 --- /dev/null +++ b/0015-update-iscsi.service-for-boot-session-recovery.patch @@ -0,0 +1,34 @@ +From 5d8761566bba29ab92cfe2e06245ea55ad8bdb33 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Fri, 14 Mar 2014 09:22:21 -0700 +Subject: [PATCH 15/22] update iscsi.service for boot session recovery + +--- + etc/systemd/iscsi.service | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service +index d5712bd3779b..3de76c5b07ec 100644 +--- a/etc/systemd/iscsi.service ++++ b/etc/systemd/iscsi.service +@@ -5,14 +5,15 @@ DefaultDependencies=no + Conflicts=shutdown.target + After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service + Before=remote-fs-pre.target +-ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes ++ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes ++ConditionDirectoryNotEmpty=|/sys/class/iscsi_session + + [Service] + Type=oneshot + RemainAfterExit=true + ExecStart=/usr/libexec/iscsi-mark-root-nodes ++SuccessExitStatus=21 + ExecStart=/sbin/iscsiadm -m node --loginall=automatic +-ExecStop=/bin/sync + ExecStop=/sbin/iscsiadm -m node --logoutall=automatic + ExecReload=/sbin/iscsiadm -m node --loginall=automatic + +-- +2.14.3 + diff --git a/0016-update-handling-of-boot-sessions.patch b/0016-update-handling-of-boot-sessions.patch deleted file mode 100644 index 5af8b43..0000000 --- a/0016-update-handling-of-boot-sessions.patch +++ /dev/null @@ -1,55 +0,0 @@ -From bf334a968ed0a7c3c8d429d971cab9a189399c32 Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Wed, 26 Feb 2014 16:33:48 -0800 -Subject: [PATCH 16/22] update handling of boot sessions - -force start iscsiuio if needed, socket activation does not seem to be -working for recovery ---- - etc/systemd/iscsi-mark-root-nodes | 29 +++++++++++++++++++++++------ - 1 file changed, 23 insertions(+), 6 deletions(-) - -diff --git a/etc/systemd/iscsi-mark-root-nodes b/etc/systemd/iscsi-mark-root-nodes -index 157be62..60dcd70 100644 ---- a/etc/systemd/iscsi-mark-root-nodes -+++ b/etc/systemd/iscsi-mark-root-nodes -@@ -1,13 +1,30 @@ - #!/bin/bash - - ISCSIADM=/sbin/iscsiadm -+start_iscsid=0 -+start_iscsiuio=0 - --$ISCSIADM -m session >/dev/null 2>&1 || exit 0 -+while read t num p target flash; do -+ # strip tag number from portal, keep "ip:port" -+ portal=${p%,*} -+ transport=${t%:} - --$ISCSIADM -m session | while read t num i target; do -- ip=${i%:*} -- $ISCSIADM -m node -p $ip -T $target -o update -n node.startup -v onboot --done -+ $ISCSIADM -m node -p $portal -T $target -o update -n node.startup -v onboot - --systemctl start iscsid.service -+ start_iscsid=1 -+ -+ if [ "$transport" = bnx2i ]; 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 - --- -2.9.3 - diff --git a/0016-updates-to-iscsi.service.patch b/0016-updates-to-iscsi.service.patch new file mode 100644 index 0000000..b1274ad --- /dev/null +++ b/0016-updates-to-iscsi.service.patch @@ -0,0 +1,41 @@ +From 638e6f13dc199c2800ad19b5a206dd5305c3cadf Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Wed, 17 Sep 2014 09:58:39 -0700 +Subject: [PATCH 16/22] updates to iscsi.service + +Resolves: #1126524 +Resolves: #1111925 +--- + etc/systemd/iscsi.service | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service +index 3de76c5b07ec..ad7be34d5918 100644 +--- a/etc/systemd/iscsi.service ++++ b/etc/systemd/iscsi.service +@@ -5,17 +5,17 @@ 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 + ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes + ConditionDirectoryNotEmpty=|/sys/class/iscsi_session + + [Service] + Type=oneshot + RemainAfterExit=true +-ExecStart=/usr/libexec/iscsi-mark-root-nodes +-SuccessExitStatus=21 +-ExecStart=/sbin/iscsiadm -m node --loginall=automatic +-ExecStop=/sbin/iscsiadm -m node --logoutall=automatic +-ExecReload=/sbin/iscsiadm -m node --loginall=automatic ++ExecStart=-/usr/libexec/iscsi-mark-root-nodes ++ExecStart=-/sbin/iscsiadm -m node --loginall=automatic ++ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic ++ExecReload=-/sbin/iscsiadm -m node --loginall=automatic + + [Install] + WantedBy=sysinit.target +-- +2.14.3 + diff --git a/0017-make-session-shutdown-a-seperate-service.patch.patch b/0017-make-session-shutdown-a-seperate-service.patch.patch new file mode 100644 index 0000000..46003ea --- /dev/null +++ b/0017-make-session-shutdown-a-seperate-service.patch.patch @@ -0,0 +1,55 @@ +From 55a9d630239bebbc5410f3d2f2485ff8f82873a3 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 13 Jan 2015 16:30:01 -0800 +Subject: [PATCH 17/22] make-session-shutdown-a-seperate-service.patch + +--- + etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++ + etc/systemd/iscsi.service | 3 +-- + 2 files changed, 15 insertions(+), 2 deletions(-) + create mode 100644 etc/systemd/iscsi-shutdown.service + +diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service +new file mode 100644 +index 000000000000..23758e959ff2 +--- /dev/null ++++ b/etc/systemd/iscsi-shutdown.service +@@ -0,0 +1,14 @@ ++[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 ++ExecStop=-/sbin/iscsiadm -m node --logoutall=all +diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service +index ad7be34d5918..27369568bf35 100644 +--- a/etc/systemd/iscsi.service ++++ b/etc/systemd/iscsi.service +@@ -5,7 +5,7 @@ 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 ++Wants=remote-fs-pre.target iscsi-shutdown.service + ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes + ConditionDirectoryNotEmpty=|/sys/class/iscsi_session + +@@ -14,7 +14,6 @@ Type=oneshot + RemainAfterExit=true + ExecStart=-/usr/libexec/iscsi-mark-root-nodes + ExecStart=-/sbin/iscsiadm -m node --loginall=automatic +-ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic + ExecReload=-/sbin/iscsiadm -m node --loginall=automatic + + [Install] +-- +2.14.3 + diff --git a/0017-update-iscsi.service-for-boot-session-recovery.patch b/0017-update-iscsi.service-for-boot-session-recovery.patch deleted file mode 100644 index 7b2f9ea..0000000 --- a/0017-update-iscsi.service-for-boot-session-recovery.patch +++ /dev/null @@ -1,34 +0,0 @@ -From e032f33bcb166bb3a47b580192e8856765a26503 Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Fri, 14 Mar 2014 09:22:21 -0700 -Subject: [PATCH 17/22] update iscsi.service for boot session recovery - ---- - etc/systemd/iscsi.service | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index d5712bd..3de76c5 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service -@@ -5,14 +5,15 @@ DefaultDependencies=no - Conflicts=shutdown.target - After=systemd-remount-fs.service network.target iscsid.service iscsiuio.service - Before=remote-fs-pre.target --ConditionDirectoryNotEmpty=/var/lib/iscsi/nodes -+ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes -+ConditionDirectoryNotEmpty=|/sys/class/iscsi_session - - [Service] - Type=oneshot - RemainAfterExit=true - ExecStart=/usr/libexec/iscsi-mark-root-nodes -+SuccessExitStatus=21 - ExecStart=/sbin/iscsiadm -m node --loginall=automatic --ExecStop=/bin/sync - ExecStop=/sbin/iscsiadm -m node --logoutall=automatic - ExecReload=/sbin/iscsiadm -m node --loginall=automatic - --- -2.9.3 - diff --git a/0018-Add-macros-to-release-GIL-lock.patch b/0018-Add-macros-to-release-GIL-lock.patch new file mode 100644 index 0000000..9b74d78 --- /dev/null +++ b/0018-Add-macros-to-release-GIL-lock.patch @@ -0,0 +1,56 @@ +From 16248312077c5d9b015a09e86743710be69ec0e6 Mon Sep 17 00:00:00 2001 +From: Jiri Konecny +Date: Mon, 11 May 2015 13:16:26 +0200 +Subject: [PATCH 18/22] Add macros to release GIL lock + +Other threads are blocked when GIL is not released before the time consuming +functions. +--- + libiscsi/pylibiscsi.c | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c +index 88008538f04f..40b59553a28e 100644 +--- a/libiscsi/pylibiscsi.c ++++ b/libiscsi/pylibiscsi.c +@@ -364,8 +364,13 @@ static PyObject *PyIscsiNode_str(PyObject *self) + static PyObject *PyIscsiNode_login(PyObject *self) + { + PyIscsiNode *node = (PyIscsiNode *)self; ++ int ret; + +- if (libiscsi_node_login(context, &node->node)) { ++ Py_BEGIN_ALLOW_THREADS ++ ret = libiscsi_node_login(context, &node->node); ++ Py_END_ALLOW_THREADS ++ ++ if (ret) { + PyErr_SetString(PyExc_IOError, + libiscsi_get_error_string(context)); + return NULL; +@@ -551,6 +556,7 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self, + 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, +@@ -570,8 +576,12 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self, + } + } + +- 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; +-- +2.14.3 + diff --git a/0018-updates-to-iscsi.service.patch b/0018-updates-to-iscsi.service.patch deleted file mode 100644 index 29cb9f7..0000000 --- a/0018-updates-to-iscsi.service.patch +++ /dev/null @@ -1,41 +0,0 @@ -From f27dfc682af4758a15f37fb24ffc1dd08542d812 Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Wed, 17 Sep 2014 09:58:39 -0700 -Subject: [PATCH 18/22] updates to iscsi.service - -Resolves: #1126524 -Resolves: #1111925 ---- - etc/systemd/iscsi.service | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index 3de76c5..ad7be34 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service -@@ -5,17 +5,17 @@ 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 - ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes - ConditionDirectoryNotEmpty=|/sys/class/iscsi_session - - [Service] - Type=oneshot - RemainAfterExit=true --ExecStart=/usr/libexec/iscsi-mark-root-nodes --SuccessExitStatus=21 --ExecStart=/sbin/iscsiadm -m node --loginall=automatic --ExecStop=/sbin/iscsiadm -m node --logoutall=automatic --ExecReload=/sbin/iscsiadm -m node --loginall=automatic -+ExecStart=-/usr/libexec/iscsi-mark-root-nodes -+ExecStart=-/sbin/iscsiadm -m node --loginall=automatic -+ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic -+ExecReload=-/sbin/iscsiadm -m node --loginall=automatic - - [Install] - WantedBy=sysinit.target --- -2.9.3 - diff --git a/0019-libiscsi-introduce-sessions-API.patch b/0019-libiscsi-introduce-sessions-API.patch new file mode 100644 index 0000000..2d79629 --- /dev/null +++ b/0019-libiscsi-introduce-sessions-API.patch @@ -0,0 +1,290 @@ +From a9522cd93a4040ce3edbf61babf66c36e9379d22 Mon Sep 17 00:00:00 2001 +From: Peter Hatina +Date: Mon, 5 Oct 2015 16:50:36 -0700 +Subject: [PATCH 19/22] 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 064e4b570d0b..755c18ca8e3b 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 756590e14d8b..a9891f48b7d6 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 0cc55b97bde9..276b95d6869c 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 +@@ -1145,6 +1146,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 cdcefa65f683..12ad87f96c8c 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.14.3 + diff --git a/0019-make-session-shutdown-a-seperate-service.patch.patch b/0019-make-session-shutdown-a-seperate-service.patch.patch deleted file mode 100644 index c4c59ae..0000000 --- a/0019-make-session-shutdown-a-seperate-service.patch.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 24e4c97887d28d8adfa80c990571633e9baa1c7b Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 13 Jan 2015 16:30:01 -0800 -Subject: [PATCH 19/22] make-session-shutdown-a-seperate-service.patch - ---- - etc/systemd/iscsi-shutdown.service | 14 ++++++++++++++ - etc/systemd/iscsi.service | 3 +-- - 2 files changed, 15 insertions(+), 2 deletions(-) - create mode 100644 etc/systemd/iscsi-shutdown.service - -diff --git a/etc/systemd/iscsi-shutdown.service b/etc/systemd/iscsi-shutdown.service -new file mode 100644 -index 0000000..23758e9 ---- /dev/null -+++ b/etc/systemd/iscsi-shutdown.service -@@ -0,0 +1,14 @@ -+[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 -+ExecStop=-/sbin/iscsiadm -m node --logoutall=all -diff --git a/etc/systemd/iscsi.service b/etc/systemd/iscsi.service -index ad7be34..2736956 100644 ---- a/etc/systemd/iscsi.service -+++ b/etc/systemd/iscsi.service -@@ -5,7 +5,7 @@ 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 -+Wants=remote-fs-pre.target iscsi-shutdown.service - ConditionDirectoryNotEmpty=|/var/lib/iscsi/nodes - ConditionDirectoryNotEmpty=|/sys/class/iscsi_session - -@@ -14,7 +14,6 @@ Type=oneshot - RemainAfterExit=true - ExecStart=-/usr/libexec/iscsi-mark-root-nodes - ExecStart=-/sbin/iscsiadm -m node --loginall=automatic --ExecStop=-/sbin/iscsiadm -m node --logoutall=automatic - ExecReload=-/sbin/iscsiadm -m node --loginall=automatic - - [Install] --- -2.9.3 - diff --git a/0020-Add-macros-to-release-GIL-lock.patch b/0020-Add-macros-to-release-GIL-lock.patch deleted file mode 100644 index ceed0b8..0000000 --- a/0020-Add-macros-to-release-GIL-lock.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 3c025d240c2c8196aea42d2979a22ac3134abf6b Mon Sep 17 00:00:00 2001 -From: Jiri Konecny -Date: Mon, 11 May 2015 13:16:26 +0200 -Subject: [PATCH 20/22] Add macros to release GIL lock - -Other threads are blocked when GIL is not released before the time consuming -functions. ---- - libiscsi/pylibiscsi.c | 16 +++++++++++++--- - 1 file changed, 13 insertions(+), 3 deletions(-) - -diff --git a/libiscsi/pylibiscsi.c b/libiscsi/pylibiscsi.c -index 8800853..40b5955 100644 ---- a/libiscsi/pylibiscsi.c -+++ b/libiscsi/pylibiscsi.c -@@ -364,8 +364,13 @@ static PyObject *PyIscsiNode_str(PyObject *self) - static PyObject *PyIscsiNode_login(PyObject *self) - { - PyIscsiNode *node = (PyIscsiNode *)self; -+ int ret; - -- if (libiscsi_node_login(context, &node->node)) { -+ Py_BEGIN_ALLOW_THREADS -+ ret = libiscsi_node_login(context, &node->node); -+ Py_END_ALLOW_THREADS -+ -+ if (ret) { - PyErr_SetString(PyExc_IOError, - libiscsi_get_error_string(context)); - return NULL; -@@ -551,6 +556,7 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self, - 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, -@@ -570,8 +576,12 @@ static PyObject *pylibiscsi_discover_sendtargets(PyObject *self, - } - } - -- 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; --- -2.9.3 - diff --git a/0020-use-Red-Hat-version-string-to-match-RPM-package-vers.patch b/0020-use-Red-Hat-version-string-to-match-RPM-package-vers.patch new file mode 100644 index 0000000..f245c69 --- /dev/null +++ b/0020-use-Red-Hat-version-string-to-match-RPM-package-vers.patch @@ -0,0 +1,25 @@ +From 5972521ca52b9cbfc3a5afb3b64609b8dfecf204 Mon Sep 17 00:00:00 2001 +From: Chris Leech +Date: Mon, 21 Jan 2013 15:43:36 -0800 +Subject: [PATCH 20/22] use Red Hat version string to match RPM package version + +--- + usr/version.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usr/version.h b/usr/version.h +index 4dfef4ccfb77..1334d47c6bb3 100644 +--- a/usr/version.h ++++ b/usr/version.h +@@ -6,7 +6,7 @@ + * This may not be the same value as the kernel versions because + * some other maintainer could merge a patch without going through us + */ +-#define ISCSI_VERSION_STR "2.0-876" ++#define ISCSI_VERSION_STR "6.2.0.876-1" + #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" + + #endif +-- +2.14.3 + diff --git a/0021-libiscsi-fix-discovery-request-timeout-regression.patch b/0021-libiscsi-fix-discovery-request-timeout-regression.patch new file mode 100644 index 0000000..1d9d9ec --- /dev/null +++ b/0021-libiscsi-fix-discovery-request-timeout-regression.patch @@ -0,0 +1,32 @@ +From f1705fa7d9f27b392f14a371553de7b01582e9ed Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 28 Feb 2017 09:00:41 -0800 +Subject: [PATCH 21/22] 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 755c18ca8e3b..bb17dfcafded 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.14.3 + diff --git a/0021-libiscsi-introduce-sessions-API.patch b/0021-libiscsi-introduce-sessions-API.patch deleted file mode 100644 index 3ca61f2..0000000 --- a/0021-libiscsi-introduce-sessions-API.patch +++ /dev/null @@ -1,290 +0,0 @@ -From 2888bd75bb8bf47966d2b508a170f008d64327d3 Mon Sep 17 00:00:00 2001 -From: Peter Hatina -Date: Mon, 5 Oct 2015 16:50:36 -0700 -Subject: [PATCH 21/22] 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 84c396c..51d9ea5 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 -@@ -1145,6 +1146,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 9a56105..e4eaf20 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.9.3 - diff --git a/0022-libiscsi-format-security-build-errors.patch b/0022-libiscsi-format-security-build-errors.patch new file mode 100644 index 0000000..f6cc0c2 --- /dev/null +++ b/0022-libiscsi-format-security-build-errors.patch @@ -0,0 +1,35 @@ +From 18745aa7e3052cefaf58ed7862bfe10d078a9331 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Tue, 28 Feb 2017 10:06:42 -0800 +Subject: [PATCH 22/22] 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 bb17dfcafded..7003388e3346 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.14.3 + diff --git a/0022-use-Red-Hat-version-string-to-match-RPM-package-vers.patch b/0022-use-Red-Hat-version-string-to-match-RPM-package-vers.patch deleted file mode 100644 index 77ba83c..0000000 --- a/0022-use-Red-Hat-version-string-to-match-RPM-package-vers.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f55c3d07e3625958b9c9da5deb9b200d9ad6b2bf Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Mon, 21 Jan 2013 15:43:36 -0800 -Subject: [PATCH 22/22] use Red Hat version string to match RPM package version - ---- - usr/version.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/usr/version.h b/usr/version.h -index 20f0794..333c3cc 100644 ---- a/usr/version.h -+++ b/usr/version.h -@@ -6,7 +6,7 @@ - * This may not be the same value as the kernel versions because - * some other maintainer could merge a patch without going through us - */ --#define ISCSI_VERSION_STR "2.0-874" -+#define ISCSI_VERSION_STR "6.2.0.874" - #define ISCSI_VERSION_FILE "/sys/module/scsi_transport_iscsi/version" - - #endif --- -2.9.3 - diff --git a/0023-fix-discoverydb-command-timeout.patch b/0023-fix-discoverydb-command-timeout.patch deleted file mode 100644 index 4bd3d18..0000000 --- a/0023-fix-discoverydb-command-timeout.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 76cdf1d071442a6dec34c59a2c32397e58691757 Mon Sep 17 00:00:00 2001 -From: Chris Leech -Date: Thu, 16 Feb 2017 11:09:54 -0800 -Subject: [PATCH 1/1] fix timeout setting on discoverydb commands - ---- - usr/idbm.c | 2 ++ - usr/iscsiadm.c | 1 + - 2 files changed, 3 insertions(+) - -diff --git a/usr/idbm.c b/usr/idbm.c -index 3b8a5a2..eb46e94 100644 ---- a/usr/idbm.c -+++ b/usr/idbm.c -@@ -914,6 +914,7 @@ idbm_discovery_setup_defaults(discovery_rec_t *rec, discovery_type_e type) - - rec->startup = ISCSI_STARTUP_MANUAL; - rec->type = type; -+ rec->iscsid_req_tmo = -1; - switch (type) { - case DISCOVERY_TYPE_SENDTARGETS: - rec->u.sendtargets.discoveryd_poll_inval = 30; -@@ -1914,6 +1915,7 @@ idbm_discovery_read(discovery_rec_t *out_rec, int drec_type, - return ISCSI_ERR_INVAL; - - memset(out_rec, 0, sizeof(discovery_rec_t)); -+ out_rec->iscsid_req_tmo = -1; - - info = idbm_recinfo_alloc(MAX_KEYS); - if (!info) -diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c -index 4b2bd34..5818596 100644 ---- a/usr/iscsiadm.c -+++ b/usr/iscsiadm.c -@@ -2860,6 +2860,7 @@ static int exec_disc2_op(int disc_type, char *ip, int port, - int rc = 0; - - memset(&drec, 0, sizeof(struct discovery_rec)); -+ drec.iscsid_req_tmo = -1; - if (disc_type != -1) - drec.type = disc_type; - --- -1.8.3.1 - diff --git a/0023-libiscsi-fix-build-to-use-libopeniscsiusr.patch b/0023-libiscsi-fix-build-to-use-libopeniscsiusr.patch new file mode 100644 index 0000000..8f83ad5 --- /dev/null +++ b/0023-libiscsi-fix-build-to-use-libopeniscsiusr.patch @@ -0,0 +1,36 @@ +From ae3c1ddf846ce40960de9c6ef024577d69ccb1e0 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Thu, 24 May 2018 15:17:05 -0700 +Subject: [PATCH 1/1] 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 317a7ec4db30..1196bb5c0cf4 100644 +--- a/libiscsi/Makefile ++++ b/libiscsi/Makefile +@@ -4,7 +4,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 +@@ -19,7 +21,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.14.3 + diff --git a/0024-libiscsi-fix-discovery-timeout-regression.patch b/0024-libiscsi-fix-discovery-timeout-regression.patch deleted file mode 100644 index fbe23dc..0000000 --- a/0024-libiscsi-fix-discovery-timeout-regression.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 7028eb21348ca79c2a0f33807275089980ffa177 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 28 Feb 2017 09:00:41 -0800 -Subject: 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 755c18ca8e3b..bb17dfcafded 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.9.3 - diff --git a/0024-libopeniscsiusr-temp-disable-gcc-errors.patch b/0024-libopeniscsiusr-temp-disable-gcc-errors.patch new file mode 100644 index 0000000..fe065d6 --- /dev/null +++ b/0024-libopeniscsiusr-temp-disable-gcc-errors.patch @@ -0,0 +1,40 @@ +From db7fe07bc108ea30beb4f54a42c67df428f8862a Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Thu, 24 May 2018 15:41:34 -0700 +Subject: [PATCH 1/1] libopeniscsiusr: temp disable gcc errors + +--- + Makefile | 2 +- + libopeniscsiusr/Makefile | 3 ++- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 6c94ca96016e..8d6f5d8ef102 100644 +--- a/Makefile ++++ b/Makefile +@@ -7,7 +7,7 @@ + DESTDIR ?= + + prefix = /usr +-exec_prefix = / ++exec_prefix = /usr + sbindir = $(exec_prefix)/sbin + bindir = $(exec_prefix)/bin + mandir = $(prefix)/share/man +diff --git a/libopeniscsiusr/Makefile b/libopeniscsiusr/Makefile +index 8b9b523c1d96..0df30f8c34f0 100644 +--- a/libopeniscsiusr/Makefile ++++ b/libopeniscsiusr/Makefile +@@ -42,7 +42,8 @@ EXTRA_MAN_FILES = libopeniscsiusr.h.3 + OBJS = context.o misc.o session.o sysfs.o iface.o + + CFLAGS ?= -O2 -g +-CFLAGS += -Wall -Werror -Wextra -fvisibility=hidden -fPIC ++CFLAGS += -Wall -Werror -Wextra -fvisibility=hidden -fPIC \ ++ -Wno-format-truncation -Wno-stringop-truncation + + LIBADD = + +-- +2.14.3 + diff --git a/0025-dont-install-scripts.patch b/0025-dont-install-scripts.patch new file mode 100644 index 0000000..c20a3be --- /dev/null +++ b/0025-dont-install-scripts.patch @@ -0,0 +1,19 @@ +commit 873379c560fb5e014afa53d05dab7145635ac3c4 +Author: Chris Leech +Date: Thu May 24 15:53:35 2018 -0700 + + dont install scripts + +diff --git a/Makefile b/Makefile +index 8d6f5d8ef102..9422b62b53b1 100644 +--- a/Makefile ++++ b/Makefile +@@ -99,7 +99,7 @@ install_udev_rules: + $(INSTALL) -d $(DESTDIR)$(rulesdir) + $(INSTALL) -m 644 $(RULESFILES) $(DESTDIR)/$(rulesdir) + +-install_programs: $(PROGRAMS) $(SCRIPTS) ++install_programs: $(PROGRAMS) # $(SCRIPTS) + $(INSTALL) -d $(DESTDIR)$(sbindir) + $(INSTALL) -m 755 $^ $(DESTDIR)$(sbindir) + diff --git a/0025-libiscsi-format-security-build-errors.patch b/0025-libiscsi-format-security-build-errors.patch deleted file mode 100644 index 6644ea6..0000000 --- a/0025-libiscsi-format-security-build-errors.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 173fe0956fee58f6568fa61d2cd4609ca4decfb1 Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Tue, 28 Feb 2017 10:06:42 -0800 -Subject: 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 bb17dfcafded..66fe54f5f897 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.9.3 - diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec index 600875f..20e7075 100644 --- a/iscsi-initiator-utils.spec +++ b/iscsi-initiator-utils.spec @@ -1,12 +1,12 @@ %global open_iscsi_version 2.0 -%global open_iscsi_build 874 -%global commit0 86e88927d1ffbadff37f5d2137e5c73c50845843 +%global open_iscsi_build 876 +%global commit0 24580adc4c174bbc5dde3ae7594a46d57635e906 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) Summary: iSCSI daemon and utility programs Name: iscsi-initiator-utils Version: 6.%{open_iscsi_version}.%{open_iscsi_build} -Release: 10.git%{shortcommit0}%{?dist} +Release: 1.git%{shortcommit0}%{?dist} Group: System Environment/Daemons License: GPLv2+ URL: http://www.open-iscsi.org @@ -25,20 +25,20 @@ Patch0008: 0008-use-red-hat-for-name.patch Patch0009: 0009-libiscsi.patch Patch0010: 0010-remove-the-offload-boot-supported-ifdef.patch Patch0011: 0011-iscsiuio-systemd-unit-files.patch -Patch0012: 0012-disable-iscsid.startup-from-iscsiadm-prefer-systemd-.patch -Patch0013: 0013-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch -Patch0014: 0014-start-socket-listeners-on-iscsiadm-command.patch -Patch0015: 0015-Revert-iscsiadm-return-error-when-login-fails.patch -Patch0016: 0016-update-handling-of-boot-sessions.patch -Patch0017: 0017-update-iscsi.service-for-boot-session-recovery.patch -Patch0018: 0018-updates-to-iscsi.service.patch -Patch0019: 0019-make-session-shutdown-a-seperate-service.patch.patch -Patch0020: 0020-Add-macros-to-release-GIL-lock.patch -Patch0021: 0021-libiscsi-introduce-sessions-API.patch -Patch0022: 0022-use-Red-Hat-version-string-to-match-RPM-package-vers.patch -Patch0023: 0023-fix-discoverydb-command-timeout.patch -Patch0024: 0024-libiscsi-fix-discovery-timeout-regression.patch -Patch0025: 0025-libiscsi-format-security-build-errors.patch +Patch0012: 0012-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch +Patch0013: 0013-Revert-iscsiadm-return-error-when-login-fails.patch +Patch0014: 0014-update-handling-of-boot-sessions.patch +Patch0015: 0015-update-iscsi.service-for-boot-session-recovery.patch +Patch0016: 0016-updates-to-iscsi.service.patch +Patch0017: 0017-make-session-shutdown-a-seperate-service.patch.patch +Patch0018: 0018-Add-macros-to-release-GIL-lock.patch +Patch0019: 0019-libiscsi-introduce-sessions-API.patch +Patch0020: 0020-use-Red-Hat-version-string-to-match-RPM-package-vers.patch +Patch0021: 0021-libiscsi-fix-discovery-request-timeout-regression.patch +Patch0022: 0022-libiscsi-format-security-build-errors.patch +Patch0023: 0023-libiscsi-fix-build-to-use-libopeniscsiusr.patch +Patch0024: 0024-libopeniscsiusr-temp-disable-gcc-errors.patch +Patch0025: 0025-dont-install-scripts.patch BuildRequires: flex bison python2-devel python3-devel python2-setuptools doxygen kmod-devel systemd-units BuildRequires: autoconf automake libtool libmount-devel openssl-devel @@ -120,8 +120,9 @@ popd %install %{__make} DESTDIR=%{?buildroot} install_programs install_doc install_etc # upstream makefile doesn't get everything the way we like it -rm $RPM_BUILD_ROOT%{_sbindir}/iscsi_discovery +#rm $RPM_BUILD_ROOT%{_sbindir}/iscsi_discovery 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 644 doc/iscsistart.8 $RPM_BUILD_ROOT%{_mandir}/man8 %{__install} -pm 644 doc/iscsi-iname.8 $RPM_BUILD_ROOT%{_mandir}/man8 @@ -281,6 +282,9 @@ fi %{python3_sitearch}/* %changelog +* Tue Jun 19 2018 Chris Leech - 6.2.0.876-1.git24580ad +- rebase to upstream 2.0.876 + * Tue Jun 19 2018 Miro HronĨok - 6.2.0.874-10.git86e8892 - Rebuilt for Python 3.7