1 (* Process /etc/multipath.conf *)
2 (* The lens is based on the multipath.conf(5) man page *)
7 let comment = Util.comment
9 let dels = Util.del_str
12 let ws = del /[ \t]+/ " "
13 let indent = del /[ \t]*/ ""
14 (* We require that braces are always followed by a newline *)
15 let obr = del /\{([ \t]*)\n/ "{\n"
16 let cbr = del /[ \t]*}[ \t]*\n/ "}\n"
18 let ikey (k:regexp) = indent . key k
20 let section (n:regexp) (b:lens) =
21 [ ikey n . ws . obr . (b|empty|comment)* . cbr ]
23 let kv (k:regexp) (v:regexp) =
24 [ ikey k . ws . store v . eol ]
26 (* FIXME: it would be much more concise to write *)
27 (* [ key k . ws . (bare | quoted) ] *)
28 (* but the typechecker trips over that *)
30 let delq = del /['"]/ "\"" in
31 let bare = del /["']?/ "" . store /[^"' \t\n]+/ . del /["']?/ "" in
32 let quoted = delq . store /.*[ \t].*/ . delq in
33 [ ikey k . ws . bare . eol ]
34 |[ ikey k . ws . quoted . eol ]
36 let wwid = kv "wwid" (Rx.word|"*")
38 (* Settings that can be changed in various places *)
41 |kv "path_grouping_policy" /failover|multibus|group_by_(serial|prio|node_name)/
42 |kv "path_checker" /tur|emc_clariion|hp_sw|rdac|directio|rdb|readsector0/
43 |kv "prio" /const|emc|alua|ontap|rdac|hp_sw|hds|random|weightedpath/
45 |kv "failback" (Rx.integer | /immediate|manual|followover/)
46 |kv "rr_weight" /priorities|uniform/
47 |kv "flush_on_last_del" /yes|no/
48 |kv "user_friendly_names" /yes|no/
49 |kv "no_path_retry" (Rx.integer | /fail|queue/)
50 |kv /rr_min_io(_q)?/ Rx.integer
52 |kv "reservation_key" Rx.word
53 |kv "deferred_remove" /yes|no/
54 |kv "delay_watch_checks" (Rx.integer | "no")
55 |kv "delay_wait_checks" (Rx.integer | "no")
56 |kv "skip_kpartx" /yes|no/
57 (* Deprecated settings for backwards compatibility *)
58 |qstr /(getuid|prio)_callout/
59 (* Settings not documented in `man multipath.conf` *)
60 |kv /rr_min_io_rq/ Rx.integer
61 |kv "udev_dir" Rx.fspath
63 |kv "async_timeout" Rx.integer
64 |kv "pg_timeout" Rx.word
65 |kv "h_on_last_deleassign_maps" /yes|no/
67 |kv "hwtable_regex_match" /yes|no|on|off/
68 |kv "reload_readwrite" /yes|no/
72 |kv "polling_interval" Rx.integer
73 |kv "max_polling_interval" Rx.integer
74 |kv "multipath_dir" Rx.fspath
75 |kv "find_multipaths" /yes|no/
76 |kv "verbosity" /[0-6]/
77 |kv "reassign_maps" /yes|no/
78 |kv "uid_attrribute" Rx.word
79 |kv "max_fds" (Rx.integer|"max")
80 |kv "checker_timeout" Rx.integer
81 |kv "fast_io_fail_tmo" (Rx.integer|"off")
82 |kv "dev_loss_tmo" (Rx.integer|"infinity")
83 |kv "queue_without_daemon" /yes|no/
84 |kv "bindings_file" Rx.fspath
85 |kv "wwids_file" Rx.fspath
86 |kv "log_checker_err" /once|always/
87 |kv "retain_attached_hw_handler" /yes|no/
88 |kv "detect_prio" /yes|no/
89 |kv "hw_str_match" /yes|no/
90 |kv "force_sync" /yes|no/
91 |kv "config_dir" Rx.fspath
92 |kv "missing_uev_wait_timeout" Rx.integer
93 |kv "ignore_new_boot_devs" /yes|no/
94 |kv "retrigger_tries" Rx.integer
95 |kv "retrigger_delay" Rx.integer
96 |kv "new_bindings_in_boot" /yes|no/
98 (* A device subsection *)
101 qstr /vendor|product|product_blacklist|hardware_handler|alias_prefix/
103 section "device" setting
105 (* The defaults section *)
107 section "defaults" default_setting
109 (* The blacklist and blacklist_exceptions sections *)
115 section /blacklist(_exceptions)?/ setting
117 (* A multipath subsection *)
123 section "multipath" setting
125 (* The multipaths section *)
127 section "multipaths" multipath
129 (* The devices section *)
131 section "devices" device
133 let lns = (comment|empty|defaults|blacklist|devices|multipaths)*
135 let xfm = transform lns (incl "/etc/multipath.conf" .
136 incl "/etc/multipath/conf.d/*.conf")