master - toolcontext: read all configuration sources when checking config values in lvm2-activation-generator through lighweight toolcontext handler
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b5e093624dc9bc9644903442e59bf049aeaaa3ba Commit: b5e093624dc9bc9644903442e59bf049aeaaa3ba Parent: dbcfd59714bddb3162d97575e66e000d2d83acb6 Author: Peter Rajnoha <[email protected]> AuthorDate: Fri Sep 23 14:51:15 2016 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Fri Sep 23 14:57:44 2016 +0200
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(+), 0 deletions(-)
WHATS_NEW +1 -0
@@ -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
lib/commands/toolcontext.c +17 -0
@@ -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)