From b5e093624dc9bc9644903442e59bf049aeaaa3ba Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Fri, 23 Sep 2016 14:51:15 +0200 Subject: [PATCH] toolcontext: read all configuration sources when checking config values in lvm2-activation-generator through lighweight toolcontext handler We added lightweight toolcontext handle to avoid useless initialization of some parts of the context and also to avoid problems when using the handle very soon at system boot, like in lvm2-activation-generator through lvm2app interface. However, we missed reading all the other config sources like lvmlocal.conf as well as any tag config - we need to read these too to get the final config value which may be overriden in any of these additional config sources. Currently, we use this lightweight toolcontext handle to read global/use_lvmetad and global/use_lvmpolld config values in lvm2-activation-generator using lvm2app interface (lvm_config_find_bool lvm2app function). --- WHATS_NEW | 1 + lib/commands/toolcontext.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 6a178e6a1..d3953ff66 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.166 - ===================================== + Fix lvm2-activation-generator to read all LVM2 config sources. (2.02.155) Fix lvchange-rebuild-raid.sh to cope with older target versions. Use dm_config_parse_without_dup_node_check() to speedup metadata reading. Fix lvconvert --repair regression diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index eaabf984f..c416575aa 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -1787,10 +1787,27 @@ struct cmd_context *create_config_context(void) goto_out; dm_list_init(&cmd->config_files); + dm_list_init(&cmd->tags); if (!_init_lvm_conf(cmd)) goto_out; + if (!_init_hostname(cmd)) + goto_out; + + if (!_init_tags(cmd, cmd->cft)) + goto_out; + + /* Load lvmlocal.conf */ + if (*cmd->system_dir && !_load_config_file(cmd, "", 1)) + goto_out; + + if (!_init_tag_configs(cmd)) + goto_out; + + if (!(cmd->cft = _merge_config_files(cmd, cmd->cft))) + goto_out; + return cmd; out: if (cmd)