| LNET_LEGACY2YAML(8) | Lustre Configuration Utilities | LNET_LEGACY2YAML(8) |
NAME
lnet_legacy2yaml - convert legacy LNet module parameters to YAML
SYNOPSIS
lnet_legacy2yaml |
[options] [inline-legacy-string] |
lnet_legacy2yaml |
[-i ip2nets_file] [-r routes_file] [-n networks_file] [-m modprobe_file] [-o output_file] [--default-hop [HOP]] [inline-legacy-string] |
DESCRIPTION
The lnet_legacy2yaml utility parses deprecated Lustre LNet module parameter syntaxes (ip2nets=, routes=, and networks=) and emits an equivalent YAML document usable by lnetctl(8) via
- lnetctl import < output.yaml
Kernel parsing of ip2nets was deprecated in Lustre 2.10; user space now resolves interface patterns. This tool facilitates migration from legacy module configuration files (e.g. modprobe.conf / lustre.conf) to the YAML form consumed by modern LNet configuration workflows.
Input may be supplied through any combination of positional inline argument, file options, or standard input. If no positional inline argument is provided and stdin is not a TTY, data is read from stdin. Multiple sources accumulate: ip2nets files first, route files, then inline/stdin content.
OPTIONS
- -i, --ip2nets FILE
- File containing one or more ip2nets rules separated by semicolons (;) or newlines. May be specified multiple times.
- -r, --routes FILE
- File containing one or more routes entries separated by semicolons (;) or newlines. May be specified multiple times.
- -n, --networks FILE
- File containing one or more networks entries separated by commas (,) or newlines. May be specified multiple times.
- -m, --modprobe FILE
- Modprobe configuration file (e.g. /etc/modprobe.d/lnet.conf) to parse for lnet module parameters. The tool extracts ip2nets= , routes= , and networks= values from lines matching
- options lnet ip2nets="..." routes="..." networks="..."
- May be specified multiple times. Line continuations (backslash-newline) are supported.
- -o, --output FILE
- Write YAML to FILE instead of stdout.
- --default-hop [HOP]
- Assign a default hopcount to routes lacking an explicit hop token. If HOP is omitted, 1 is used. Range: 1-255. Explicit hopcounts in input are never overridden.
- -h, --help
- Display usage summary.
EXIT STATUS
- 0
- Success.
- 1
- Usage error or no data provided.
- 2
- Parsing error or file I/O error (message on stderr).
NOTES
Legacy networks Syntax
Comma-separated list of network specifications:
- nettype [id] [(iface-list)]
Examples:
- tcp
tcp0(eth0)
tcp0(eth0),o2ib(ib0)
Legacy ip2nets Syntax
Each rule: net-spec ip-pattern { ip-pattern }
Net spec: nettype id optionally followed by interface list in parentheses, e.g.:
- tcp0(eth0,eth1) 192.168.0.*
IP patterns support wildcards (*) and bracket expressions for sets/ranges, e.g.:
- 132.6.[1-3].[2-8/2]
Rules are separated by semicolons or newlines. The first matching rule for a given network wins.
Legacy routes Syntax
Two route formats are supported:
Legacy format:
- netspec [hopcount] gateway { gateway ... }
Gateway NIDs may end with an optional priority suffix: gateway:PRIORITY (e.g. 10.0.0.1@o2ib0:5). The first numeric token (1-255) after the network spec is treated as hopcount. If omitted and --default-hop is not used, hop is left unspecified in YAML.
Alternative format (lustre_routes_config syntax):
- network : { gateway: gateway@exitnet [ , hop: hopcount] [ , priority: priority ] }
This format explicitly names parameters and allows them in any order. Parameters are separated by commas. The gateway parameter is mandatory; hop and priority are optional.
Examples:
-
tcp1: { gateway: 10.1.1.2@tcp0, priority: 3 } tcp4: { gateway: 10.3.3.4@tcp } tcp6: { gateway: 10.3.3.6@tcp, hop: 2, priority: 5 } tcp7: { gateway: 10.3.3.[6-12]@tcp, priority: 20, hop: 8 }
Both formats may be mixed freely in the same input file or stream. The tool automatically detects which format each line uses.
YAML Output Format
The tool emits up to three top-level sequences:
- net:
ip2nets:
route:
Example:
net:
- net type: tcp0
local NI(s):
- interfaces:
0: eth0 ip2nets:
- net-spec: tcp0
interfaces:
0: eth0
ip-range:
0: 192.168.0.[2,4]
- net-spec: o2ib0
ip-range:
0: 192.168.0.* route:
- net: tcp0
gateway: 10.0.0.[1-2]@o2ib0
hop: 2
priority: 5
- net: tcp0
gateway: 10.0.0.[3-4]@o2ib0
hop: 2
priority: 10
Any IP pattern beginning with an asterisk (e.g. *.*.*.*) is automatically wrapped in double quotes to avoid YAML alias semantics.
Behavior Notes
- Rule / entry separators: semicolon (;) or newline.
- Comments initiated by '#' are stripped (not valid inside bracket expressions).
- IP patterns are preserved verbatim (no expansion of bracket/range expressions).
- Interfaces are listed in the order provided.
- Multiple ip2nets/routes/networks files are concatenated in given order.
- Gateway priority parsed only when final colon + digits suffix present (naive IPv6 avoidance). This limitation does not apply to the alternative route format where priority is explicitly named.
- Both legacy and alternative route formats may be freely mixed in the same file. Each line is automatically detected and parsed according to its format.
- Modprobe files are processed first, followed by explicit ip2nets files, routes files, networks files, then inline/stdin content.
- Line continuations in modprobe files (backslash-newline) are handled automatically.
CAVEATS
- Does not expand bracket/range expressions to concrete addresses.
- Simple validation only; malformed nested bracket constructs may not produce intuitive errors.
- Priority parsing does not support IPv6 literal addresses with trailing numeric segments separated by colons.
EXAMPLES
Convert networks parameter:
-
$ lnet_legacy2yaml 'options lnet networks="tcp0(eth0),o2ib(ib0)"' net:
- net type: tcp0
local NI(s):
- interfaces:
0: eth0
- net type: o2ib
local NI(s):
- interfaces:
0: ib0
Convert simple ip2nets string:
-
$ lnet_legacy2yaml \ 'tcp0(eth0,eth1) 10.0.0.*; o2ib0 192.168.[1-2].*'
Extract both parameters from an options line:
-
$ lnet_legacy2yaml \ 'options lnet ip2nets="tcp0 10.0.0.*" \ routes="tcp0 1 10.0.0.1@o2ib0"'
Parse modprobe configuration file:
-
$ lnet_legacy2yaml -m /etc/modprobe.d/lnet.conf \ -o lnet.yaml
Convert routes using alternative format:
-
$ cat routes.conf tcp1: { gateway: 10.1.1.2@tcp0, priority: 3 } tcp4: { gateway: 10.3.3.4@tcp } tcp6: { gateway: 10.3.3.6@tcp, hop: 2, priority: 5 } tcp7: { gateway: 10.3.3.[6-12]@tcp, priority: 20, hop: 8 } $ lnet_legacy2yaml -r routes.conf route:
- net: tcp1
gateway: 10.1.1.2@tcp0
priority: 3
- net: tcp4
gateway: 10.3.3.4@tcp
- net: tcp6
gateway: 10.3.3.6@tcp
hop: 2
priority: 5
- net: tcp7
gateway: 10.3.3.[6-12]@tcp
hop: 8
priority: 20
Files plus default hop:
-
$ lnet_legacy2yaml -i ip.rules -r routes.rules \ --default-hop 2 -o lnet.yaml
Import into LNet:
-
$ lnetctl import < lnet.yaml
AUTHORS
Generated with assistance from automated tooling; further maintained by Lustre contributors.
AVAILABILITY
lnet_legacy2yaml is part of the lustre(7) filesystem package since release 2.17.0
SEE ALSO
| 2025-10-20 | Lustre |