summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2022-02-03 10:08:35 -0600
committerDavid Teigland <teigland@redhat.com>2022-02-03 10:22:35 -0600
commit0ed54d5b361c3438bef89420c2eedd879ba88713 (patch)
treef98229e2803dcc3c2542204f3473898f92134c84
parentf0cd54a873880286e0932c5cb38a9572677bee25 (diff)
downloadlvm2-dev-dct-event-activation-2.tar.gz
enable event autoactivation even when event_activation=0dev-dct-event-activation-2
Setting event_activation=0 no longer enables static autoactivation (which was removed in commit ee8fb0310c53ed003a43b324c99cdfd891dd1a7c "remove static autoactivation"). That change could cause systems with lvm.conf event_activation=0 to fail to boot. To avoid that, the behavior of event_activation=0 is changed here to be identical to event_activation=1, i.e. event based autoactivation is kept enabled for event_eventation=0. The updated systems will be forced into event autoactivation. To disable event autoactivation (like event_activation=0 previously did), set event_activation=2 (a new value.)
-rw-r--r--lib/commands/toolcontext.c5
-rw-r--r--lib/commands/toolcontext.h2
-rw-r--r--lib/config/config_settings.h16
-rw-r--r--man/lvmautoactivation.7_main6
-rw-r--r--test/shell/pvscan-autoactivate.sh2
-rw-r--r--tools/args.h2
-rw-r--r--tools/pvscan.c24
-rw-r--r--tools/toollib.c2
-rw-r--r--tools/vgchange.c4
-rw-r--r--udev/69-dm-lvm.rules.in2
10 files changed, 36 insertions, 29 deletions
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 301596482..dae177cb0 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -767,7 +767,10 @@ static int _process_config(struct cmd_context *cmd)
init_pv_min_size((uint64_t)pv_min_kb * (1024 >> SECTOR_SHIFT));
cmd->check_pv_dev_sizes = find_config_tree_bool(cmd, metadata_check_pv_device_sizes_CFG, NULL);
- cmd->event_activation = find_config_tree_bool(cmd, global_event_activation_CFG, NULL);
+ cmd->event_activation = find_config_tree_int(cmd, global_event_activation_CFG, NULL);
+
+ if (!cmd->event_activation)
+ log_warn("WARNING: event_activation=0 has been removed, please update lvm.conf (using 1.)");
if (!process_profilable_config(cmd))
return_0;
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index f16322d4e..483b6f3dd 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -200,11 +200,11 @@ struct cmd_context {
unsigned print_device_id_not_found:1; /* print devices file entries not found */
unsigned ignore_device_name_mismatch:1; /* skip updating devices file names */
unsigned backup_disabled:1; /* skip repeated debug message */
- unsigned event_activation:1; /* whether event_activation is set */
unsigned udevoutput:1;
unsigned online_vg_file_removed:1;
unsigned disable_dm_devs:1; /* temporarily disable use of dm devs cache */
+ int event_activation; /* 1 enabled, 0 enabled (to handle compat), 2 disabled */
/*
* Devices and filtering.
*/
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index bda6207d7..4f15d684f 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1118,12 +1118,16 @@ cfg(global_lvdisplay_shows_full_device_path_CFG, "lvdisplay_shows_full_device_pa
"Previously this was always shown as /dev/vgname/lvname even when that\n"
"was never a valid path in the /dev filesystem.\n")
-cfg(global_event_activation_CFG, "event_activation", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 3, 1), 0, 0, NULL,
- "Disable event based autoactivation commands.\n"
- "WARNING: setting this to zero may cause machine startup to fail.\n"
- "Previously, setting this to zero would enable static autoactivation\n"
- "services (via the lvm2-activation-generator), but the autoactivation\n"
- "services and generator have been removed.\n")
+cfg(global_event_activation_CFG, "event_activation", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, 1, vsn(2, 3, 1), 0, 0, NULL,
+ "Disable event based autoactivation commands by setting to 2.\n"
+ "Disabling this (setting to 2) may cause machine startup to fail.\n"
+ "Previously, setting this to 0 would disable event based autoactivation\n"
+ "and enable static autoactivation services (via lvm2-activation-generator).\n"
+ "Now that static autoactivation services have been removed, setting this\n"
+ "to 0 will keep event based autoactivation enabled (so 0 and 1 are the\n"
+ "same.) Setting this to 2 disables both event and static autoactivation\n"
+ "commands (the lvm udev rule will continue to run those commands, but they\n"
+ "will exit when they detect this setting.\n")
cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 0, vsn(2, 2, 93), 0, vsn(2, 3, 0), NULL,
NULL)
diff --git a/man/lvmautoactivation.7_main b/man/lvmautoactivation.7_main
index 808ea0d9f..bdea949b6 100644
--- a/man/lvmautoactivation.7_main
+++ b/man/lvmautoactivation.7_main
@@ -178,9 +178,9 @@ concurrent commands attempt to activate a VG at once.
.SS static autoactivation
.P
A static autoactivation method is no longer provided by lvm.
-Setting event_activation=0 still disables event based autoactivation.
-WARNING: disabling event activation without an alternative may prevent a
-system from booting. A custom systemd service could be written to run
+Setting event_activation=0 now leaves event based autoactivation
+enabled, and disabling event based autoactivation requires setting
+event_activation=2. A custom systemd service could be written to run
autoactivation during system startup, in which case disabling event
autoactivation may be useful.
.
diff --git a/test/shell/pvscan-autoactivate.sh b/test/shell/pvscan-autoactivate.sh
index 297ceb96d..febb35842 100644
--- a/test/shell/pvscan-autoactivate.sh
+++ b/test/shell/pvscan-autoactivate.sh
@@ -32,7 +32,7 @@ _clear_online_files() {
aux prepare_devs 8 16
# Check 'pvscan' is ignored when event_activation is 0
-pvscan --cache -aay -v --config 'global/event_activation=0' 2>&1 | tee out
+pvscan --cache -aay -v --config 'global/event_activation=2' 2>&1 | tee out
grep "Ignoring pvscan" out
vgcreate $vg1 "$dev1" "$dev2"
diff --git a/tools/args.h b/tools/args.h
index 3f4580b8d..23358e897 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -355,7 +355,7 @@ arg(checkcomplete_ARG, '\0', "checkcomplete", 0, 0, 0,
"and print \"complete\" or \"incomplete\" for each listed\n"
"VG or LV. This option is used as a part of event-based\n"
"autoactivation, so pvscan will do nothing if this option\n"
- "is set and event_activation=0 in the config settings.\n")
+ "is set and event_activation=2 (disabled) in the config settings.\n")
arg(lockopt_ARG, '\0', "lockopt", string_VAL, 0, 0,
"Used to pass options for special cases to lvmlockd.\n"
diff --git a/tools/pvscan.c b/tools/pvscan.c
index dcf183a46..d05b8fb7a 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1652,8 +1652,8 @@ static int _get_autoactivation(struct cmd_context *cmd, int event_activation, in
return 1;
}
- if (!event_activation) {
- log_print_pvscan(cmd, "Skip pvscan for event with event_activation=0.");
+ if (event_activation == 2) {
+ log_print_pvscan(cmd, "Skip pvscan for event with event_activation=2.");
*skip_command = 1;
return 1;
}
@@ -1680,32 +1680,32 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
cmd->ignore_device_name_mismatch = 1;
- event_activation = find_config_tree_bool(cmd, global_event_activation_CFG, NULL);
+ event_activation = find_config_tree_int(cmd, global_event_activation_CFG, NULL);
- if (do_activate && !event_activation) {
- log_verbose("Ignoring pvscan --cache -aay because event_activation is disabled.");
+ if (do_activate && (event_activation == 2)) {
+ log_verbose("Ignoring pvscan --cache -aay because event_activation is disabled (2).");
return ECMD_PROCESSED;
}
/*
* lvm udev rules call:
* pvscan --cache --listvg|--listlvs --checkcomplete PV
- * when PVs appear, even if event_activation=0 in lvm.conf.
+ * when PVs appear, even if event_activation=2 in lvm.conf.
*
* The udev rules will do autoactivation if they see complete
* VGs/LVs reported from the pvscan.
*
- * When event_activation=0 we do not want to do autoactivation
+ * When event_activation=2 we do not want to do autoactivation
* from udev events, so we need the pvscan to not report any
- * complete VGs/LVs when event_activation=0 so that the udev
+ * complete VGs/LVs when event_activation=2 so that the udev
* rules do not attempt to autoactivate.
*/
- if (arg_is_set(cmd, checkcomplete_ARG) && !event_activation) {
+ if (arg_is_set(cmd, checkcomplete_ARG) && (event_activation == 2)) {
if (arg_is_set(cmd, udevoutput_ARG))
printf("LVM_EVENT_ACTIVATION=0\n");
else
- log_print_pvscan(cmd, "Ignoring pvscan with --checkcomplete because event_activation is disabled.");
+ log_print_pvscan(cmd, "Ignoring pvscan with --checkcomplete because event_activation is disabled (2).");
return ECMD_PROCESSED;
}
@@ -1734,9 +1734,9 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
if (!_pvscan_cache_all(cmd, argc, argv, &complete_vgnames))
return ECMD_FAILED;
} else {
- if (!arg_is_set(cmd, checkcomplete_ARG) && !event_activation) {
+ if (!arg_is_set(cmd, checkcomplete_ARG) && (event_activation == 2)) {
/* Avoid doing anything for device removal: pvscan --cache <devno> */
- log_verbose("Ignoring pvscan --cache because event_activation is disabled.");
+ log_verbose("Ignoring pvscan --cache because event_activation is disabled (2).");
return ECMD_PROCESSED;
}
diff --git a/tools/toollib.c b/tools/toollib.c
index b08c044fa..554359c26 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -829,7 +829,7 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
* user may want to take charge of activation changes to the VG
* and not have the system autoactivation interfere.
*/
- if (!is_change_activating(activate) && cmd->event_activation &&
+ if (!is_change_activating(activate) && (cmd->event_activation != 2) &&
!cmd->online_vg_file_removed) {
cmd->online_vg_file_removed = 1;
online_vg_file_remove(lv->vg->name);
diff --git a/tools/vgchange.c b/tools/vgchange.c
index fc076c1d5..3d013f97b 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -755,8 +755,8 @@ static int _vgchange_autoactivation_setup(struct cmd_context *cmd,
return 1;
}
- if (!find_config_tree_bool(cmd, global_event_activation_CFG, NULL)) {
- log_print("Skip vgchange for event and event_activation=0.");
+ if (find_config_tree_int(cmd, global_event_activation_CFG, NULL) == 2) {
+ log_print("Skip vgchange for event and event_activation disabled (2).");
*skip_command = 1;
return 1;
}
diff --git a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
index 14e7dd26d..77b915935 100644
--- a/udev/69-dm-lvm.rules.in
+++ b/udev/69-dm-lvm.rules.in
@@ -72,7 +72,7 @@ ENV{SYSTEMD_READY}="1"
# and uses temp files under /run/lvm to check if
# other PVs in the VG are present.
#
-# If event_activation=0 in lvm.conf, this pvscan
+# If event_activation=2 in lvm.conf, this pvscan
# (using checkcomplete) will do nothing, so that
# no event-based autoactivation will be happen.
#