mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
enable event autoactivation even when event_activation=0
Setting event_activation=0 no longer enables static autoactivation
(which was removed in commit ee8fb0310c
"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.)
This commit is contained in:
parent
f0cd54a873
commit
0ed54d5b36
@ -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;
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
.
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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.
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user