summaryrefslogtreecommitdiff
path: root/tools/pvscan.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-07-13 16:26:36 -0500
committerDavid Teigland <teigland@redhat.com>2021-07-13 16:38:04 -0500
commite33c2e032cab40cf8607afa1cb92176400d1cabd (patch)
treeed3a30f9e268f0bf74d4150ef38a72e9a90a5900 /tools/pvscan.c
parent25f0f5daac5606e557d2124c219f5bb255c5d9dc (diff)
downloadlvm2-e33c2e032cab40cf8607afa1cb92176400d1cabd.tar.gz
pvscan: narrow the previous commit slightly
to avoid change to pvscan-autoactivate.sh
Diffstat (limited to 'tools/pvscan.c')
-rw-r--r--tools/pvscan.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 78cb5e764..6787c4cfc 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1611,6 +1611,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
struct pvscan_aa_params pp = { 0 };
struct dm_list complete_vgnames;
int do_activate = arg_is_set(cmd, activate_ARG);
+ int event_activation;
int devno_args = 0;
int do_all;
int ret;
@@ -1619,6 +1620,13 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
cmd->check_devs_used = 0;
+ event_activation = find_config_tree_bool(cmd, global_event_activation_CFG, NULL);
+
+ if (do_activate && !event_activation) {
+ log_verbose("Ignoring pvscan --cache -aay because event_activation is disabled.");
+ return ECMD_PROCESSED;
+ }
+
if (arg_is_set(cmd, major_ARG) + arg_is_set(cmd, minor_ARG))
devno_args = 1;
@@ -1629,17 +1637,17 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
do_all = !argc && !devno_args;
- if (!do_all && !find_config_tree_bool(cmd, global_event_activation_CFG, NULL)) {
- log_verbose("Ignoring pvscan --cache because event_activation is disabled.");
- return ECMD_PROCESSED;
- }
-
_online_dir_setup();
if (do_all) {
if (!_pvscan_cache_all(cmd, argc, argv, &complete_vgnames))
return ECMD_FAILED;
} else {
+ if (!event_activation) {
+ /* Avoid doing anything for device removal: pvscan --cache <devno> */
+ log_verbose("Ignoring pvscan --cache because event_activation is disabled.");
+ return ECMD_PROCESSED;
+ }
if (!_pvscan_cache_args(cmd, argc, argv, &complete_vgnames))
return ECMD_FAILED;
}