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

- Add nvmefc-connect.target to allow stopping the parameterized
  services (bsc#1127076). Also change the service type so udevd
  doesn't have to wait for the termination of the service process.
  + 0102-Add-nvmefc-connect.target.patch
  + 0103-Change-service-to-type-simple.patch
- Regenerate documentation (bsc#1124713)
  * Add 0007-Regen-docs.patch
- Minor cleanup for submit_io (bsc#1124713)
  * Add 0008-nvme-cli-minor-cleanup-for-submit_io.patch
- Regenerate documentation ((bsc#1124713)
  * Add 0009-Regen-documentation.patch
- Fix fc_trtype string (bsc#1124713)
  * Add 0010-nvme-cli-fix-fc-trtype-string.patch
- Add 71-nvme-iopolicy-netapp.rules (bsc#1124564)
  * Add 0101-71-nvme-iopolicy-netapp.rules-add-default-rules-for-.patch

OBS-URL: https://build.opensuse.org/request/show/686426
OBS-URL: https://build.opensuse.org/package/show/Base:System/nvme-cli?expand=0&rev=69
This commit is contained in:
Marcus Meissner 2019-03-29 09:41:27 +00:00 committed by Git OBS Bridge
parent b22de9320c
commit 83f92ba664
10 changed files with 504 additions and 15 deletions

196
0007-Regen-docs.patch Normal file
View File

@ -0,0 +1,196 @@
From bfeeaba4f49f741b2cb4c3f2f1f89f835675c485 Mon Sep 17 00:00:00 2001
From: Keith Busch <keith.busch@intel.com>
Date: Mon, 28 Jan 2019 17:50:10 -0700
Subject: [PATCH] Regen docs
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
Documentation/nvme-create-ns.1 | 12 +++++++++---
Documentation/nvme-create-ns.html | 21 ++++++++++++++++++---
Documentation/nvme-format.1 | 4 ++--
Documentation/nvme-format.html | 2 +-
.../nvme-wdc-clear-pcie-correctable-errors.1 | 4 ++--
Documentation/nvme-wdc-vs-smart-add-log.1 | 4 ++--
6 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/Documentation/nvme-create-ns.1 b/Documentation/nvme-create-ns.1
index abedcbd..8963b83 100644
--- a/Documentation/nvme-create-ns.1
+++ b/Documentation/nvme-create-ns.1
@@ -2,12 +2,12 @@
.\" Title: nvme-create-ns
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/08/2019
+.\" Date: 01/28/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-CREATE\-NS" "1" "01/08/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-CREATE\-NS" "1" "01/28/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -37,6 +37,7 @@ nvme-create-ns \- Send NVMe Namespace management command to create namespace, re
[\-\-flbas=<flbas> | \-f <flbas>]
[\-\-dps=<dps> | \-d <dps>]
[\-\-nmic=<nmic> | \-m <nmic>]
+ [\-\-block\-size=<block\-size> | \-b <block\-size>]
.fi
.SH "DESCRIPTION"
.sp
@@ -57,7 +58,7 @@ The namespace capacity\&.
.PP
\-f, \-\-flbas
.RS 4
-The namespace formatted logical block size setting\&.
+The namespace formatted logical block size setting\&. Conflicts with \-\-block\-size argument\&.
.RE
.PP
\-d, \-\-dps
@@ -69,6 +70,11 @@ The data protection settings\&.
.RS 4
Namespace multipath and sharing capabilities\&.
.RE
+.PP
+\-b, \-\-block\-size
+.RS 4
+Target block size the new namespace should be formatted as\&. Potential FLBAS values will be values will be scanned and the lowest numbered will be selected for the create\-ns operation\&. Conflicts with \-\-flbas argument\&.
+.RE
.SH "EXAMPLES"
.sp
No examples provided yet\&.
diff --git a/Documentation/nvme-create-ns.html b/Documentation/nvme-create-ns.html
index f763f91..05225d7 100644
--- a/Documentation/nvme-create-ns.html
+++ b/Documentation/nvme-create-ns.html
@@ -433,7 +433,7 @@ thead, p.table.header {
p.table {
margin-top: 0;
}
-/* Because the table frame attribute is overridden by CSS in most browsers. */
+/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
@@ -750,7 +750,8 @@ nvme-create-ns(1) Manual Page
[--ncap=&lt;ncap&gt; | -c &lt;ncap&gt;]
[--flbas=&lt;flbas&gt; | -f &lt;flbas&gt;]
[--dps=&lt;dps&gt; | -d &lt;dps&gt;]
- [--nmic=&lt;nmic&gt; | -m &lt;nmic&gt;]</pre>
+ [--nmic=&lt;nmic&gt; | -m &lt;nmic&gt;]
+ [--block-size=&lt;block-size&gt; | -b &lt;block-size&gt;]</pre>
<div class="attribution">
</div></div>
</div>
@@ -800,6 +801,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di
<dd>
<p>
The namespace formatted logical block size setting.
+ Conflicts with --block-size argument.
</p>
</dd>
<dt class="hdlist1">
@@ -824,6 +826,19 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di
Namespace multipath and sharing capabilities.
</p>
</dd>
+<dt class="hdlist1">
+-b
+</dt>
+<dt class="hdlist1">
+--block-size
+</dt>
+<dd>
+<p>
+ Target block size the new namespace should be formatted as. Potential FLBAS
+ values will be values will be scanned and the lowest numbered will be
+ selected for the create-ns operation. Conflicts with --flbas argument.
+</p>
+</dd>
</dl></div>
</div>
</div>
@@ -843,7 +858,7 @@ device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1).</p></di
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2017-02-27 10:11:57 EST
+Last updated 2019-01-28 17:49:54 MST
</div>
</div>
</body>
diff --git a/Documentation/nvme-format.1 b/Documentation/nvme-format.1
index 0c46ef1..b1f34c3 100644
--- a/Documentation/nvme-format.1
+++ b/Documentation/nvme-format.1
@@ -2,12 +2,12 @@
.\" Title: nvme-format
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/08/2019
+.\" Date: 01/28/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-FORMAT" "1" "01/08/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-FORMAT" "1" "01/28/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/Documentation/nvme-format.html b/Documentation/nvme-format.html
index bbf179f..11ccfef 100644
--- a/Documentation/nvme-format.html
+++ b/Documentation/nvme-format.html
@@ -1013,7 +1013,7 @@ information:
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2019-01-08 17:45:58 MST
+Last updated 2019-01-28 17:42:37 MST
</div>
</div>
</body>
diff --git a/Documentation/nvme-wdc-clear-pcie-correctable-errors.1 b/Documentation/nvme-wdc-clear-pcie-correctable-errors.1
index 0dbe83c..565c8b1 100644
--- a/Documentation/nvme-wdc-clear-pcie-correctable-errors.1
+++ b/Documentation/nvme-wdc-clear-pcie-correctable-errors.1
@@ -2,12 +2,12 @@
.\" Title: nvme-wdc-clear-pcie-correctable-errors
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/11/2019
+.\" Date: 01/28/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-WDC\-CLEAR\-PC" "1" "01/11/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-WDC\-CLEAR\-PC" "1" "01/28/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
diff --git a/Documentation/nvme-wdc-vs-smart-add-log.1 b/Documentation/nvme-wdc-vs-smart-add-log.1
index baf5e2c..eb72efe 100644
--- a/Documentation/nvme-wdc-vs-smart-add-log.1
+++ b/Documentation/nvme-wdc-vs-smart-add-log.1
@@ -2,12 +2,12 @@
.\" Title: nvme-wdc-vs-smart-add-log
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/11/2019
+.\" Date: 01/28/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-WDC\-VS\-SMART" "1" "01/11/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-WDC\-VS\-SMART" "1" "01/28/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
--
2.13.7

View File

@ -0,0 +1,57 @@
From 239b44138378aaa33f474893767bd2566d36d3cf Mon Sep 17 00:00:00 2001
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Date: Mon, 28 Jan 2019 23:12:02 -0800
Subject: [PATCH] nvme-cli: minor cleanup for submit_io()
This is a cleanup patch which adds errno based error messages when
write() failure, this also fixes minor typo and removes unnecessary
braces.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
[fixed typo in changelog, minor style code change]
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
nvme.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/nvme.c b/nvme.c
index 8922ec2..a6686dd 100644
--- a/nvme.c
+++ b/nvme.c
@@ -4245,7 +4245,7 @@ static int submit_io(int opcode, char *command, const char *desc,
dsmgmt |= ((__u32)cfg.dspec) << 16;
}
- if (strlen(cfg.data)){
+ if (strlen(cfg.data)) {
dfd = open(cfg.data, flags, mode);
if (dfd < 0) {
perror(cfg.data);
@@ -4254,7 +4254,7 @@ static int submit_io(int opcode, char *command, const char *desc,
}
mfd = dfd;
}
- if (strlen(cfg.metadata)){
+ if (strlen(cfg.metadata)) {
mfd = open(cfg.metadata, flags, mode);
if (mfd < 0) {
perror(cfg.metadata);
@@ -4347,11 +4347,13 @@ static int submit_io(int opcode, char *command, const char *desc,
printf("%s:%s(%04x)\n", command, nvme_status_to_string(err), err);
else {
if (!(opcode & 1) && write(dfd, (void *)buffer, cfg.data_size) < 0) {
- fprintf(stderr, "failed to write buffer to output file\n");
+ fprintf(stderr, "write: %s: failed to write buffer to output file\n",
+ strerror(errno));
err = EINVAL;
} else if (!(opcode & 1) && cfg.metadata_size &&
write(mfd, (void *)mbuffer, cfg.metadata_size) < 0) {
- fprintf(stderr, "failed to write meta-data buffer to output file\n");
+ fprintf(stderr, "write: %s: failed to write meta-data buffer to output file\n",
+ strerror(errno));
err = EINVAL;
} else
fprintf(stderr, "%s: Success\n", command);
--
2.13.7

View File

@ -0,0 +1,32 @@
From f3a97fdfe4367c0a0e5705ccf0c8cfb926e264cf Mon Sep 17 00:00:00 2001
From: Keith Busch <keith.busch@intel.com>
Date: Tue, 29 Jan 2019 08:50:52 -0700
Subject: [PATCH] Regen documentation
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
Documentation/nvme-create-ns.1 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Documentation/nvme-create-ns.1 b/Documentation/nvme-create-ns.1
index 8963b83..5f751a8 100644
--- a/Documentation/nvme-create-ns.1
+++ b/Documentation/nvme-create-ns.1
@@ -2,12 +2,12 @@
.\" Title: nvme-create-ns
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 01/28/2019
+.\" Date: 01/29/2019
.\" Manual: NVMe Manual
.\" Source: NVMe
.\" Language: English
.\"
-.TH "NVME\-CREATE\-NS" "1" "01/28/2019" "NVMe" "NVMe Manual"
+.TH "NVME\-CREATE\-NS" "1" "01/29/2019" "NVMe" "NVMe Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
--
2.13.7

View File

@ -0,0 +1,39 @@
From 674bffd4ea12081a7da4e94432ffaf235eb2d22b Mon Sep 17 00:00:00 2001
From: James Smart <jsmart2021@gmail.com>
Date: Mon, 4 Feb 2019 13:39:54 -0800
Subject: [PATCH] nvme-cli: fix fc trtype string
Commit 55b4ec12ffe4
("fabrics: use trtype_str when parsing a discovery log entry")
changed to use the trtypes string names in a generic fashion for
the "transport=?" string passed in the connect string to the kernel.
For FC, this meant the hardcoding of "transport=fc" was removed and
the generic code would now create "transport=fibre-channel", which
doesn't match any transport name anymore once the string is attempted
to be matched in the kernel.
Change the string used by for trtype for FC to use "fc" to restore
operation.
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
fabrics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fabrics.c b/fabrics.c
index 594789b..f5cd212 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -98,7 +98,7 @@ static const char *arg_str(const char * const *strings,
static const char * const trtypes[] = {
[NVMF_TRTYPE_RDMA] = "rdma",
- [NVMF_TRTYPE_FC] = "fibre-channel",
+ [NVMF_TRTYPE_FC] = "fc",
[NVMF_TRTYPE_TCP] = "tcp",
[NVMF_TRTYPE_LOOP] = "loop",
};
--
2.13.7

View File

@ -0,0 +1,27 @@
From 87fbe1ea65dd27f18fa257f66c4d30d45e64eed2 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Mon, 11 Feb 2019 14:12:23 +0100
Subject: [PATCH] 71-nvme-iopolicy-netapp.rules: add default rules for NetApp
Ontap
NetApp ONTAP controllers provide several paths to the same subsystem,
so we should be switching to 'round-robin' iopolicy to provide the
best performance.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
scripts/71-nvme-iopolicy-netapp.rules | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 scripts/71-nvme-iopolicy-netapp.rules
diff --git a/scripts/71-nvme-iopolicy-netapp.rules b/scripts/71-nvme-iopolicy-netapp.rules
new file mode 100644
index 0000000..0d693a7
--- /dev/null
+++ b/scripts/71-nvme-iopolicy-netapp.rules
@@ -0,0 +1,2 @@
+# Enable round-robin for NetApp ONTAP
+ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{model}=="NetApp ONTAP Controller", ATTR{iopolicy}="round-robin"
--
2.13.7

View File

@ -0,0 +1,57 @@
From 85ccf6e7e6ff70d6f13b0bd702b5f8210b358333 Mon Sep 17 00:00:00 2001
From: Simon Schricker <sschricker@suse.de>
Date: Fri, 8 Mar 2019 10:54:29 +0100
Subject: [PATCH] Add: nvmefc-connect.target to bundle all nvmefc-connect@
services
This allows to stop all parameterized services by stopping the target.
This can then be used in RPM macros to avoid errors like the ones
reported in bsc#1127076.
For a more detailed explanation, visit:
https://nordisch.org/posts/hooking-up-instantiated-services-with-rpm/
nvmefc-connect@.service requires the nvmefc-connect.target so that the
target automatically gets started when a (parameterized) service gets
started. This is necessary to stop the (then obsolete) services on a
package upgrade, because the rpm macros only stop _active_ systemd
units.
Also remove the [Install] section of the nvmefc-connect@.service
because the service shouldn't be enabled.
Signed-off-by: Simon Schricker <sschricker@suse.de>
---
nvme-fc-autoconnect/nvmefc-connect.target | 2 ++
nvme-fc-autoconnect/nvmefc-connect@.service | 5 ++---
2 files changed, 4 insertions(+), 3 deletions(-)
create mode 100644 nvme-fc-autoconnect/nvmefc-connect.target
diff --git a/nvme-fc-autoconnect/nvmefc-connect.target b/nvme-fc-autoconnect/nvmefc-connect.target
new file mode 100644
index 0000000..953c0b7
--- /dev/null
+++ b/nvme-fc-autoconnect/nvmefc-connect.target
@@ -0,0 +1,2 @@
+[Unit]
+Description=All instances of nvme-fc-autoconnect daemon
diff --git a/nvme-fc-autoconnect/nvmefc-connect@.service b/nvme-fc-autoconnect/nvmefc-connect@.service
index c2370d6..8465ec6 100644
--- a/nvme-fc-autoconnect/nvmefc-connect@.service
+++ b/nvme-fc-autoconnect/nvmefc-connect@.service
@@ -5,10 +5,9 @@
[Unit]
Description=Auto-connect to subsystems on FC-NVME devices
After=syslog.target
+PartOf=nvmefc-connect.target
+Requires=nvmefc-connect.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c "/usr/sbin/nvme connect-all --transport=fc `/usr/bin/echo -e '%i'`"
-
-[Install]
-WantedBy=default.target
--
2.16.4

View File

@ -0,0 +1,33 @@
From ce6844d2df9420ff80ced37a23d88ce48d1f31d7 Mon Sep 17 00:00:00 2001
From: Simon Schricker <sschricker@suse.de>
Date: Thu, 14 Mar 2019 14:07:51 +0100
Subject: [PATCH] Change nvmefc-connect@.service to type `simple`
The idea is that udevd calls systemd for the nvme connect-all calls so
that it doesn't have to wait for it to return. But systemd waits for
services of type `oneshot` when called with systemctl start until the
process specified in the service file terminates.
Instead use type `simple`: systemd will return immediately after
starting the service, regardless of how long the nvme connect-all call
takes.
Signed-off-by: Simon Schricker <sschricker@suse.de>
---
nvme-fc-autoconnect/nvmefc-connect@.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nvme-fc-autoconnect/nvmefc-connect@.service b/nvme-fc-autoconnect/nvmefc-connect@.service
index 8465ec6..a8ff271 100644
--- a/nvme-fc-autoconnect/nvmefc-connect@.service
+++ b/nvme-fc-autoconnect/nvmefc-connect@.service
@@ -9,5 +9,5 @@ PartOf=nvmefc-connect.target
Requires=nvmefc-connect.target
[Service]
-Type=oneshot
+Type=simple
ExecStart=/bin/sh -c "/usr/sbin/nvme connect-all --transport=fc `/usr/bin/echo -e '%i'`"
--
2.16.4

2
nvme-cli-rpmlintrc Normal file
View File

@ -0,0 +1,2 @@
addFilter("W: systemd-service-without-service_del_preun")
addFilter("W: systemd-service-without-service_del_postun")

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
Wed Mar 13 13:43:17 UTC 2019 - Simon Schricker <sschricker@suse.com>
- Add nvmefc-connect.target to allow stopping the parameterized
services (bsc#1127076). Also change the service type so udevd
doesn't have to wait for the termination of the service process.
+ 0102-Add-nvmefc-connect.target.patch
+ 0103-Change-service-to-type-simple.patch
-------------------------------------------------------------------
Mon Feb 11 12:32:27 CET 2019 - hare@suse.de
- Regenerate documentation (bsc#1124713)
* Add 0007-Regen-docs.patch
- Minor cleanup for submit_io (bsc#1124713)
* Add 0008-nvme-cli-minor-cleanup-for-submit_io.patch
- Regenerate documentation ((bsc#1124713)
* Add 0009-Regen-documentation.patch
- Fix fc_trtype string (bsc#1124713)
* Add 0010-nvme-cli-fix-fc-trtype-string.patch
- Add 71-nvme-iopolicy-netapp.rules (bsc#1124564)
* Add 0101-71-nvme-iopolicy-netapp.rules-add-default-rules-for-.patch
-------------------------------------------------------------------
Tue Jan 29 15:30:35 CET 2019 - tiwai@suse.de

View File

@ -22,20 +22,28 @@ Release: 0
Summary: NVM Express user space tools
License: GPL-2.0-only
Group: Hardware/Other
Url: https://github.com/linux-nvme/nvme-cli
URL: https://github.com/linux-nvme/nvme-cli
Source: %{name}-%{version}.tar.gz
Source2: nvme-cli-rpmlintrc
Patch1: 0001-wdc-Change-device-capability-checking.patch
Patch2: 0002-wdc-Add-additional-device-for-vs-internal-log.patch
Patch3: 0003-generate-new-documentation.patch
Patch4: 0004-Fix-compilation-with-GCC-8.patch
Patch5: 0005-Fix-CFLAGS-parameter.patch
Patch6: 0006-nvme-cli-fix-compilation-with-uint64_t-cast.patch
Patch7: 0007-Regen-docs.patch
Patch8: 0008-nvme-cli-minor-cleanup-for-submit_io.patch
Patch9: 0009-Regen-documentation.patch
Patch10: 0010-nvme-cli-fix-fc-trtype-string.patch
Patch100: 0100-nvme_fc-auto-connect-scripts.patch
Patch101: 0101-71-nvme-iopolicy-netapp.rules-add-default-rules-for-.patch
Patch102: 0102-Add-nvmefc-connect.target.patch
Patch103: 0103-Change-service-to-type-simple.patch
BuildRequires: libuuid-devel
BuildRequires: pkgconfig
BuildRequires: xmlto
BuildRequires: pkgconfig(libudev)
BuildRequires: rubygem(asciidoctor)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
NVM Express (NVMe) is a direct attached storage interface. The
@ -43,14 +51,21 @@ nvme-cli package contains core management tools with minimal
dependencies.
%prep
%setup -q -n %{name}-%{version}
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%build
echo %{version} > version
@ -59,15 +74,17 @@ make CFLAGS="%{optflags} -I." PREFIX=%{_prefix} USE_ASCIIDOCTOR=YesPlease %{?_sm
%install
make PREFIX=%{_prefix} DESTDIR=%{buildroot} install-bin install-man %{?_smp_mflags}
install -m 644 -D /dev/null %{buildroot}%{_sysconfdir}/nvme/hostnqn
install -m 644 -D completions/bash-nvme-completion.sh %{buildroot}%{_sysconfdir}/bash_completion.d/nvme
install -m 644 -D completions/bash-nvme-completion.sh %{buildroot}%{_datadir}/bash_completion/completions/nvme
install -m 644 -D nvme-fc-autoconnect/70-nvmefc-autoconnect.rules %{buildroot}%{_udevrulesdir}/70-nvmefc-autoconnect.rules
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
%define services nvmefc-boot-connections.service
%define services nvmefc-boot-connections.service nvmefc-connect.target
%pre
%service_add_pre %services
%service_add_pre %services nvmefc-connect@.service
%post
if [ ! -e %{_sysconfdir}/nvme/hostnqn ]; then
@ -76,26 +93,32 @@ fi
if [ ! -e %{_sysconfdir}/nvme/hostid ]; then
%{_bindir}/uuidgen > %{_sysconfdir}/nvme/hostid
fi
%service_add_post %services
%service_add_post %services nvmefc-connect@.service
%preun
%service_del_preun %services nvmefc-connect@.service
%service_del_preun -f %services
%postun
%service_del_postun %services nvmefc-connect@.service
%service_del_postun %services
%posttrans
/usr/bin/echo add 2>/dev/null >/sys/class/fc/fc_udev_device/nvme_discovery || true
%files
%defattr(-,root,root)
%doc README.md LICENSE
%license LICENSE
%doc README.md
%{_sbindir}/nvme
%{_mandir}/man1/nvme*.1*
%dir %{_sysconfdir}/bash_completion.d/
%{_sysconfdir}/bash_completion.d/nvme
%{_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
%{_unitdir}/nvmefc-boot-connections.service
%{_unitdir}/nvmefc-connect@.service
%{_unitdir}/nvmefc-connect.target
%dir %{_sysconfdir}/nvme/
%ghost %{_sysconfdir}/nvme/hostnqn
%ghost %{_sysconfdir}/nvme/hostid
%ghost %{_sysconfdir}/nvme/hostid
%changelog