[PATCH v2 15/16] nvmf-autoconnect: add unit file for nvme-monitor.service

mwilck at suse.com mwilck at suse.com
Sat Mar 6 00:36:58 GMT 2021


From: Martin Wilck <mwilck at suse.com>

Running both this service and the udev-based nvmf autoconnect service
is discouraged. A "Conflicts" directive against nvmf-connect at .service
wouldn't work, because it would cause the monitor to be stopped as soon
as an event arrives. Therefore, mask the udev rules that would start
the parallel discovery.
---
 nvmf-autoconnect/systemd/nvme-monitor.service | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 nvmf-autoconnect/systemd/nvme-monitor.service

diff --git a/nvmf-autoconnect/systemd/nvme-monitor.service b/nvmf-autoconnect/systemd/nvme-monitor.service
new file mode 100644
index 0000000..5666761
--- /dev/null
+++ b/nvmf-autoconnect/systemd/nvme-monitor.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=NVMe Event Monitor for Automatical Subsystem Connection
+Documentation=man:nvme-monitor(1)
+DefaultDependencies=false
+RequiresMountsFor=/sys /run /dev
+Conflicts=shutdown.target
+After=systemd-udevd-kernel.socket
+Before=sysinit.target systemd-udev-trigger.service nvmefc-boot-connections.service
+
+[Service]
+Type=simple
+ExecStartPre=-/usr/bin/ln -sf /dev/null /run/udev/rules.d/70-nvmf-autoconnect.rules
+ExecStart=/usr/sbin/nvme monitor
+ExecStartPost=-/usr/bin/rm -f /run/udev/rules.d/70-nvmf-autoconnect.rules
+KillMode=mixed
+
+[Install]
+WantedBy=sysinit.target
-- 
2.29.2




More information about the Linux-nvme mailing list