Blob Blame History Raw
%global open_iscsi_version	2.0
%global open_iscsi_build	873
%global checkout		c9d830b

Summary: iSCSI daemon and utility programs
Name: iscsi-initiator-utils
Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
Release: 25.git%{checkout}%{?dist}
Group: System Environment/Daemons
License: GPLv2+

Source4: 04-iscsi
Source5: iscsi-tmpfiles.conf

# upstream patches, post last tagged version
Patch1: 0001-iscsid-fix-iscsid-segfault-during-qla4xxx-login.patch
Patch2: 0002-ISCSISTART-Bring-up-the-corresponding-network-interf.patch
Patch3: 0003-iscsi-tools-fix-compile-error-when-OFFLOAD_BOOT_SUPP.patch
Patch4: 0004-ISCSID-Passing-more-net-params-from-ibft-to-iface.patch
Patch5: 0005-iscsi-tools-Convert-r-argument-to-an-integer-before-.patch
Patch6: 0006-Update-README-for-removal-of-DBM-requirement.patch
Patch7: 0007-iscsid-iscsiadm-fix-abstract-socket-length-in-bind-c.patch
Patch8: 0008-iscsid-implement-systemd-compatible-socket-activatio.patch
Patch9: 0009-iscsid-add-example-unit-files-for-systemd.patch
Patch10: 0010-iscsi-tools-fix-get_random_bytes-error-handling.patch
Patch11: 0011-ISCSID-Added-socket-communication-hooks-for-uip.patch
Patch12: 0012-ISCSID-Modified-the-Makefile-for-iscsiuio-compilatio.patch
Patch13: 0013-ISCSID-Added-iscsiuio-source-to-the-open-iscsi-pkg.patch
Patch14: 0014-From-Adheer-Chandravanshi-adheer.chandravanshi-qlogi.patch
Patch15: 0015-Manpage-changes-for-flashnode-submode-support-for-ho.patch
Patch16: 0016-README-changes-for-flashnode-submode-support-for-hos.patch
Patch17: 0017-PATCH-1-of-1-correctly-check-return-value-of-nice.patch
Patch18: 0018-Allow-firmware-mode-to-use-debug-flag.patch
Patch19: 0019-iscsiadm-return-error-when-login-fails.patch
Patch20: 0020-iscsiadm-bind-ifaces-to-portals-found-using-isns.patch
Patch21: 0021-iscsiadm-Check-for-mode-is-not-required-when-creatin.patch
Patch22: 0022-iscsid-iscsiadm-add-support-for-emulex-one-connect-s.patch
Patch23: 0023-ISCSIUIO-Updated-iscsiuio-to-version-
Patch24: 0024-Fix-discovery-error-return-without-return-value.patch
Patch25: 0025-iscsid-Fix-strlen-parameter.patch
Patch26: 0026-iscsiuio-Change-socket-bind-to-use-the-same-struct-s.patch
Patch27: 0027-Make-rescan-run-in-parallel.patch
Patch28: 0028-iscsiadm-Correctly-check-for-invalid-hostno-and-flas.patch
Patch29: 0029-iscsi-tools-Print-additional-session-info-for-flashn.patch
Patch30: 0030-iscsi-tools-sync-iscsi_if.h-with-kernel-space.patch
Patch31: 0031-PATCH-v5-1-3-ISCSISTART-Saved-ibft-boot-info-to-the-.patch
Patch32: 0032-ISCSID-Added-the-extraction-of-the-session-boot-info.patch
Patch33: 0033-ISCSID-Added-iface-content-override-fix.patch
Patch34: 0034-iscsi-tools-Bug-fix-on-IPC-address-copy-version-2.patch
Patch35: 0035-flashnode-Add-support-to-set-ISCSI_FLASHNODE_CHAP_OU.patch
Patch36: 0036-iscsiadm-Use-x-option-instead-of-v-to-specify-chap_t.patch
Patch37: 0037-iscsiadm-Man-page-changes-to-use-x-option-for-chap_t.patch
Patch38: 0038-README-changes-to-use-long-option-index-instead-of-f.patch
Patch39: 0039-iscsiadm-Add-support-to-set-CHAP-entry-using-host-ch.patch
Patch40: 0040-iscsi-tools-Correctly-get-username_in-and-password_i.patch
Patch41: 0041-README-changes-for-adding-support-to-set-CHAP-entry.patch
Patch42: 0042-iscsi-tools-Setup-iface-conf-file-with-all-iface-att.patch
Patch43: 0043-iscsi_if.h-Remove-numbers-used-for-network-parameter.patch
Patch44: 0044-iscsi_if.h-Additional-parameters-for-network-param-s.patch
Patch45: 0045-iscsi-tools-Use-macro-to-set-IPv4-IPv6-IP-addresses.patch
Patch46: 0046-iscsi-tools-Use-single-function-to-enable-disable-ne.patch
Patch47: 0047-iscsi-tools-Use-single-function-to-set-integer-netwo.patch
Patch48: 0048-iscsi-tools-Ignore-network-parameter-if-not-enabled-.patch
Patch49: 0049-iscsi-tools-Additional-parameters-for-network-settin.patch
Patch50: 0050-iscsi-tools-iface-params-should-be-updated-for-node_.patch
Patch51: 0051-iscsi-tools-Let-default-type-of-iface-be-ipv4.patch
Patch52: 0052-iscsi-tools-Show-iface-params-based-on-iface-type.patch
Patch53: 0053-iscsiadm-Added-document-for-description-of-iface-att.patch
Patch54: 0054-iscsi_tool-Add-offload-host-statistics-support.patch
Patch55: 0055-README-Updated-for-host-statistics.patch
Patch56: 0056-iscsiadm.8-Updated-man-page-for-host-statistics.patch
Patch57: 0057-iscsi-tools-Fix-the-iscsiadm-help-options-for-host-m.patch
Patch58: 0058-Man-page-correction-for-host-mode-options-of-iscsiad.patch
Patch59: 0059-ISCSIUIO-Added-tx-doorbell-override-mechanism.patch
Patch60: 0060-ISCSIUIO-Added-fix-for-the-iface.subnet_mask-decodin.patch
Patch61: 0061-ISCSIUIO-Added-fix-for-the-ARP-cache-flush-mechanism.patch
Patch62: 0062-ISCSIUIO-Updated-RELEASE-note-and-version.patch
Patch63: 0063-ISCSIUIO-Updated-the-configure-file-to-reflect-the-n.patch
Patch64: 0064-ISCSIUIO-Removed-the-auto-generated-COPYING-file.patch
Patch68: 0068-iscsiuio-fix-compilation.patch
Patch69: 0069-Add-missing-DESTDIR.patch
Patch70: 0070-iscsi-tools-set-non-negotiated-params-early.patch
Patch71: 0071-iscsiadm-Fix-the-hostno-check-for-stats-submode-of-h.patch
Patch72: 0072-iscsiadm-Fix-the-compile-time-warning.patch
Patch74: 0074-iscsid-Fix-handling-of-iscsi-async-events.patch
Patch75: 0075-be2iscsi-Fix-MaxXmitDataLenght-of-the-driver.patch
Patch76: 0076-Fix-StatSN-in-Open-iSCSI-Stack.patch
Patch77: 0077-iscsid-retry-login-for-ISCSI_ERR_HOST_NOT_FOUND.patch
Patch78: 0078-iscsid-Fix-double-close-of-mgmt-ipc-fd.patch
Patch79: 0079-iscsiadm-Initialize-param_count-in-set_host_chap_inf.patch
Patch81: 0081-iscsiadm-make-iface.ipaddress-optional-in-iface-conf.patch
Patch82: 0082-Remove-unused-variable-path.patch
Patch83: 0083-Parse-origin-value-from-iBFT.patch
Patch84: 0084-isns-Add-docs-for-deregistering-discovery-domains.patch
Patch114: 0114-fix-regression-in-iscsi_tcp-iface-binding.patch

# not (yet) upstream merged
Patch130: 0130-guard-against-NULL-ptr-during-discovery-from-unexpec.patch
Patch140: 0140-add-discovery-as-a-valid-mode-in-iscsiadm.8.patch
Patch143: 0143-idmb_rec_write-check-for-tpgt-first.patch
Patch145: 0145-idbm_rec_write-seperate-old-and-new-style-writes.patch
Patch146: 0146-idbw_rec_write-pick-tpgt-from-existing-record.patch
Patch147: 0147-iscsiuio-systemd-socket-activation-support.patch
Patch149: 0149-update-systemd-service-files-add-iscsi.service-for-s.patch
Patch150: 0150-iscsi-boot-related-service-file-updates.patch
# distro specific modifications
Patch151: 0151-update-initscripts-and-docs.patch
Patch152: 0152-use-var-for-config.patch
Patch153: 0153-use-red-hat-for-name.patch
Patch154: 0154-add-libiscsi.patch
Patch155: 0155-dont-use-static.patch
Patch156: 0156-remove-the-offload-boot-supported-ifdef.patch
Patch159: 0159-iscsiuio-systemd-unit-files.patch
Patch160: 0160-use-systemctl-to-start-iscsid.patch
Patch162: 0162-Don-t-check-for-autostart-sessions-if-iscsi-is-not-u.patch
Patch163: 0163-fix-order-of-setting-uid-gid-and-drop-supplementary-.patch
Patch165: 0165-fix-hardened-build-of-iscsiuio.patch
Patch166: 0166-start-socket-listeners-on-iscsiadm-command.patch
Patch167: 0167-Revert-iscsiadm-return-error-when-login-fails.patch
Patch168: 0168-update-handling-of-boot-sessions.patch
Patch169: 0169-update-iscsi.service-for-boot-session-recovery.patch
Patch170: 0170-fix-systemd-unit-wants.patch
Patch171: 0171-iscsiuio-strict-aliasing.patch
Patch172: 0172-move-cleanup-to-seperate-service.patch
# version string, needs to be updated with each build
Patch199: 0199-use-Red-Hat-version-string-to-match-RPM-package-vers.patch

BuildRequires: flex bison python2-devel python3-devel python-setuptools doxygen kmod-devel systemd-devel
# For dir ownership
Requires: %{name}-iscsiuio >= %{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

%global _hardened_build 1
%global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so|%{python3_sitearch}/.*\\.so)$

The iscsi package provides the server daemon for the iSCSI protocol,
as well as the utility programs used to manage it. iSCSI is a protocol
for distributed disk access using SCSI commands sent over Internet
Protocol networks.

%package iscsiuio
Summary: Userspace configuration daemon required for some iSCSI hardware
Group: System Environment/Daemons
License: BSD
Requires: %{name} = %{version}-%{release}

%description iscsiuio
The iscsiuio configuration daemon provides network configuration help
for some iSCSI offload hardware.

%package devel
Summary: Development files for %{name}
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%autosetup -p1 -n open-iscsi-%{open_iscsi_version}-%{open_iscsi_build}

# change exec_prefix, there's no easy way to override
%{__sed} -i -e 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile


# configure sub-packages from here
# letting the top level Makefile do it will lose setting from rpm
cd iscsiuio
%{__chmod} +x configure
cd ..
cd utils/open-isns
%{configure} --with-security=no --with-slp=no
cd ../..

%{__make} OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod"
pushd libiscsi
%{__python2} build
%{__python3} build
touch -r libiscsi.doxy html/*

%{__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%{_mandir}/man8/iscsi_discovery.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
%{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
%{__install} -pm 644 iscsiuio/iscsiuiolog $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d

%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/nodes
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/send_targets
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/static
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/isns
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/slp
%{__install} -d $RPM_BUILD_ROOT%{_sharedstatedir}/iscsi/ifaces

# for %%ghost
%{__install} -d $RPM_BUILD_ROOT/var/lock/iscsi
touch $RPM_BUILD_ROOT/var/lock/iscsi/lock

%{__install} -d $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsi-shutdown.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsid.socket $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsiuio.service $RPM_BUILD_ROOT%{_unitdir}
%{__install} -pm 644 etc/systemd/iscsiuio.socket $RPM_BUILD_ROOT%{_unitdir}

%{__install} -d $RPM_BUILD_ROOT%{_libexecdir}
%{__install} -pm 755 etc/systemd/iscsi-mark-root-nodes $RPM_BUILD_ROOT%{_libexecdir}

%{__install} -d $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d
%{__install} -pm 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/dispatcher.d

%{__install} -d $RPM_BUILD_ROOT%{_tmpfilesdir}
%{__install} -pm 644 %{SOURCE5} $RPM_BUILD_ROOT%{_tmpfilesdir}/iscsi.conf

%{__install} -d $RPM_BUILD_ROOT%{_libdir}
%{__install} -pm 755 libiscsi/ $RPM_BUILD_ROOT%{_libdir}
%{__ln_s} $RPM_BUILD_ROOT%{_libdir}/
%{__install} -d $RPM_BUILD_ROOT%{_includedir}
%{__install} -pm 644 libiscsi/libiscsi.h $RPM_BUILD_ROOT%{_includedir}

%{__install} -d $RPM_BUILD_ROOT%{python2_sitearch}
%{__install} -d $RPM_BUILD_ROOT%{python3_sitearch}
pushd libiscsi
%{__python2} install --skip-build --root $RPM_BUILD_ROOT
%{__python3} install --skip-build --root $RPM_BUILD_ROOT


%systemd_post iscsi.service iscsi-shutdown.service iscsid.service iscsid.socket

if [ $1 -eq 1 ]; then
	if [ ! -f %{_sysconfdir}/iscsi/initiatorname.iscsi ]; then
		echo "InitiatorName=`/usr/sbin/iscsi-iname`" > %{_sysconfdir}/iscsi/initiatorname.iscsi
	# enable socket activation and persistant session startup by default
	/bin/systemctl enable iscsi.service >/dev/null 2>&1 || :
	/bin/systemctl enable iscsid.socket >/dev/null 2>&1 || :

%post iscsiuio
%systemd_post iscsiuio.service iscsiuio.socket

if [ $1 -eq 1 ]; then
	/bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || :

%systemd_preun iscsi.service iscsi-shutdown.service iscsid.service iscsiuio.service iscsid.socket iscsiuio.socket

%preun iscsiuio
%systemd_preun iscsiuio.service iscsiuio.socket


%postun iscsiuio

%triggerun -- iscsi-initiator-utils <
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply iscsid
# and systemd-sysv-convert --apply iscsi
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save iscsi >/dev/null 2>&1 ||:
/usr/bin/systemd-sysv-convert --save iscsid >/dev/null 2>&1 ||:

# enable socket activation
/bin/systemctl enable iscsid.socket >/dev/null 2>&1 || :
/bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || :

# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del iscsid >/dev/null 2>&1 || :
/sbin/chkconfig --del iscsi >/dev/null 2>&1 || :
/bin/systemctl try-restart iscsid.service >/dev/null 2>&1 || :
/bin/systemctl try-restart iscsi.service >/dev/null 1>&1 || :

%triggerun iscsiuio -- iscsi-initiator-utils <
# enable socket activation
/bin/systemctl enable iscsiuio.socket >/dev/null 2>&1 || :

%triggerun -- iscsi-initiator-utils <
# prior to iscsi.service was missing a
# this forces active if needed for a clean shutdown/reboot
# after upgrading this package
if [ $1 -gt 0 ]; then
    /usr/bin/systemctl -q is-active iscsi.service
    if [ $? -eq 0 ]; then
        /usr/bin/systemctl -q is-active
        if [ $? -ne 0 ]; then
            SRC=`/usr/bin/systemctl show --property FragmentPath | cut -d= -f2`
            if [ $SRC != $DST ]; then
                cp $SRC $DST
            sed -i 's/RefuseManualStart=yes/RefuseManualStart=no/' $DST
            /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
            /usr/bin/systemctl start >/dev/null 2>&1 || :

%triggerun -- iscsi-initiator-utils <
if [ $1 -gt 0 ]; then
    systemctl start iscsi-shutdown.service >/dev/null 2>&1 || :

%dir %{_sharedstatedir}/iscsi
%dir %{_sharedstatedir}/iscsi/nodes
%dir %{_sharedstatedir}/iscsi/isns
%dir %{_sharedstatedir}/iscsi/static
%dir %{_sharedstatedir}/iscsi/slp
%dir %{_sharedstatedir}/iscsi/ifaces
%dir %{_sharedstatedir}/iscsi/send_targets
%ghost %{_var}/lock/iscsi
%ghost %{_var}/lock/iscsi/lock
%dir %{_sysconfdir}/iscsi
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/iscsi/iscsid.conf

%files iscsiuio
%config(noreplace) %{_sysconfdir}/logrotate.d/iscsiuiolog

%files devel
%doc libiscsi/html

* Wed Jan 28 2015 Chris Leech <> -
- split out session logout on shutdown to a separate service
- 985321 roll up libiscsi patches, update python bindings to support python3
- scriptlets were never split out properly for the iscsiuio subpackage
- fix regression in network interface binding
- created iscsi-shutdown.service to ensure that session cleanup happens
- Add --with-slp=no
- segfault from unexpected netlink event during discovery
- inhibit strict aliasing optimizations in iscsiuio, rpmdiff error

* Thu Oct 23 2014 Chris Leech <> -
- sync with upstream v2.0.873-84-gc9d830b
- ignore iscsiadm return in iscsi.service
- make sure systemd order against remote mounts is correct
- add discovery as a valid mode in iscsiadm.8
- make sure to pass --with-security=no to isns configure

* Sat Aug 16 2014 Fedora Release Engineering <> -
- Rebuilt for

* Sat Jun 07 2014 Fedora Release Engineering <> -
- Rebuilt for

* Mon Apr 14 2014 Chris Leech <> -
- boot session handling improvements
- split out iscsiuio into a seperate sub-package
- sync with new upstream additions
- revert change to return code when calling login_portal for sessions
  that already exist, as it impacts users scripting around iscsiadm

* Tue Dec 10 2013 Chris Leech <> -
- fix regression in glob use, inappropriate error code escape
- clean up dead node links from discovery when reusing tpgt

* Mon Nov 25 2013 Chris Leech <> -
- fix iscsiuio socket activation
- have systemd start socket units on iscsiadm use, if not already listening

* Sun Sep 15 2013 Chris Leech <> -
- move /sbin to /usr/sbin
- use rpm macros in install rules

* Fri Sep 13 2013 Chris Leech <> -
- fix iscsiuio hardened build and other compiler flags

* Fri Aug 23 2013 Andy Grover <> -
- Fix patch 0041 to check session != NULL before calling iscsi_sysfs_read_boot()

* Tue Aug 20 2013 Chris Leech <> -
- fix regression in last build, database records can't be accessed

* Mon Aug 19 2013 Chris Leech <> -
- iscsi boot related fixes
  make sure iscsid gets started if there are any boot sessions running
  add reload target to fix double session problem when restarting from NM
  don't rely on session list passed from initrd, never got fully implemented
  remove patches related to running iscsid from initrd, possible to revisit later

* Sun Aug 18 2013 Chris Leech <> -
- sync with upstream git, minor context fixes after rebase of out-of-tree patches
- iscsiuio is merged upstream, remove old source archive and patches
- spec cleanups to fix rpmlint issues

* Sun Aug  4 2013 Peter Robinson <>
- Fix FTBFS, cleanup spec

* Sat Aug 03 2013 Fedora Release Engineering <> -
- Rebuilt for

* Tue Jun 11 2013 Chris Leech <> -
- Use the systemd tmpfiles service to recreate lockfiles in /var/lock
- 955167 build as a position independent executable
- 894576 fix order of setuid/setgid and drop additional groups

* Tue May 28 2013 Chris Leech <> -
- Don't have iscsiadm scan for autostart record if node db is empty (bug #951951)

* Tue Apr 30 2013 Orion Poplawski <> -
- Fix typo in NM dispatcher script (bug #917058)

* Thu Feb 21 2013 Chris Leech <> -
- build with libkmod support, instead of calling out to modprobe
- enable socket activation by default

* Thu Jan 24 2013 Kalev Lember <> -
- Fix the postun script to not use ldconfig as the interpreter

* Wed Jan 23 2013 Chris Leech <> -
- package iscsi_mark_root_nodes script, it's being referenced by the unit files

* Tue Jan 22 2013 Chris Leech <> -
- rebase to new upstream code
- systemd conversion
- 565245 Fix multilib issues caused by timestamp in doxygen footers

* Thu Jul 19 2012 Fedora Release Engineering <> -
- Rebuilt for

* Tue Feb 14 2012 Mike Christie <>
- 789683 Fix boot slow down when the iscsi service is started
  (regression added in when the nm wait was added).

* Mon Feb 6 2012 Mike Christie <>
- 786174 Change iscsid/iscsi service startup, so it always starts
  when called.

* Sat Feb 4 2012 Mike Christie <>
- 747479 Fix iscsidevs handling of network requirement

* Fri Jan 13 2012 Fedora Release Engineering <> -
- Rebuilt for

* Wed Nov 30 2011 Mike Christie <>
- Fix version string to reflect fedora and not rhel.

* Tue Oct 18 2011 Mike Christie <>
- Update iscsi tools.

* Sat Apr 30 2011 Hans de Goede <> -
- Change iscsi init scripts to check for networking being actually up, rather
  then for NetworkManager being started (#692230)

* Tue Apr 26 2011 Hans de Goede <> -
- Fix iscsid autostarting when upgrading from an older version
  (add iscsid.startup key to iscsid.conf on upgrade)
- Fix printing of [ OK ] when successfully stopping iscsid
- systemd related fixes:
 - Add Should-Start/Stop tgtd to iscsi init script to fix (re)boot from
   hanging when using locally hosted targets
 - %%ghost /var/lock/iscsi and contents (#656605)

* Mon Apr 25 2011 Mike Christie <>
- Fix iscsi init scripts check for networking being up (#692230)

* Wed Feb 09 2011 Fedora Release Engineering <> -
- Rebuilt for