From 2791a82ba02ee252b587c16336d898040128cc44 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Fri, 7 May 2021 10:16:06 -0500 Subject: lvreduce: add config option lvreduce_detectfs which controls whether or not lvreduce will check for a file system. The default is 1. The command option --detectfs y|n overrides this config setting. --- lib/config/config_settings.h | 9 +++++++++ tools/lvresize.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h index d3a42a153..2d7aa00b6 100644 --- a/lib/config/config_settings.h +++ b/lib/config/config_settings.h @@ -1115,6 +1115,15 @@ 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_lvreduce_detectfs_CFG, "lvreduce_detectfs", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, 1, vsn(2, 3, 12), 0, 0, NULL, + "Control if lvreduce will check for file systems that can be reduced.\n" + "When enabled, lvreduce will use blkid to check if the LV has a file system\n" + "that can be reduced. If the file system cannot be reduced, then the LV will\n" + "will not be reduced. If the file system can be reduced, then --resizefs\n" + "is also required. If no file system is found, then the LV is reduced.\n" + "The LV will be activated, if needed, to do the check.\n" + "The command line option --detectfs y|n overrides this setting.\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, "Activate LVs based on system-generated device events.\n" "When a PV appears on the system, a system-generated uevent triggers\n" diff --git a/tools/lvresize.c b/tools/lvresize.c index ab434ba14..f97df4f42 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -43,7 +43,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv, if (arg_is_set(cmd, detectfs_ARG)) lp->detectfs = arg_int_value(cmd, detectfs_ARG, 1); else - lp->detectfs = 1; + lp->detectfs = find_config_tree_bool(cmd, global_lvreduce_detectfs_CFG, NULL);; } lp->sign = lp->poolmetadata_sign = SIGN_NONE; -- cgit v1.2.1