Skip to contentSkip to conversation

master - thin: add thin_repair and thin_dump options

PATCH Zdenek Kabelac 1 participant 1 message Jul 31, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=22fc80982aa08ef8a907fc858a29a30c2d9293a7
Commit:        22fc80982aa08ef8a907fc858a29a30c2d9293a7
Parent:        ea605d1ec72960cf8076fb0260dd151a32750ff6
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Jul 31 14:38:10 2013 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Jul 31 15:30:47 2013 +0200

thin: add thin_repair and thin_dump options

Add new configure lvm.conf options for binaries thin_repair and thin_dump.

Those are part of device-mapper-persistent-data package and will be used for recovery of thin_pool.

---
 WHATS_NEW                    |    2 +
 conf/example.conf.in         |   28 ++++++++--
 configure                    |  124 ++++++++++++++++++++++++++++++++++++++++++
 configure.in                 |   26 +++++++++
 lib/config/config_settings.h |    3 +
 lib/config/defaults.h        |    1 +
 lib/misc/configure.h.in      |    6 ++
 7 files changed, 186 insertions(+), 4 deletions(-)
WHATS_NEW +2 -0
index 71228c9..6d59265 100644
@@ -1,5 +1,7 @@
 Version 2.02.100 -
 ================================
+  Add --with-thin-repair and --with-thin-dump configure options.
+  Add lvm.conf thin_repair/dump_executable and thin_repair_options.
   Require 1.9 thin pool target version for online thin pool metadata resize.
   Ignore previous LV seg with alloc contiguous & cling when num stripes varies.
   Fix segfault if devices/global_filter is not specified correctly.
conf/example.conf.in +24 -4
index 2032a81..0e313c8 100644
@@ -561,11 +561,29 @@ global {
     # The thin tools are available as part of the device-mapper-persistent-data
     # package from https://github.com/jthornber/thin-provisioning-tools.
     #
-    thin_check_executable = "@THIN_CHECK_CMD@"
+    # thin_check_executable = "@THIN_CHECK_CMD@"
 
-    # String with options passed with thin_check command. By default,
-    # option '-q' is for quiet output.
-    thin_check_options = [ "-q" ]
+    # Array of string options passed with thin_check command. By default,
+    # option "-q" is for quiet output.
+    # With thin_check version 2.1 or newer you can add "--ignore-non-fatal-errors"
+    # to let it pass through ignoreable errors and fix them later.
+    #
+    # thin_check_options = [ "-q" ]
+
+    # Full path of the utility called to repair a thin metadata device
+    # is in a state that allows it to be used.
+    # Each time a thin pool needs repair this utility is executed.
+    # See thin_check_executable how to obtain binaries.
+    #
+    # thin_repair_executable = "@THIN_REPAIR_CMD@"
+
+    # Array of extra string options passed with thin_repair command.
+    # thin_repair_options = [ "" ]
+
+    # Full path of the utility called to dump thin metadata content.
+    # See thin_check_executable how to obtain binaries.
+    #
+    # thin_dump_executable = "@THIN_DUMP_CMD@"
 
     # If set, given features are not used by thin driver.
     # This can be helpful not just for testing, but i.e. allows to avoid
@@ -574,6 +592,8 @@ global {
     #   block_size
     #   discards
     #   discards_non_power_2
+    #   external_origin
+    #   metadata_resize
     #
     # thin_disabled_features = [ "discards", "block_size" ]
 }
configure +124 -0

160 lines not on this page · raw message

configure.in +26 -0
index 97ddc1d..611ab37 100644
@@ -424,12 +424,36 @@ case "$THIN" in
 		AC_PATH_PROG(THIN_CHECK_CMD, thin_check)
 		test -z "$THIN_CHECK_CMD" && AC_MSG_ERROR(thin_check not found in path $PATH)
 	fi
+	AC_ARG_WITH(thin-dump,
+		AC_HELP_STRING([--with-thin-dump=PATH],
+			       [thin_dump tool: [[autodetect]]]),
+			       THIN_DUMP_CMD=$withval, THIN_DUMP_CMD="autodetect")
+	# Empty means a config way to ignore thin checking
+	if test "$THIN_DUMP_CMD" = "autodetect"; then
+		AC_PATH_PROG(THIN_DUMP_CMD, thin_dump)
+		test -z "$THIN_DUMP_CMD" && AC_MSG_ERROR(thin_dump not found in path $PATH)
+	fi
+	AC_ARG_WITH(thin-repair,
+		AC_HELP_STRING([--with-thin-repair=PATH],
+			       [thin_repair tool: [[autodetect]]]),
+			       THIN_REPAIR_CMD=$withval, THIN_REPAIR_CMD="autodetect")
+	# Empty means a config way to ignore thin checking
+	if test "$THIN_REPAIR_CMD" = "autodetect"; then
+		AC_PATH_PROG(THIN_REPAIR_CMD, thin_repair)
+		test -z "$THIN_REPAIR_CMD" && AC_MSG_ERROR(thin_repair not found in path $PATH)
+	fi
 	;;
 esac
 
 AC_DEFINE_UNQUOTED([THIN_CHECK_CMD], ["$THIN_CHECK_CMD"],
 		   [The path to 'thin_check', if available.])
 
+AC_DEFINE_UNQUOTED([THIN_DUMP_CMD], ["$THIN_DUMP_CMD"],
+		   [The path to 'thin_dump', if available.])
+
+AC_DEFINE_UNQUOTED([THIN_REPAIR_CMD], ["$THIN_REPAIR_CMD"],
+		   [The path to 'thin_repair', if available.])
+
 
 ################################################################################
 dnl -- Disable readline
@@ -1598,6 +1622,8 @@ AC_SUBST(STATIC_LINK)
 AC_SUBST(TESTING)
 AC_SUBST(THIN)
 AC_SUBST(THIN_CHECK_CMD)
+AC_SUBST(THIN_DUMP_CMD)
+AC_SUBST(THIN_REPAIR_CMD)
 AC_SUBST(UDEV_LIBS)
 AC_SUBST(UDEV_PC)
 AC_SUBST(UDEV_RULES)
lib/config/config_settings.h +3 -0
index 16a9437..3992764 100644
@@ -160,6 +160,9 @@ cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, 0, CFG_TYPE_BOOL,
 cfg(global_thin_check_executable_CFG, "thin_check_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, THIN_CHECK_CMD, vsn(2, 2, 94), NULL)
 cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_THIN_CHECK_OPTIONS, vsn(2, 2, 96), NULL)
 cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S", vsn(2, 2, 99), NULL)
+cfg(global_thin_dump_executable_CFG, "thin_dump_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, THIN_DUMP_CMD, vsn(2, 2, 100), NULL)
+cfg(global_thin_repair_executable_CFG, "thin_repair_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, THIN_REPAIR_CMD, vsn(2, 2, 100), NULL)
+cfg_array(global_thin_repair_options_CFG, "thin_repair_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_THIN_REPAIR_OPTIONS, vsn(2, 2, 100), NULL)
 
 cfg(activation_checks_CFG, "checks", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ACTIVATION_CHECKS, vsn(2, 2, 86), NULL)
 cfg(activation_udev_sync_CFG, "udev_sync", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_UDEV_SYNC, vsn(2, 2, 51), NULL)
lib/config/defaults.h +1 -0
index 34ce2ea..5af0f00 100644
@@ -66,6 +66,7 @@
 #define DEFAULT_BACKGROUND_POLLING 1
 
 #define DEFAULT_THIN_CHECK_OPTIONS "-q"
+#define DEFAULT_THIN_REPAIR_OPTIONS ""
 #define DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
 #define DEFAULT_THIN_POOL_MAX_METADATA_SIZE (16 * 1024 * 1024)  /* KB */
 #define DEFAULT_THIN_POOL_MIN_METADATA_SIZE 2048  /* KB */
lib/misc/configure.h.in +6 -0
index aae4f24..13ba882 100644
@@ -546,9 +546,15 @@
 /* The path to 'thin_check', if available. */
 #undef THIN_CHECK_CMD
 
+/* The path to 'thin_dump', if available. */
+#undef THIN_DUMP_CMD
+
 /* Define to 1 to include built-in support for thin provisioning. */
 #undef THIN_INTERNAL
 
+/* The path to 'thin_repair', if available. */
+#undef THIN_REPAIR_CMD
+
 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
 #undef TIME_WITH_SYS_TIME