]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: autoconnect: add service unit for connecting NBFT subsystems
authorMartin Wilck <mwilck@suse.com>
Tue, 23 May 2023 10:48:55 +0000 (12:48 +0200)
committerDaniel Wagner <wagi@monom.org>
Wed, 8 Nov 2023 12:53:35 +0000 (13:53 +0100)
Create a separate unit file for connecting to NBFT-defined subsystems.
This unit is intended to be called in "post-up" scripts from network
management software if an interface defined in the HFI section of the
NBFT is brought up (L3-configured).

In simple scenarios with just one HFI, this won't be necessary because the
interface must be brought up in the initramfs already. But in multipath
scenarios, the initramfs may choose not to wait for every HFI to come up, and
thus it may be necessary to bring up the secondary connection(s) later on.

Signed-off-by: Martin Wilck <mwilck@suse.com>
[dwagner: use unit options instead of ExecStartPre
          update nvme command line]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
meson.build
nvmf-autoconnect/systemd/nvmf-connect-nbft.service.in [new file with mode: 0644]

index a02be7c2904ecfa61ff50b8044dd2516e658060d..d837aa9cf0e58c980b088107f50b5c87aada452a 100644 (file)
@@ -222,6 +222,7 @@ endforeach
 systemd_files = [
   'nvmefc-boot-connections.service',
   'nvmf-autoconnect.service',
+  'nvmf-connect-nbft.service',
   'nvmf-connect.target',
   'nvmf-connect@.service',
 ]
diff --git a/nvmf-autoconnect/systemd/nvmf-connect-nbft.service.in b/nvmf-autoconnect/systemd/nvmf-connect-nbft.service.in
new file mode 100644 (file)
index 0000000..820e6ce
--- /dev/null
@@ -0,0 +1,14 @@
+# This unit is meant to be started by network management software
+# after a network interface defined in the NBFT gets set up
+[Unit]
+Description=Connect NBFT-defined NVMe-oF subsystems automatically
+ConditionPathExists=|/sys/firmware/acpi/tables/NBFT
+ConditionPathExists=|/sys/firmware/acpi/tables/NBFT1
+Wants=modprobe@nvme_fabrics.service
+After=modprobe@nvme_fabrics.service
+After=network-online.target
+Before=remote-fs-pre.target
+
+[Service]
+Type=oneshot
+ExecStart=@SBINDIR@/nvme connect-all --nbft