From a0ab42b3304be897d68817e13d5c8cf1c4294062 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 09 2020 19:58:25 +0000 Subject: import nvme-cli-1.10.1-2.el8 --- diff --git a/SOURCES/nvme-cli-makefile-dont-install-host-params-patch b/SOURCES/nvme-cli-makefile-dont-install-host-params-patch new file mode 100644 index 0000000..b86149e --- /dev/null +++ b/SOURCES/nvme-cli-makefile-dont-install-host-params-patch @@ -0,0 +1,13 @@ +--- nvme-cli-1.9/Makefile.orig 2020-05-27 14:04:56.259961135 -0400 ++++ nvme-cli-1.9/Makefile 2020-05-27 14:05:22.796185371 -0400 +@@ -125,8 +125,8 @@ + $(INSTALL) -m 644 -T ./etc/discovery.conf.in $(DESTDIR)$(SYSCONFDIR)/nvme/discovery.conf; \ + fi + +-install-spec: install-bin install-man install-bash-completion install-zsh-completion install-etc install-systemd install-udev install-dracut +-install: install-spec install-hostparams ++install-spec: install-bin install-man install-bash-completion install-zsh-completion install-systemd install-udev install-dracut ++install: install-spec + + nvme.spec: nvme.spec.in NVME-VERSION-FILE + sed -e 's/@@VERSION@@/$(NVME_VERSION)/g' < $< > $@+ diff --git a/SOURCES/nvme-print-nvme-list-json-fix-patch b/SOURCES/nvme-print-nvme-list-json-fix-patch new file mode 100644 index 0000000..efad0d5 --- /dev/null +++ b/SOURCES/nvme-print-nvme-list-json-fix-patch @@ -0,0 +1,58 @@ +commit 01e6062e7be71b7dec29ecd8de09eb411ddd78f1 +Author: Yi Zhang +Date: Fri May 1 15:42:10 2020 +0800 + + nvme-print: nvme list -o json fix + + Bellow error log will be triggered on non pcie transport, so only print the + ProductName for pcie transport, also add print "\n" and json_free_object fix + + Failed to open /sys/class/nvme/nvme1/device/subsystem_vendor with errno No such file or directory + Failed to open /sys/class/nvme/nvme1/device/subsystem_device with errno No such file or directory + Failed to open /sys/class/nvme/nvme1/device/vendor with errno No such file or directory + Failed to open /sys/class/nvme/nvme1/device/device with errno No such file or directory + Failed to open /sys/class/nvme/nvme1/device/class with errno No such file or directory + { + "Devices" : [ + { + "NameSpace" : 1, + "DevicePath" : "/dev/nvme1n1", + "Firmware" : "4.18.0-1", + "Index" : 1, + "ModelNumber" : "Linux", + "ProductName" : "NULL", + "SerialNumber" : "eb4695bf0da275a3", + "UsedBytes" : 268435456000, + "MaximumLBA" : 524288000, + "PhysicalSize" : 268435456000, + "SectorSize" : 512 + } + ] + } + + Reported-by: Justin Tee + Signed-off-by: Yi Zhang + Signed-off-by: Keith Busch + +diff --git a/nvme-print.c b/nvme-print.c +index 42e27a3..7414280 100644 +--- a/nvme-print.c ++++ b/nvme-print.c +@@ -4629,7 +4629,7 @@ static void json_simple_ns(struct nvme_namespace *n, struct json_array *devices) + + json_object_add_value_string(device_attrs, "ModelNumber", formatter); + +- if (index >= 0) { ++ if (index >= 0 && !strcmp(n->ctrl->transport, "pcie")) { + char *product = nvme_product_name(index); + + json_object_add_value_string(device_attrs, "ProductName", product); +@@ -4682,6 +4682,8 @@ static void json_simple_list(struct nvme_topology *t) + } + json_object_add_value_array(root, "Devices", devices); + json_print_object(root, NULL); ++ printf("\n"); ++ json_free_object(root); + } + + static void json_print_list_items(struct nvme_topology *t, diff --git a/SPECS/nvme-cli.spec b/SPECS/nvme-cli.spec index 163a0dd..605c8ee 100644 --- a/SPECS/nvme-cli.spec +++ b/SPECS/nvme-cli.spec @@ -3,7 +3,7 @@ Name: nvme-cli Version: 1.10.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: NVMe management command line interface License: GPLv2+ @@ -13,6 +13,8 @@ Source0: https://github.com/linux-nvme/%{name}/archive/v%{version}.tar.gz Patch0: nvme-cli-memblaze-change-mode-patch Patch1: nvme-cli-add-addl-smart-log-crit-warn-decoding-patch +Patch2: nvme-cli-makefile-dont-install-host-params-patch +Patch3: nvme-print-nvme-list-json-fix-patch BuildRequires: libuuid-devel BuildRequires: gcc @@ -26,7 +28,8 @@ nvme-cli provides NVM-Express user space tooling for Linux. %setup -q %patch0 -p1 %patch1 -p1 - +%patch2 -p1 +%patch3 -p1 %build @@ -57,9 +60,6 @@ rm -f %{buildroot}/usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf %{_datadir}/bash-completion/completions/nvme %{_datadir}/zsh/site-functions/_nvme %dir %{_sysconfdir}/nvme -%{_sysconfdir}/nvme/hostnqn -%{_sysconfdir}/nvme/hostid -%{_sysconfdir}/nvme/discovery.conf %{_unitdir}/nvmefc-boot-connections.service %{_unitdir}/nvmf-connect.target %{_unitdir}/nvmf-connect@.service @@ -70,9 +70,13 @@ rm -f %{buildroot}/usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf %post -if [ $1 -eq 1 ]; then # 1 : This package is being installed for the first time +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 uuidgen > %{_sysconfdir}/nvme/hostid + fi # apply udev and systemd changes that we did systemctl enable nvmefc-boot-connections