diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index 06e65af..9e74667 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,14 @@ /targetd-0.8.3.tar.gz /targetd-0.8.5.tar.gz /targetd-0.8.6.tar.gz +/targetd-0.8.9.tar.gz +/targetd-0.8.10.tar.gz +/targetd-0.8.11.tar.gz +/targetd-0.8.12.tar.gz +/targetd-0.9.0.tar.gz +/targetd-0.9.1.tar.gz +/targetd-0.10.0.tar.gz +/targetd-0.10.1.tar.gz +/targetd-0.10.2.tar.gz +/targetd-0.10.3.tar.gz +/targetd-0.10.4.tar.gz diff --git a/0001_rtslib_fb_api_fix.patch b/0001_rtslib_fb_api_fix.patch new file mode 100644 index 0000000..887fd2d --- /dev/null +++ b/0001_rtslib_fb_api_fix.patch @@ -0,0 +1,23 @@ +diff --git a/targetd/block.py b/targetd/block.py +index b7b03f0..edd47ec 100644 +--- a/targetd/block.py ++++ b/targetd/block.py +@@ -26,10 +26,17 @@ from rtslib_fb import ( + LUN, + MappedLUN, + RTSLibError, +- RTSLibNotInCFS, + NodeACLGroup, + ) + ++# This commit https://github.com/open-iscsi/rtslib-fb/commit/fdd69b1984bac6a6c3f08890bc22267b848a26ac ++# renamed a number of error classes which causes us to do the following ++try: ++ from rtslib_fb import RTSLibNotInCFS ++except ImportError: ++ from rtslib_fb import RTSLibNotInCFSError as RTSLibNotInCFS ++ ++ + from targetd.backends import lvm, zfs + from targetd.main import TargetdError + from targetd.utils import ignored, name_check diff --git a/plans/ci_test.sh b/plans/ci_test.sh new file mode 100755 index 0000000..8d8bc63 --- /dev/null +++ b/plans/ci_test.sh @@ -0,0 +1,58 @@ +#!/usr/bin/bash + +function _chk +{ + echo "executing: $@" + eval "$@" + local rc=$? + if [ $rc -ne 0 ]; then + echo "Failed: $rc" + # Dump log for targetd + echo "journalctl -u targetd" + journalctl -u targetd + + # On failure dump the audit logs + echo "ausearch ..." + ausearch -i -m avc,user_avc,selinux_err,user_selinux_err -ts recent + exit 1 + fi +} + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 source directory" + exit 1 +fi + +SOURCE_DIR="$1" +BASE=$PWD + +# TODO REMOVE THIS WHEN RAWHIDE PICKS UP +# https://github.com/fedora-selinux/selinux-policy-contrib/pull/334 +_chk setenforce 0 + +# Run the upstream setup script +_chk cd $SOURCE_DIR +_chk ./test/test.sh setup + +# Pick up new changes from setup +_chk systemctl restart targetd + +# Make sure nfs stuff is ok +_chk systemctl start rpcbind +_chk systemctl start nfs-server + +# Try stopping the firewall, but don't fail if this fails +systemctl stop firewalld + +# Give the service a moment to start up. +_chk sleep 10 + +# See if the daemon is up and accepting ... +netstat -anp | grep LISTEN | grep 18700 + +# Go back to start directory and run unit test. +_chk cd $BASE + +SRC="$SOURCE_DIR" +_chk TARGETD_UT_CERTFILE=/etc/target/targetd_cert.pem PYTHONPATH=$SRC python3 $SRC/test/targetd_test.py -v +exit 0 \ No newline at end of file diff --git a/plans/tests.fmf b/plans/tests.fmf new file mode 100644 index 0000000..6775fd6 --- /dev/null +++ b/plans/tests.fmf @@ -0,0 +1,50 @@ +summary: targetd gating tests + +provision: + how: virtual + image: fedora + +prepare: + how: install + package: + - targetd + - util-linux + - lvm2 + - procps-ng + - coreutils + - openssl + - btrfs-progs + - audit + - python3-requests + - net-tools-2.0 + - nfs-utils + +discover: + how: shell + dist-git-source: true + dist-git-install-builddeps: true + tests: + - name: upstream test suite + test: | + set -x + if [ -z "$PKG_VER" ]; then + PKG_VER=`rpmspec -q --srpm --qf "%{version}" targetd.spec` + fi + if [ -z "$PKG_VER" ]; then + echo "Error: Unable to extract package version" + exit 1 + fi + + export SRC="$TMT_SOURCE_DIR/targetd-${PKG_VER}" + echo "Source is located: $SRC" + + echo "We are $PWD" + ls -lh + + echo "TMT_SOURCE_DIR is ($TMT_SOURCE_DIR)" + + ./plans/ci_test.sh "$SRC" + +execute: + - how: tmt + diff --git a/sources b/sources index 8ca51d8..4dee891 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (targetd-0.8.6.tar.gz) = 91c2c05545b89f330f63454620a9b812e54f67d760c135141cdd4be7ef364a537896ad6c3af1f3651f120ae88bc5626a7dd835217cc30ac568d9248166fcf096 +SHA512 (targetd-0.10.4.tar.gz) = 3394b0ee2226a4fb7e5f93f1c4e3f7aeeb5a023351b8be3d33f7d5201da4ca4c906cacb437327ceb2fe81c509f654f2fc142457896f8fc43188de8a62af6dcb8 diff --git a/targetd.spec b/targetd.spec index a4a813c..7634f2c 100644 --- a/targetd.spec +++ b/targetd.spec @@ -1,21 +1,17 @@ Name: targetd -License: GPLv3 -Group: System Environment/Libraries +License: GPL-3.0-only Summary: Service to make storage remotely configurable -Version: 0.8.6 -Release: 1%{?dist} +Version: 0.10.4 +Release: 10%{?dist} URL: https://github.com/open-iscsi/targetd -Source: https://github.com/open-iscsi/targetd/releases/download/v%{version}/targetd-%{version}.tar.gz +Source: https://github.com/open-iscsi/targetd/archive/v%{version}/targetd-%{version}.tar.gz Source1: targetd.service -Source2: targetd.yaml +Patch1: 0001_rtslib_fb_api_fix.patch BuildArch: noarch -BuildRequires: systemd, python3-devel -Requires: python3-PyYAML python3-setproctitle python3-rtslib -Requires: lvm2-python-libs >= 2.02.99, nfs-utils, btrfs-progs -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd - +BuildRequires: systemd-rpm-macros +BuildRequires: python3-devel python3-gobject-base python3-blockdev libblockdev-lvm +Requires: python3-PyYAML python3-setproctitle python3-rtslib target-restore +Requires: nfs-utils, btrfs-progs, python3-blockdev, libblockdev-lvm %description targetd turns the machine into a remotely-configurable storage appliance. @@ -24,20 +20,28 @@ administrator allocate volumes from an LVM volume group, and export those volumes over iSCSI. %prep -%setup -q +%autosetup -p1 + +%generate_buildrequires +%pyproject_buildrequires %build -%{__python3} setup.py build -gzip --stdout targetd.8 > targetd.8.gz +%pyproject_wheel %install mkdir -p %{buildroot}%{_mandir}/man8/ +mkdir -p %{buildroot}%{_mandir}/man5/ mkdir -p %{buildroot}%{_unitdir} mkdir -p %{buildroot}%{_sysconfdir}/target/ install -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/targetd.service -install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/target/targetd.yaml -install -m 644 targetd.8.gz %{buildroot}%{_mandir}/man8/ -%{__python3} setup.py install --skip-build --root %{buildroot} +install -m 644 targetd.yaml %{buildroot}%{_sysconfdir}/target/targetd.yaml +install -m 644 targetd.8 %{buildroot}%{_mandir}/man8/ +install -m 644 targetd.yaml.5 %{buildroot}%{_mandir}/man5/ +%pyproject_install +%pyproject_save_files -l targetd + +%check +%pyproject_check_import %post %systemd_post targetd.service @@ -48,15 +52,132 @@ install -m 644 targetd.8.gz %{buildroot}%{_mandir}/man8/ %postun %systemd_postun_with_restart targetd.service -%files +%files -f %{pyproject_files} %{_bindir}/targetd %{_unitdir}/targetd.service -%{python3_sitelib}/* -%doc LICENSE README.md API.md client -%{_mandir}/man8/targetd.8.gz +%doc README.md API.md client +%{_mandir}/man8/targetd.8* +%{_mandir}/man5/targetd.yaml.5* %config(noreplace) %{_sysconfdir}/target/targetd.yaml %changelog +* Fri Sep 19 2025 Python Maint - 0.10.4-10 +- Rebuilt for Python 3.14.0rc3 bytecode + +* Fri Aug 15 2025 Python Maint - 0.10.4-9 +- Rebuilt for Python 3.14.0rc2 bytecode + +* Thu Jul 24 2025 Tony Asleson - 0.10.4-8 +- Workaround for: https://github.com/open-iscsi/rtslib-fb/issues/220 +- Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2383084 + +* Mon Jun 09 2025 Python Maint - 0.10.4-7 +- Rebuilt for Python 3.14 + +* Mon Jun 09 2025 Tony Asleson - 0.10.4-6 +- Use pyproject macros + +* Mon Jun 02 2025 Python Maint - 0.10.4-5 +- Rebuilt for Python 3.14 + +* Sun Jan 19 2025 Fedora Release Engineering - 0.10.4-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Sat Jul 20 2024 Fedora Release Engineering - 0.10.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jun 07 2024 Python Maint - 0.10.4-2 +- Rebuilt for Python 3.13 + +* Tue Mar 12 2024 Tony Asleson - 0.10.4-1 +- New upstream release + +* Sat Jan 27 2024 Fedora Release Engineering - 0.10.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Dec 11 2023 Tony Asleson - 0.10.3-1 +- New upstream release + +* Fri Jul 21 2023 Tony Asleson - 0.10.2-3 +- migrated to SPDX license + +* Mon Jun 26 2023 Python Maint - 0.10.2-2 +- Rebuilt for Python 3.12 + +* Sat Jun 24 2023 Tony Asleson - 0.10.2-1 +- New upstream release which adds libblockdev 3.0 support + +* Thu Jun 15 2023 Tony Asleson - 0.10.1-1 +- New upstream release which includes a fix for python 3.12 + +* Tue Jun 13 2023 Python Maint - 0.10.0-8 +- Rebuilt for Python 3.12 + +* Sat Jan 21 2023 Fedora Release Engineering - 0.10.0-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Sat Jul 23 2022 Fedora Release Engineering - 0.10.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 0.10.0-5 +- Rebuilt for Python 3.11 + +* Sat Jan 22 2022 Fedora Release Engineering - 0.10.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 0.10.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 04 2021 Python Maint - 0.10.0-2 +- Rebuilt for Python 3.10 + +* Tue Apr 06 2021 Tony Asleson - 0.10.0-1 +- New upstream release + +* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek - 0.9.1-3 +- Rebuilt for updated systemd-rpm-macros + See https://pagure.io/fesco/issue/2583. + +* Wed Jan 27 2021 Fedora Release Engineering - 0.9.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Dec 1 2020 Tony Asleson - 0.9.1-1 +- New upstream release + +* Thu Sep 10 2020 Tony Asleson - 0.9.0-1 +- New upstream release + +* Wed Jul 29 2020 Fedora Release Engineering - 0.8.12-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 15 2020 Tony Asleson - 0.8.12-1 +- New upstream release + +* Tue May 26 2020 Miro Hrončok - 0.8.11-2 +- Rebuilt for Python 3.9 + +* Tue Feb 25 2020 Tony Asleson - 0.8.11-1 +- New upstream release +- Add man page for targetd.yaml.8 + +* Fri Jan 31 2020 Fedora Release Engineering - 0.8.9-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Mon Nov 25 2019 Tony Asleson - 0.8.9-1 +* Revive package and update to latest upstream release. + +* Tue Jun 19 2018 Miro Hrončok - 0.8.6-5 +- Rebuilt for Python 3.7 + +* Fri Feb 09 2018 Fedora Release Engineering - 0.8.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 0.8.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed May 3 2017 Tony Asleson 0.8.6-2 +- Add and correct dependencies + * Thu Apr 27 2017 Tony Asleson 0.8.6-1 - New upstream version, bug fixes diff --git a/targetd.yaml b/targetd.yaml index 61c534a..d12a833 100644 --- a/targetd.yaml +++ b/targetd.yaml @@ -9,6 +9,10 @@ password: # defaults below; uncomment and edit #block_pools: [vg-targetd/thin_pool] # just 1 by default, but can be more + +#zfs_block_pools: [] # you can also use zfs as backend +#zfs_enable_copy: true # Enable if you want copy support, default is false + #fs_pools: [] # Path to btrfs FS, eg. /my_btrfs_mount #user: admin #target_name: iqn.2003-01.org.example.mach1:1234