Accepting request 704983 from home:sschricker:branches:Base:System

- Add new subpackage containing the nvme-cli regress script
- Add script to determine host NQN based on the system UUID
  + 0008-nvme-cli-Add-script-to-determine-host-NQN.patch
- Add new udev rule for NetApp E-Series and adjust udev rule naming
  scheme accordingly. (bsc#1124564)
  + 0006-nvme-cli-add-default-IO-policy-rule-for-NetApp-E-Ser.patch
  + 0007-nvme-cli-Rename-udev-rule-for-ONTAP-controller.patch
- Update to version 1.8.1+git64.b969cf0:
  * fix json print for list-subsys command
  * Add Virtium plugin extension document
  * Add Virtium plugin extension
  * nvme.h: Fix typos in status code values
  * nvme-cli: remove unused NVME_AER_NOTICE_
  * list-ctrl, create-ns, format: Do not return directly without
    freeing fd

OBS-URL: https://build.opensuse.org/request/show/704983
OBS-URL: https://build.opensuse.org/package/show/Base:System/nvme-cli?expand=0&rev=75
This commit is contained in:
Simon Schricker 2019-05-23 11:19:41 +00:00 committed by Git OBS Bridge
parent d55eb58f3c
commit c284f4a13b
8 changed files with 178 additions and 9 deletions

View File

@ -0,0 +1,24 @@
From bfbcc6d02f0621bb9ff5afc39862aac55ff305bf Mon Sep 17 00:00:00 2001
From: Simon Schricker <sschricker@suse.de>
Date: Wed, 15 May 2019 13:36:41 +0200
Subject: [PATCH] nvme-cli: add default IO-policy rule for NetApp E-Series
NetApp E-Series controller provide several paths to the same subsystem,
so we should be switching to 'round-robin' iopolicy to provide the best
performance.
---
scripts/71-nvme-iopolicy-netapp-E-Series.rules | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 scripts/71-nvme-iopolicy-netapp-E-Series.rules
diff --git a/scripts/71-nvme-iopolicy-netapp-E-Series.rules b/scripts/71-nvme-iopolicy-netapp-E-Series.rules
new file mode 100644
index 0000000..902c083
--- /dev/null
+++ b/scripts/71-nvme-iopolicy-netapp-E-Series.rules
@@ -0,0 +1,2 @@
+# Enable round-robin for NetApp E-Series
+ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{model}=="NetApp E-Series", ATTR{iopolicy}="round-robin"
--
2.16.4

View File

@ -0,0 +1,18 @@
From eae06c9af819f7d1782833783661ad3bf376fae4 Mon Sep 17 00:00:00 2001
From: Simon Schricker <sschricker@suse.de>
Date: Thu, 16 May 2019 16:42:49 +0200
Subject: [PATCH] nvme-cli: Rename udev rule for ONTAP controller
To have a consistent naming scheme with the E-Series udev rule.
---
...{71-nvme-iopolicy-netapp.rules => 71-nvme-iopolicy-netapp-ONTAP.rules} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename scripts/{71-nvme-iopolicy-netapp.rules => 71-nvme-iopolicy-netapp-ONTAP.rules} (100%)
diff --git a/scripts/71-nvme-iopolicy-netapp.rules b/scripts/71-nvme-iopolicy-netapp-ONTAP.rules
similarity index 100%
rename from scripts/71-nvme-iopolicy-netapp.rules
rename to scripts/71-nvme-iopolicy-netapp-ONTAP.rules
--
2.16.4

View File

@ -0,0 +1,64 @@
From b38de666b0ae385bb35c00280c48a20f4d4d6aae Mon Sep 17 00:00:00 2001
From: Simon Schricker <sschricker@suse.de>
Date: Fri, 17 May 2019 15:36:37 +0200
Subject: [PATCH] nvme-cli: Add script to determine host NQN
* Based on the system-UUID, via dmidecode
* verifies UUID format
* tries to catch fake/lazy UUIDs
---
scripts/det-hostnqn.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 scripts/det-hostnqn.sh
diff --git a/scripts/det-hostnqn.sh b/scripts/det-hostnqn.sh
new file mode 100644
index 0000000..d8783cf
--- /dev/null
+++ b/scripts/det-hostnqn.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+LC_ALL=C
+
+UUID=$(dmidecode -s system-uuid | tr -d '[:space:]')
+
+if [ -z "$UUID" ] ; then
+ >&2 echo "No UUID found, can't determine hostnqn."
+ exit 1
+fi
+
+# convert UUID to lower-case only:
+UUID=$(echo $UUID | tr '[:upper:]' '[:lower:]')
+
+# check UUID format, e.g.: 4c4c4544-0156-4a10-8134-b7d04f383232, so: 8-4-4-4-12
+if ! [[ $UUID =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]] ; then
+ >&2 echo "UUID has invalid format."
+ >&2 echo "Invalid UUID: ${UUID}"
+ exit 2
+fi
+
+# HEURISTIC:
+# (1) if any one given character occurs more than 50% of the time, it is likely
+# that the UUID is fake.
+# (2) if the first or the last group consists of mostly the same character, it
+# is likely that the UUID is fake.
+FIRST_GROUP="$(echo $UUID | cut -d'-' -f1)"
+LAST_GROUP="$(echo $UUID | cut -d'-' -f5)"
+for i in {{0..9},{a..f}} ; do
+ COUNT_TOTAL="${UUID//[^$i]}"
+ COUNT_FIRST="${FIRST_GROUP//[^$i]}"
+ COUNT_LAST="${LAST_GROUP//[^$i]}"
+ if [ ${#COUNT_TOTAL} -ge 16 ] || [ ${#COUNT_FIRST} -ge 7 ] || [ ${#COUNT_LAST} -ge 11 ] ; then
+ >&2 echo "UUID is too repetitive. This may be a false alert."
+ >&2 echo "Repetitive UUID: ${UUID}"
+ exit 3
+ fi
+done
+
+HOSTNQN="nqn.2014-08.org.nvmexpress:uuid:${UUID}"
+
+echo $HOSTNQN
--
2.16.4

View File

@ -1,4 +1,10 @@
<servicedata>
<service name="obs_scm">
<param name="url">https://github.com/linux-nvme/nvme-cli.git</param>
<param name="changesrevision">75800fff4a17f6d97ef884772b88a2dfbd84251a</param></service></servicedata>
<param name="changesrevision">75800fff4a17f6d97ef884772b88a2dfbd84251a</param>
</service>
<service name="tar_scm">
<param name="url">https://github.com/linux-nvme/nvme-cli.git</param>
<param name="changesrevision">b969cf0b67995035a17ed89812d695b7f954f39c</param>
</service>
</servicedata>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba0ae34e20227b0eb477edea284252ffa560306c033cd6775bd5c26bc61c127e
size 228972

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4d1414a761d9baf9d592ca63aae1385564c1b75f523faf6c499b4198fefba53f
size 236744

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Thu May 23 06:55:34 UTC 2019 - Simon Schricker <sschricker@suse.com>
- Add new subpackage containing the nvme-cli regress script
- Add script to determine host NQN based on the system UUID
+ 0008-nvme-cli-Add-script-to-determine-host-NQN.patch
- Add new udev rule for NetApp E-Series and adjust udev rule naming
scheme accordingly. (bsc#1124564)
+ 0006-nvme-cli-add-default-IO-policy-rule-for-NetApp-E-Ser.patch
+ 0007-nvme-cli-Rename-udev-rule-for-ONTAP-controller.patch
- Update to version 1.8.1+git64.b969cf0:
* fix json print for list-subsys command
* Add Virtium plugin extension document
* Add Virtium plugin extension
* nvme.h: Fix typos in status code values
* nvme-cli: remove unused NVME_AER_NOTICE_
* list-ctrl, create-ns, format: Do not return directly without
freeing fd
-------------------------------------------------------------------
Thu May 9 15:19:44 UTC 2019 - Simon Schricker <sschricker@suse.com>

View File

@ -17,7 +17,7 @@
Name: nvme-cli
Version: 1.8.1+git41.2c43c51
Version: 1.8.1+git64.b969cf0
Release: 0
Summary: NVM Express user space tools
License: GPL-2.0-only
@ -31,17 +31,32 @@ Patch2: 0002-71-nvme-iopolicy-netapp.rules-add-default-rules-for-.patch
Patch3: 0003-Add-nvmefc-connect.target.patch
Patch4: 0004-Change-service-to-type-simple.patch
Patch5: 0005-nvme-cli-Check-for-sysfs-interface-before-NVMe-disco.patch
Patch6: 0006-nvme-cli-add-default-IO-policy-rule-for-NetApp-E-Ser.patch
Patch7: 0007-nvme-cli-Rename-udev-rule-for-ONTAP-controller.patch
Patch8: 0008-nvme-cli-Add-script-to-determine-host-NQN.patch
BuildRequires: libuuid-devel
BuildRequires: pkgconfig
BuildRequires: xmlto
BuildRequires: pkgconfig(libudev)
BuildRequires: rubygem(asciidoctor)
%ifarch x86_64 aarch64 i586
Requires(post): dmidecode
%endif
%description
NVM Express (NVMe) is a direct attached storage interface. The
nvme-cli package contains core management tools with minimal
dependencies.
%package -n nvme-cli-regress-script
Summary: A small script to test the nvme binary for regressions
Group: Hardware/Other
Requires: nvme-cli
%description -n nvme-cli-regress-script
A small shell script to test the nvme binary for regressions. It requires an
NVMe device for testing purposes. Do NOT use in a production environment.
%prep
%setup -q
%patch1 -p1
@ -49,10 +64,14 @@ dependencies.
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build
echo %{version} > version
make CFLAGS="%{optflags} -I." PREFIX=%{_prefix} USE_ASCIIDOCTOR=YesPlease %{?_smp_mflags} all
sed -i '/make.*/d' regress
%install
make PREFIX=%{_prefix} DESTDIR=%{buildroot} install-bin install-man %{?_smp_mflags}
@ -62,7 +81,13 @@ install -m 644 -D nvme-fc-autoconnect/70-nvmefc-autoconnect.rules %{buildroot}%{
install -m 644 -D nvme-fc-autoconnect/nvmefc-boot-connections.service %{buildroot}%{_unitdir}/nvmefc-boot-connections.service
install -m 644 -D nvme-fc-autoconnect/nvmefc-connect@.service %{buildroot}%{_unitdir}/nvmefc-connect@.service
install -m 644 -D nvme-fc-autoconnect/nvmefc-connect.target %{buildroot}%{_unitdir}/nvmefc-connect.target
install -m 644 -D scripts/71-nvme-iopolicy-netapp.rules %{buildroot}%{_udevrulesdir}/71-nvme-iopolicy-netapp.rules
install -m 644 -D scripts/71-nvme-iopolicy-netapp-ONTAP.rules %{buildroot}%{_udevrulesdir}/71-nvme-iopolicy-netapp-ONTAP.rules
install -m 644 -D scripts/71-nvme-iopolicy-netapp-E-Series.rules %{buildroot}%{_udevrulesdir}/71-nvme-iopolicy-netapp-E-Series.rules
%ifarch x86_64 aarch64 i586
install -m 744 -D scripts/det-hostnqn.sh %{buildroot}%{_sbindir}/nvme-det-hostnqn
%endif
# for subpackage nvme-cli-regress-script:
install -m 744 -D regress %{buildroot}%{_sbindir}/nvme-regress
%define services nvmefc-boot-connections.service nvmefc-connect.target
@ -70,10 +95,16 @@ install -m 644 -D scripts/71-nvme-iopolicy-netapp.rules %{buildroot}%{_udevrules
%service_add_pre %services nvmefc-connect@.service
%post
if [ ! -e %{_sysconfdir}/nvme/hostnqn ]; then
%ifarch x86_64 aarch64 i586
if [ ! -s %{_sysconfdir}/nvme/hostnqn ]; then
%{_sbindir}/nvme-det-hostnqn > %{_sysconfdir}/nvme/hostnqn
fi
%endif
if [ ! -s %{_sysconfdir}/nvme/hostnqn ]; then
%{_bindir}/echo "Generating random host NQN."
%{_sbindir}/nvme gen-hostnqn > %{_sysconfdir}/nvme/hostnqn
fi
if [ ! -e %{_sysconfdir}/nvme/hostid ]; then
if [ ! -s %{_sysconfdir}/nvme/hostid ]; then
%{_bindir}/uuidgen > %{_sysconfdir}/nvme/hostid
fi
%service_add_post %services nvmefc-connect@.service
@ -93,12 +124,16 @@ fi
%license LICENSE
%doc README.md
%{_sbindir}/nvme
%ifarch x86_64 aarch64 i586
%{_sbindir}/nvme-det-hostnqn
%endif
%{_mandir}/man1/nvme*.1*%{?ext_man}
%dir %{_datadir}/bash_completion
%dir %{_datadir}/bash_completion/completions/
%{_datadir}/bash_completion/completions/nvme
%{_udevrulesdir}/70-nvmefc-autoconnect.rules
%{_udevrulesdir}/71-nvme-iopolicy-netapp.rules
%{_udevrulesdir}/71-nvme-iopolicy-netapp-ONTAP.rules
%{_udevrulesdir}/71-nvme-iopolicy-netapp-E-Series.rules
%{_unitdir}/nvmefc-boot-connections.service
%{_unitdir}/nvmefc-connect@.service
%{_unitdir}/nvmefc-connect.target
@ -106,4 +141,7 @@ fi
%ghost %{_sysconfdir}/nvme/hostnqn
%ghost %{_sysconfdir}/nvme/hostid
%files -n nvme-cli-regress-script
%{_sbindir}/nvme-regress
%changelog