From da88d405f414c864857fd63aeddf4e3125bd166f Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Mon, 8 Feb 2021 16:28:18 +0100
Subject: [PATCH] pvscan: support disabled event_activation

In past we had this control with use_lvmetad check for
pvscan --cache -aay

Howerer this got lost with lvmetad removal commit:
117160b27e510dceb1ed6acf995115c040acd88d

When user sets lvm.conf global/event_activation=0
pvscan service will no longer auto activate any LVs on appeared PVs.
---
 tools/pvscan.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/pvscan.c b/tools/pvscan.c
index 55c708682..7493c402b 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1575,6 +1575,12 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
 
 	dm_list_init(&complete_vgnames);
 
+	if (do_activate &&
+	    !find_config_tree_bool(cmd, global_event_activation_CFG, NULL)) {
+		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;
 
-- 
2.16.6