File bug-1185190_01-pvscan-support-disabled-event_activation.patch of Package lvm2.26628

From 2be585b79c71b8f70c0252af5f09dbd5e6103030 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.

Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
 tools/pvscan.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff -Nupr a/tools/pvscan.c b/tools/pvscan.c
--- a/tools/pvscan.c	2021-04-23 11:12:35.352431602 +0800
+++ b/tools/pvscan.c	2021-04-23 11:18:29.194565976 +0800
@@ -914,6 +914,12 @@ int pvscan_cache_cmd(struct cmd_context
 	dm_list_init(&rem_devs);
 	dm_list_init(&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 (do_activate)
 		complete_vgnames = &vgnames;
 
-- 
2.16.4

openSUSE Build Service is sponsored by