1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

scripts: lvm2-activation-generator fix lvmconfig call

Fix a scenario where global/event_activation setting is not found. In
this case we need to take default value just like lvm tools do when
executed. So use "lvmconfig --type full".

Also, if we fail to execute lvmconfig for whatever reason, fallback to
generating the activation units as failsafe action.

Reported by: Bastian Blank <waldi debian org>
This commit is contained in:
Peter Rajnoha 2019-01-04 11:11:13 +01:00 committed by Zdenek Kabelac
parent bc40391b7d
commit 6298eaeca5
3 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,6 @@
Version 2.03.02 - Version 2.03.02 -
=================================== ===================================
Fix generator quering lvmconfig unpresent config option.
Fix memleak on bcache error path code. Fix memleak on bcache error path code.
Fix missing unlock on lvm2 dmeventd plugin error path initialization. Fix missing unlock on lvm2 dmeventd plugin error path initialization.
Improve Makefile dependency tracking. Improve Makefile dependency tracking.

View File

@ -186,7 +186,8 @@ static bool _parse_line(const char *line, struct config *cfg)
static bool _get_config(struct config *cfg, const char *lvmconfig_path) static bool _get_config(struct config *cfg, const char *lvmconfig_path)
{ {
static const char *_argv[] = { static const char *_argv[] = {
"lvmconfig", LVM_CONF_EVENT_ACTIVATION, LVM_CONF_USE_LVMPOLLD, NULL "lvmconfig", "--type", "full",
LVM_CONF_EVENT_ACTIVATION, LVM_CONF_USE_LVMPOLLD, NULL
}; };
bool r = true; bool r = true;

View File

@ -194,12 +194,17 @@ static bool _run(int argc, const char **argv)
if (!_parse_command_line(&gen, argc, argv)) if (!_parse_command_line(&gen, argc, argv))
return false; return false;
if (!_get_config(&gen.cfg, LVMCONFIG_PATH)) if (_get_config(&gen.cfg, LVMCONFIG_PATH)) {
return false; if (gen.cfg.event_activation)
// If event_activation=1, pvscan --cache -aay does activation.
return true;
}
if (gen.cfg.event_activation) /*
// If event_activation=1, pvscan --cache -aay does activation. * Create the activation units if:
return true; * - _get_config succeeded and event_activation=0
* - _get_config failed, then this is a failsafe fallback
*/
/* mark lvm2-activation.*.service as world-accessible */ /* mark lvm2-activation.*.service as world-accessible */
old_mask = umask(0022); old_mask = umask(0022);