Skip to content

Commit 831b242

Browse files
committed
nvmf-autoconnect: add NetworkManager dispatcher script
If an interface is brought up that is configured in the NVMeoF Boot Firmware Table (NBFT), we need to establish possibly missing NVMe connections from the NBFT. This can happen if an interface couldn't be brought up during initramfs processing, but is activated later on. Add a NM-dispatcher script that takes care of the connection attempt. Signed-off-by: Martin Wilck <mwilck@suse.com>
1 parent 7e89b0d commit 831b242

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

meson.build

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
103103
udevrulesdir = join_paths(prefixdir, get_option('udevrulesdir'))
104104
dracutrulesdir = join_paths(prefixdir, get_option('dracutrulesdir'))
105105
systemddir = join_paths(prefixdir, get_option('systemddir'))
106+
nmdispatchdir = join_paths(prefixdir, get_option('nmdispatchdir'))
106107
rundir = join_paths(prefixdir, get_option('rundir'))
107108

108109
std_prefix = prefixdir == '/usr' or prefixdir == '/usr/local'
@@ -571,6 +572,21 @@ if want_nvme
571572
)
572573
endforeach
573574

575+
nm_dispatcher_files = [
576+
'80-nvmf-connect-nbft.sh'
577+
]
578+
579+
foreach file : nm_dispatcher_files
580+
configure_file(
581+
input: 'nvmf-autoconnect/nm-dispatcher/' + file + '.in',
582+
output: file,
583+
configuration: substs,
584+
install: true,
585+
install_mode: 'rwxr-xr-x',
586+
install_dir: nmdispatchdir
587+
)
588+
endforeach
589+
574590
install_data(
575591
'completions/bash-nvme-completion.sh',
576592
rename: 'nvme',
@@ -596,6 +612,7 @@ path_dict = {
596612
'dracutrulesdir': dracutrulesdir,
597613
'rundir': rundir,
598614
'systemddir': systemddir,
615+
'nmdispatchdir': nmdispatchdir,
599616
'build location': meson.current_build_dir(),
600617
}
601618
summary(path_dict, section: 'Paths')

meson_options.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ option(
9595
value : 'lib/udev/rules.d',
9696
description : 'directory for udev rules files'
9797
)
98+
option(
99+
'nmdispatchdir',
100+
type : 'string',
101+
value : 'lib/NetworkManager/dispatcher.d',
102+
description : 'directory for NetworkManager dispatcher scripts'
103+
)
98104
option(
99105
'version-tag',
100106
type : 'string',
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#! /bin/sh
2+
3+
# If an interface is brought up that is configured in the NVMeoF
4+
# Boot Firmware Table (NBFT), try to establish possibly missing
5+
# NVMe connections from the NBFT.
6+
# This can happen if an interface couldn't be brought up during
7+
# initramfs processing, but is activated later on.
8+
9+
start_nvmf=
10+
11+
if [ "$2" = up ]; then
12+
case $1 in
13+
nbft*)
14+
start_nvmf=yes
15+
;;
16+
esac
17+
case $CONNECTION_ID in
18+
"NBFT connection HFI"*)
19+
start_nvmf=yes
20+
;;
21+
esac
22+
fi
23+
24+
if [ "$start_nvmf" ]; then
25+
@SYSTEMCTL@ --no-block start nvmf-connect-nbft.service || true
26+
fi

0 commit comments

Comments
 (0)