Sync with RHEL 9:

- generate hostnqn and hostid in %post
- silence hostnqn-hostid consistency checks
This commit is contained in:
Tomas Bzatek 2024-05-03 18:28:24 +02:00
parent f412f40846
commit 3e81399d53
2 changed files with 38 additions and 7 deletions

View File

@ -0,0 +1,19 @@
diff -up nvme-cli-2.9.1/fabrics.c.bak nvme-cli-2.9.1/fabrics.c
--- nvme-cli-2.9.1/fabrics.c.bak 2024-05-03 16:03:42.000000000 +0200
+++ nvme-cli-2.9.1/fabrics.c 2024-05-03 18:26:34.915157152 +0200
@@ -643,6 +643,7 @@ char *nvmf_hostid_from_hostnqn(const cha
void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn, unsigned int verbose)
{
+#if 0
_cleanup_free_ char *hostid_from_file = NULL;
_cleanup_free_ char *hostid_from_hostnqn = NULL;
@@ -665,6 +666,7 @@ void nvmf_check_hostid_and_hostnqn(const
fprintf(stderr,
"warning: use hostid which does not match uuid in hostnqn\n");
}
+#endif
}
int nvmf_discover(const char *desc, int argc, char **argv, bool connect)

View File

@ -10,6 +10,8 @@ License: GPL-2.0-only
URL: https://github.com/linux-nvme/nvme-cli
Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz
Patch0: 0001-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch
BuildRequires: meson >= 0.50.0
BuildRequires: gcc gcc-c++
BuildRequires: systemd-devel
@ -45,13 +47,6 @@ nvme-cli provides NVM-Express user space tooling for Linux.
%meson_install
%{__install} -pm 644 README.md %{buildroot}%{_pkgdocdir}
# hostid and hostnqn are supposed to be unique per machine. We obviously
# can't package them.
# nvme-stas ships the stas-config@.service that will take care
# of generating these files if missing. See rhbz 2065886#c19
rm -f %{buildroot}%{_sysconfdir}/nvme/hostid
rm -f %{buildroot}%{_sysconfdir}/nvme/hostnqn
# Do not install the dracut rule yet. See rhbz 1742764
rm -f %{buildroot}/usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf
@ -80,6 +75,23 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme
# Do not install the dracut rule yet. See rhbz 1742764
# /usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf
%post
if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
if [ ! -s %{_sysconfdir}/nvme/hostnqn ]; then
echo $(nvme gen-hostnqn) > %{_sysconfdir}/nvme/hostnqn
fi
if [ ! -s %{_sysconfdir}/nvme/hostid ]; then
echo $(nvme show-hostnqn | sed 's/^.*uuid://') > %{_sysconfdir}/nvme/hostid
fi
# apply udev and systemd changes that we did
if [ $1 -eq 1 ]; then
systemctl enable nvmefc-boot-connections
fi
systemctl daemon-reload
udevadm control --reload-rules && udevadm trigger
exit 0
fi
%changelog
* Fri May 03 2024 Tomas Bzatek <tbzatek@redhat.com> - 2.9.1-1