diff options
author | oshchirs <oleksandr.shchirskyi@intel.com> | 2021-07-30 11:16:00 +0200 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2021-08-02 16:24:20 +0200 |
commit | 0663137c77bc848b2927075c077b545fceeb4dae (patch) | |
tree | 096e70e328bc0d2e5b7309a19b80d9c3275e7dac /config.c | |
parent | tests: Avoid passing chunk size when creating RAID 1 (diff) | |
download | mdadm-0663137c77bc848b2927075c077b545fceeb4dae.tar.xz mdadm-0663137c77bc848b2927075c077b545fceeb4dae.zip |
Add monitor delay parameter to mdadm.conf
Add possibility to configure delay for mdadm in monitoring mode
using mdadm.conf.
--delay command line argument takes precedence over config file.
Signed-off-by: Oleksandr Shchirskyi <oleksandr.shchirskyi@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -81,7 +81,7 @@ char DefaultAltConfDir[] = CONFFILE2 ".d"; enum linetype { Devices, Array, Mailaddr, Mailfrom, Program, CreateDev, Homehost, HomeCluster, AutoMode, Policy, PartPolicy, Sysfs, - LTEnd }; + MonitorDelay, LTEnd }; char *keywords[] = { [Devices] = "devices", [Array] = "array", @@ -95,6 +95,7 @@ char *keywords[] = { [Policy] = "policy", [PartPolicy]="part-policy", [Sysfs] = "sysfs", + [MonitorDelay] = "monitordelay", [LTEnd] = NULL }; @@ -588,6 +589,17 @@ void homeclusterline(char *line) } } +static int monitor_delay; +void monitordelayline(char *line) +{ + char *w; + + for (w = dl_next(line); w != line; w = dl_next(w)) { + if (monitor_delay == 0) + monitor_delay = strtol(w, NULL, 10); + } +} + char auto_yes[] = "yes"; char auto_no[] = "no"; char auto_homehost[] = "homehost"; @@ -769,6 +781,9 @@ void conf_file(FILE *f) case Sysfs: sysfsline(line); break; + case MonitorDelay: + monitordelayline(line); + break; default: pr_err("Unknown keyword %s\n", line); } @@ -925,6 +940,12 @@ char *conf_get_homecluster(void) return home_cluster; } +int conf_get_monitor_delay(void) +{ + load_conffile(); + return monitor_delay; +} + struct createinfo *conf_get_create_info(void) { load_conffile(); |