master - readline: switch to new-style readline typedef
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=216c57eed72fee...
Commit: 216c57eed72fee52e99bb5d014c9de535e631f58
Parent: 061acd177f4572f75107bac6a2f7379a55ceec93
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 6 16:04:19 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 6 17:28:40 2014 +0100
readline: switch to new-style readline typedef
Based on patch:
https://www.redhat.com/archives/lvm-devel/2014-March/msg00015.html
The CPPFunction typedef (among others) have been deprecated in favour of
specific prototyped typedefs since readline 4.2 (circa 2001).
It's been working since because compatibility typedefs have been in
place until they where removed in the recent readline 6.3 release.
Switch to the new style to avoid build breakage.
But also add full backward compatibility with define.
Signed-off-by: Gustavo Zacarias <gustavo zacarias com ar>
---
WHATS_NEW | 1 +
tools/lvm.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index cfdc488..6e04327 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Use correct rl_completion_func_t typedef for new readline.
Make lvm 'dumpconfig --type default' complete for it to be consumed by lvm.
Run pvscan --cache via systemd-run in udev if the PV label is detected lost.
Fix memleak when lvmetad discovers PV to appear on another device.
diff --git a/tools/lvm.c b/tools/lvm.c
index 51e9293..f9ab438 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -27,6 +27,7 @@ int main(int argc, char **argv)
# include <readline/history.h>
# ifndef HAVE_RL_COMPLETION_MATCHES
# define rl_completion_matches(a, b) completion_matches((char *)a, b)
+# define rl_completion_func_t CPPFunction
# endif
static struct cmdline_context *_cmdline;
@@ -185,7 +186,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
char *input = NULL, *args[MAX_ARGS], **argv;
rl_readline_name = "lvm";
- rl_attempted_completion_function = (CPPFunction *) _completion;
+ rl_attempted_completion_function = (rl_completion_func_t *) _completion;
_read_history(cmd);
10 years, 1 month
master - configure: drop duplicated SUBST
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=061acd177f4572...
Commit: 061acd177f4572f75107bac6a2f7379a55ceec93
Parent: cfc9e178bf24982f14c4d1e9034056ff6c3d3e31
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Mar 6 16:00:04 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Mar 6 16:16:11 2014 +0100
configure: drop duplicated SUBST
These subst are already there from pkg_config
---
configure.in | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/configure.in b/configure.in
index 58c7bdc..88edb29 100644
--- a/configure.in
+++ b/configure.in
@@ -1318,7 +1318,7 @@ AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getop
################################################################################
dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
-if test x$READLINE != xno; then
+if test "$READLINE" != no; then
lvm_saved_libs=$LIBS
AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses termcap termlib],
READLINE_LIBS=$ac_cv_search_tgetent, [
@@ -1610,7 +1610,6 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[[()]]' '{print $2}'`
################################################################################
AC_SUBST(APPLIB)
AC_SUBST(AWK)
-AC_SUBST(BLKID_LIBS)
AC_SUBST(BLKID_PC)
AC_SUBST(BLKID_WIPING)
AC_SUBST(BUILD_CMIRRORD)
@@ -1713,15 +1712,12 @@ 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)
AC_SUBST(UDEV_SYNC)
AC_SUBST(UDEV_SYSTEMD_BACKGROUND_JOBS)
AC_SUBST(UDEV_RULE_EXEC_DETECTION)
AC_SUBST(UDEV_HAS_BUILTIN_BLKID)
-AC_SUBST(CUNIT_LIBS)
-AC_SUBST(CUNIT_CFLAGS)
AC_SUBST(WRITE_INSTALL)
AC_SUBST(DMEVENTD_PIDFILE)
AC_SUBST(LVMETAD_PIDFILE)
10 years, 1 month
master - tests: fix name-mangling test and remove udev transaction in dmsetup wrapper
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cfc9e178bf2498...
Commit: cfc9e178bf24982f14c4d1e9034056ff6c3d3e31
Parent: 42eb9b45262f3cb9d9baf0903249128bb6923d4e
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 6 14:46:50 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 6 14:46:50 2014 +0100
tests: fix name-mangling test and remove udev transaction in dmsetup wrapper
---
test/lib/aux.sh | 2 --
test/shell/name-mangling.sh | 15 ++++++---------
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index c178ab5..5d2d188 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -763,9 +763,7 @@ have_readline()
dmsetup_wrapped()
{
udev_wait
- init_udev_transaction
dmsetup "$@"
- finish_udev_transaction
}
test -f DEVICES && devs=$(cat DEVICES)
diff --git a/test/shell/name-mangling.sh b/test/shell/name-mangling.sh
index b5906c1..2f07523 100644
--- a/test/shell/name-mangling.sh
+++ b/test/shell/name-mangling.sh
@@ -15,7 +15,7 @@ CHARACTER_WHITELIST="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456
FAIL_MIXED_STR="contains mixed mangled and unmangled characters"
FAIL_MULTI_STR="seems to be mangled more than once"
FAIL_BLACK_STR="should be mangled but it contains blacklisted characters"
-CORRECT_FORM_STR="name already in correct form"
+CORRECT_FORM_STR="already in correct form"
RENAMING_STR="renaming to"
function create_dm_dev()
@@ -66,13 +66,13 @@ function check_create_and_remove()
test -b "$DM_DEV_DIR/mapper/${PREFIX}$dm_name" && \
aux dmsetup remove "${PREFIX}$input_name" $verify_udev --manglename $mode || r=1
- if [ $dm_name = "FAIL_MIXED" ]; then
+ if [ "$dm_name" = "FAIL_MIXED" ]; then
r=0
grep "$FAILED_MIXED_STR" err || r=1
- elif [ $dm_name = "FAIL_MULTI" ]; then
+ elif [ "$dm_name" = "FAIL_MULTI" ]; then
r=0
grep "$FAILED_MULTI_STR" err || r=1
- elif [ $dm_name = "FAIL_BLACK" ]; then
+ elif [ "$dm_name" = "FAIL_BLACK" ]; then
r=0
grep "$FAILED_BLACK_STR" err || r=1
fi
@@ -164,6 +164,7 @@ r=0
create_dm_dev auto "abc"
ln -s "$DM_DEV_DIR/mapper/${PREFIX}abc" "$DM_DEV_DIR/${PREFIX}xyz"
aux dmsetup status "$DM_DEV_DIR/${PREFIX}xyz" || r=1
+rm -f "$DM_DEV_DIR/${PREFIX}xyz"
remove_dm_dev auto "abc"
if [ r = 1 ]; then
exit 1
@@ -191,11 +192,7 @@ check_expected_names none 'a\x5cx20b' 'a\x5cx20b' 'a\x5cx20b' 'a\x20b'
check_mangle_cmd none 'a b' 'OK'
check_mangle_cmd none 'a\x20b' 'a b'
-#
-# FIXME: this test leave entry in /dev/mapper dir
-# and is not detected nor cleaned
-#
-#check_mangle_cmd none 'a b\x20c' 'a b c'
+check_mangle_cmd none 'a b\x20c' 'a b c'
check_mangle_cmd none 'a\x5cx20b' 'a\x20b'
10 years, 1 month
master - WHATS_NEW: config handling changes
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=42eb9b45262f3c...
Commit: 42eb9b45262f3cb9d9baf0903249128bb6923d4e
Parent: 9a1d31a3c63e6e0078b4eb7e2afd43e2dcc65bc9
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 6 13:03:51 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 6 13:03:51 2014 +0100
WHATS_NEW: config handling changes
---
WHATS_NEW | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 7deba2f..cfdc488 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Make lvm 'dumpconfig --type default' complete for it to be consumed by lvm.
Run pvscan --cache via systemd-run in udev if the PV label is detected lost.
Fix memleak when lvmetad discovers PV to appear on another device.
Fix calculation of maximum size of COW device for snapshot (2.02.99).
10 years, 1 month
master - cleanup: remove superfluous forward declaration
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9a1d31a3c63e6e...
Commit: 9a1d31a3c63e6e0078b4eb7e2afd43e2dcc65bc9
Parent: 74a3fc4e853de50b0e5ccafcd2c9c5328dc10ad1
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 6 12:43:21 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 6 12:43:21 2014 +0100
cleanup: remove superfluous forward declaration
---
lib/config/config.h | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/lib/config/config.h b/lib/config/config.h
index 9a8209d..5bfa345 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -63,8 +63,6 @@ typedef enum {
CFG_TYPE_STRING = 1 << 5, /* setting */
} cfg_def_type_t;
-typedef struct cfg_def_item cfg_def_item_t;
-
/* function types to evaluate default value at runtime */
typedef int (*t_fn_CFG_TYPE_BOOL) (struct cmd_context *cmd, struct profile *profile);
typedef int (*t_fn_CFG_TYPE_INT) (struct cmd_context *cmd, struct profile *profile);
10 years, 1 month
master - config: add default for allocation/cache_pool_chunk_size
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=74a3fc4e853de5...
Commit: 74a3fc4e853de50b0e5ccafcd2c9c5328dc10ad1
Parent: d27868e94fb953c7e61da1e0d356f816e4567933
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 4 11:15:54 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 6 11:34:02 2014 +0100
config: add default for allocation/cache_pool_chunk_size
The same as for allocation/thin_pool_chunk_size - the default value
used is just a starting point. The calculation continues using the
properties of the devices actually used.
---
lib/config/config.c | 5 +++++
lib/config/config.h | 1 +
lib/config/config_settings.h | 4 +---
lib/metadata/lv_manip.c | 2 +-
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 3cc091c..1717343 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1711,3 +1711,8 @@ int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, str
return (int) chunk_size;
}
+
+int get_default_allocation_cache_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile)
+{
+ return DEFAULT_CACHE_POOL_CHUNK_SIZE;
+}
diff --git a/lib/config/config.h b/lib/config/config.h
index 7d7d4b2..9a8209d 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -237,5 +237,6 @@ const char *get_default_backup_archive_dir_CFG(struct cmd_context *cmd, struct p
const char *get_default_config_profile_dir_CFG(struct cmd_context *cmd, struct profile *profile);
const char *get_default_activation_mirror_image_fault_policy_CFG(struct cmd_context *cmd, struct profile *profile);
int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile);
+int get_default_allocation_cache_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile);
#endif
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 6231b79..e631de6 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -117,10 +117,8 @@ cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0,
cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_wipe_signatures_when_zeroing_new_lvs_CFG, "wipe_signatures_when_zeroing_new_lvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL)
-
cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL)
-cfg(allocation_cache_pool_chunk_size_CFG, "cache_pool_chunk_size", allocation_CFG_SECTION, 0, CFG_TYPE_INT, 0, vsn(2, 2, 106), NULL)
-
+cfg_runtime(allocation_cache_pool_chunk_size_CFG, "cache_pool_chunk_size", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 106), NULL)
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 51342a3..1264de7 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5777,7 +5777,7 @@ static int _recalculate_pool_chunk_size_with_dev_hints(struct lvcreate_params *l
goto out;
min_chunk_size = DM_CACHE_MIN_DATA_BLOCK_SIZE;
max_chunk_size = DM_CACHE_MAX_DATA_BLOCK_SIZE;
- default_chunk_size = DEFAULT_CACHE_POOL_CHUNK_SIZE*2;
+ default_chunk_size = get_default_allocation_cache_pool_chunk_size_CFG(cmd, NULL) * 2;
} else {
log_error(INTERNAL_ERROR "%s is not a thin pool or cache pool",
pool_lv->name);
10 years, 1 month
master - config: runtime default for allocation/thin_pool_chunk_size
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d27868e94fb953...
Commit: d27868e94fb953c7e61da1e0d356f816e4567933
Parent: 932e75e89fcbce3c41a1875a707df5fd7ecdc5e6
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 4 11:10:59 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 6 11:26:02 2014 +0100
config: runtime default for allocation/thin_pool_chunk_size
The allocation/thin_pool_chunk_size is a bit more complex. It's default
value is evaluated in runtime based on selected thin_pool_chunk_size_policy.
But the value is just a starting point. The calculation then continues
with dependency on the properties of the devices used. Which means for
such a default value, we know only the starting value.
---
lib/config/config.c | 19 +++++++++++++++++++
lib/config/config.h | 1 +
lib/config/config_settings.h | 2 +-
lib/metadata/lv_manip.c | 5 +----
lib/metadata/thin_manip.c | 31 +++++++++----------------------
5 files changed, 31 insertions(+), 27 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index b8c67d0..3cc091c 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1692,3 +1692,22 @@ const char *get_default_activation_mirror_image_fault_policy_CFG(struct cmd_cont
{
return find_config_tree_str(cmd, activation_mirror_device_fault_policy_CFG, profile);
}
+
+int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile)
+{
+ const char *str;
+ uint32_t chunk_size;
+
+ str = find_config_tree_str(cmd, allocation_thin_pool_chunk_size_policy_CFG, profile);
+
+ if (!strcasecmp(str, "generic"))
+ chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE;
+ else if (!strcasecmp(str, "performance"))
+ chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE;
+ else {
+ log_error("Thin pool chunk size calculation policy \"%s\" is unrecognised.", str);
+ return 0;
+ }
+
+ return (int) chunk_size;
+}
diff --git a/lib/config/config.h b/lib/config/config.h
index 4d762fe..7d7d4b2 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -236,5 +236,6 @@ const char *get_default_backup_backup_dir_CFG(struct cmd_context *cmd, struct pr
const char *get_default_backup_archive_dir_CFG(struct cmd_context *cmd, struct profile *profile);
const char *get_default_config_profile_dir_CFG(struct cmd_context *cmd, struct profile *profile);
const char *get_default_activation_mirror_image_fault_policy_CFG(struct cmd_context *cmd, struct profile *profile);
+int get_default_allocation_thin_pool_chunk_size_CFG(struct cmd_context *cmd, struct profile *profile);
#endif
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 04f2498..6231b79 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -125,7 +125,7 @@ cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
cfg(allocation_thin_pool_chunk_size_policy_CFG, "thin_pool_chunk_size_policy", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_THIN_POOL_CHUNK_SIZE_POLICY, vsn(2, 2, 101), NULL)
-cfg(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_INT, 0, vsn(2, 2, 99), NULL)
+cfg_runtime(allocation_thin_pool_chunk_size_CFG, "thin_pool_chunk_size", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, vsn(2, 2, 99), NULL)
cfg(log_verbose_CFG, "verbose", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_VERBOSE, vsn(1, 0, 0), NULL)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 57ce2d9..51342a3 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5771,10 +5771,7 @@ static int _recalculate_pool_chunk_size_with_dev_hints(struct lvcreate_params *l
min_chunk_size = DM_THIN_MIN_DATA_BLOCK_SIZE;
max_chunk_size = DM_THIN_MAX_DATA_BLOCK_SIZE;
- if (lp->thin_chunk_size_calc_policy == THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE)
- default_chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE*2;
- else
- default_chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE*2;
+ default_chunk_size = get_default_allocation_thin_pool_chunk_size_CFG(cmd, NULL) * 2;
} else if (seg_is_cache_pool(lp)) {
if (find_config_tree_int(cmd, allocation_cache_pool_chunk_size_CFG, NULL))
goto out;
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index b28f5a0..2e49019 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -366,26 +366,6 @@ int update_pool_lv(struct logical_volume *lv, int activate)
return 1;
}
-static int _get_pool_chunk_size_calc(const char *str,
- int *chunk_size_calc_method,
- uint32_t *chunk_size)
-{
- if (!strcasecmp(str, "generic")) {
- *chunk_size_calc_method = THIN_CHUNK_SIZE_CALC_METHOD_GENERIC;
- *chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE * 2;
- }
- else if (!strcasecmp(str, "performance")) {
- *chunk_size_calc_method = THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE;
- *chunk_size = DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE * 2;
- }
- else {
- log_error("Thin pool chunk size calculation policy \"%s\" is unrecognised.", str);
- return 0;
- }
-
- return 1;
-}
-
int update_profilable_pool_params(struct cmd_context *cmd, struct profile *profile,
int passed_args, int *chunk_size_calc_method,
uint32_t *chunk_size, thin_discards_t *discards,
@@ -396,8 +376,15 @@ int update_profilable_pool_params(struct cmd_context *cmd, struct profile *profi
if (!(passed_args & PASS_ARG_CHUNK_SIZE)) {
if (!(*chunk_size = find_config_tree_int(cmd, allocation_thin_pool_chunk_size_CFG, profile) * 2)) {
str = find_config_tree_str(cmd, allocation_thin_pool_chunk_size_policy_CFG, profile);
- if (!_get_pool_chunk_size_calc(str, chunk_size_calc_method, chunk_size))
- return_0;
+ if (!strcasecmp(str, "generic"))
+ *chunk_size_calc_method = THIN_CHUNK_SIZE_CALC_METHOD_GENERIC;
+ else if (!strcasecmp(str, "performance"))
+ *chunk_size_calc_method = THIN_CHUNK_SIZE_CALC_METHOD_PERFORMANCE;
+ else {
+ log_error("Thin pool chunk size calculation policy \"%s\" is unrecognised.", str);
+ return 0;
+ }
+ *chunk_size = get_default_allocation_thin_pool_chunk_size_CFG(cmd, profile) * 2;
}
}
10 years, 1 month
master - config: separate cfg_def_default_value_hint out of cfg_def_get_default_value
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=932e75e89fcbce...
Commit: 932e75e89fcbce3c41a1875a707df5fd7ecdc5e6
Parent: eecf191d3e95526c6638c668a20472c9c3620967
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Mar 4 10:29:08 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 6 11:18:19 2014 +0100
config: separate cfg_def_default_value_hint out of cfg_def_get_default_value
If the config setting is defined as having no default value, but it's
still not NULL, it means such a value acts as a *hint* only
(e.g. a starting value from which the default value is calculated).
The new "cfg_def_get_default_value_hint" will always return the value
as defined in config_settings.h.
The original "cfg_def_get_default_value" will always return 0/NULL if
the config setting is defined with CFG_DEFAULT_UNDEFINED flag (hence
ignoring the hint).
This is needed for proper distiction between a correct default value
and the value which is just a hint or a starting point in calculation,
but it's not the final value (yes, we do have such settings!).
---
lib/config/config.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index a7cb5b2..b8c67d0 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -478,8 +478,8 @@ time_t config_file_timestamp(struct dm_config_tree *cft)
}
#define cfg_def_get_item_p(id) (&_cfg_def_items[id])
-#define cfg_def_get_default_value(cmd,item,type,profile) ((item->flags & CFG_DEFAULT_RUN_TIME) ? item->default_value.fn_##type(cmd,profile) : item->default_value.v_##type)
-
+#define cfg_def_get_default_value_hint(cmd,item,type,profile) ((item->flags & CFG_DEFAULT_RUN_TIME) ? item->default_value.fn_##type(cmd,profile) : item->default_value.v_##type)
+#define cfg_def_get_default_value(cmd,item,type,profile) (item->flags & CFG_DEFAULT_UNDEFINED ? 0 : cfg_def_get_default_value_hint(cmd,item,type,profile))
static int _cfg_def_make_path(char *buf, size_t buf_size, int id, cfg_def_item_t *item, int xlate)
{
@@ -1358,19 +1358,19 @@ static struct dm_config_node *_add_def_node(struct dm_config_tree *cft,
break;
case CFG_TYPE_BOOL:
cn->v->type = DM_CFG_INT;
- cn->v->v.i = cfg_def_get_default_value(spec->cmd, def, CFG_TYPE_BOOL, NULL);
+ cn->v->v.i = cfg_def_get_default_value_hint(spec->cmd, def, CFG_TYPE_BOOL, NULL);
break;
case CFG_TYPE_INT:
cn->v->type = DM_CFG_INT;
- cn->v->v.i = cfg_def_get_default_value(spec->cmd, def, CFG_TYPE_INT, NULL);
+ cn->v->v.i = cfg_def_get_default_value_hint(spec->cmd, def, CFG_TYPE_INT, NULL);
break;
case CFG_TYPE_FLOAT:
cn->v->type = DM_CFG_FLOAT;
- cn->v->v.f = cfg_def_get_default_value(spec->cmd, def, CFG_TYPE_FLOAT, NULL);
+ cn->v->v.f = cfg_def_get_default_value_hint(spec->cmd, def, CFG_TYPE_FLOAT, NULL);
break;
case CFG_TYPE_STRING:
cn->v->type = DM_CFG_STRING;
- if (!(str = cfg_def_get_default_value(spec->cmd, def, CFG_TYPE_STRING, NULL)))
+ if (!(str = cfg_def_get_default_value_hint(spec->cmd, def, CFG_TYPE_STRING, NULL)))
str = "";
cn->v->v.str = str;
break;
10 years, 1 month
master - config: runtime default for activation/mirror_image_fault_policy
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eecf191d3e9552...
Commit: eecf191d3e95526c6638c668a20472c9c3620967
Parent: 11039589d36b54f8ddb7fe2b0d59dd2610a7e2f4
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 3 13:37:35 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 6 11:16:23 2014 +0100
config: runtime default for activation/mirror_image_fault_policy
The activation/mirror_image_fault_policy default value copies the
value (or default one) used for activation/mirror_device_fault_policy.
---
lib/config/config.c | 5 +++++
lib/config/config.h | 1 +
lib/config/config_settings.h | 2 +-
tools/lvconvert.c | 2 --
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index f3e105d..a7cb5b2 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1687,3 +1687,8 @@ const char *get_default_config_profile_dir_CFG(struct cmd_context *cmd, struct p
return dm_pool_strdup(cmd->mem, buf);
}
+
+const char *get_default_activation_mirror_image_fault_policy_CFG(struct cmd_context *cmd, struct profile *profile)
+{
+ return find_config_tree_str(cmd, activation_mirror_device_fault_policy_CFG, profile);
+}
diff --git a/lib/config/config.h b/lib/config/config.h
index f380e26..4d762fe 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -235,5 +235,6 @@ const char *get_default_devices_cache_CFG(struct cmd_context *cmd, struct profil
const char *get_default_backup_backup_dir_CFG(struct cmd_context *cmd, struct profile *profile);
const char *get_default_backup_archive_dir_CFG(struct cmd_context *cmd, struct profile *profile);
const char *get_default_config_profile_dir_CFG(struct cmd_context *cmd, struct profile *profile);
+const char *get_default_activation_mirror_image_fault_policy_CFG(struct cmd_context *cmd, struct profile *profile);
#endif
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 081d612..04f2498 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -202,7 +202,7 @@ cfg(activation_readahead_CFG, "readahead", activation_CFG_SECTION, 0, CFG_TYPE_S
cfg(activation_raid_fault_policy_CFG, "raid_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_RAID_FAULT_POLICY, vsn(2, 2, 89), NULL)
cfg(activation_mirror_device_fault_policy_CFG, "mirror_device_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_MIRROR_DEVICE_FAULT_POLICY, vsn(1, 2, 10), NULL)
cfg(activation_mirror_log_fault_policy_CFG, "mirror_log_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_MIRROR_LOG_FAULT_POLICY, vsn(1, 2, 18), NULL)
-cfg(activation_mirror_image_fault_policy_CFG, "mirror_image_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, NULL, vsn(2, 2, 57), NULL)
+cfg_runtime(activation_mirror_image_fault_policy_CFG, "mirror_image_fault_policy", activation_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(2, 2, 57), NULL)
cfg(activation_snapshot_autoextend_threshold_CFG, "snapshot_autoextend_threshold", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_SNAPSHOT_AUTOEXTEND_THRESHOLD, vsn(2, 2, 75), NULL)
cfg(activation_snapshot_autoextend_percent_CFG, "snapshot_autoextend_percent", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_SNAPSHOT_AUTOEXTEND_PERCENT, vsn(2, 2, 75), NULL)
cfg(activation_thin_pool_autoextend_threshold_CFG, "thin_pool_autoextend_threshold", activation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_INT, DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD, vsn(2, 2, 89), NULL)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 09a64c7..c8cc506 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -1063,8 +1063,6 @@ static void _lvconvert_mirrors_repair_ask(struct cmd_context *cmd,
if (arg_count(cmd, use_policies_ARG)) {
leg_policy = find_config_tree_str(cmd, activation_mirror_image_fault_policy_CFG, NULL);
- if (!leg_policy)
- leg_policy = find_config_tree_str(cmd, activation_mirror_device_fault_policy_CFG, NULL);
log_policy = find_config_tree_str(cmd, activation_mirror_log_fault_policy_CFG, NULL);
*replace_mirrors = strcmp(leg_policy, "remove");
*replace_log = strcmp(log_policy, "remove");
10 years, 1 month
master - config: runtime default for config/profile_dir
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=11039589d36b54...
Commit: 11039589d36b54f8ddb7fe2b0d59dd2610a7e2f4
Parent: 0da1e5d9f8bdb2e4d385faf7c0f4604e63100acc
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 3 13:30:13 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 6 11:16:04 2014 +0100
config: runtime default for config/profile_dir
The config/profile_dir default value takes LVM_SYSTEM_DIR into consideraton.
---
lib/commands/toolcontext.c | 12 ++----------
lib/config/config.c | 13 +++++++++++++
lib/config/config.h | 1 +
lib/config/config_settings.h | 2 +-
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index ce4349d..7282592 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -613,7 +613,6 @@ static int _init_tag_configs(struct cmd_context *cmd)
static int _init_profiles(struct cmd_context *cmd)
{
- static char default_dir[PATH_MAX];
const char *dir;
struct profile_params *pp;
@@ -622,15 +621,8 @@ static int _init_profiles(struct cmd_context *cmd)
return 0;
}
- if (!(dir = find_config_tree_str(cmd, config_profile_dir_CFG, NULL))) {
- if (dm_snprintf(default_dir, sizeof(default_dir), "%s/%s",
- cmd->system_dir, DEFAULT_PROFILE_SUBDIR) == -1) {
- log_error("Couldn't create default profile path '%s/%s'.",
- cmd->system_dir, DEFAULT_PROFILE_SUBDIR);
- return 0;
- }
- dir = default_dir;
- }
+ if (!(dir = find_config_tree_str(cmd, config_profile_dir_CFG, NULL)))
+ return_0;
pp->dir = dm_pool_strdup(cmd->libmem, dir);
dm_list_init(&pp->profiles_to_load);
diff --git a/lib/config/config.c b/lib/config/config.c
index 75b90fb..f3e105d 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1674,3 +1674,16 @@ const char *get_default_backup_archive_dir_CFG(struct cmd_context *cmd, struct p
return dm_pool_strdup(cmd->mem, buf);
}
+
+const char *get_default_config_profile_dir_CFG(struct cmd_context *cmd, struct profile *profile)
+{
+ static char buf[PATH_MAX];
+
+ if (dm_snprintf(buf, sizeof(buf), "%s/%s", cmd->system_dir, DEFAULT_PROFILE_SUBDIR) == -1) {
+ log_error("Couldn't create default profile path '%s/%s'.",
+ cmd->system_dir, DEFAULT_PROFILE_SUBDIR);
+ return NULL;
+ }
+
+ return dm_pool_strdup(cmd->mem, buf);
+}
diff --git a/lib/config/config.h b/lib/config/config.h
index a042c60..f380e26 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -234,5 +234,6 @@ const char *get_default_devices_cache_dir_CFG(struct cmd_context *cmd, struct pr
const char *get_default_devices_cache_CFG(struct cmd_context *cmd, struct profile *profile);
const char *get_default_backup_backup_dir_CFG(struct cmd_context *cmd, struct profile *profile);
const char *get_default_backup_archive_dir_CFG(struct cmd_context *cmd, struct profile *profile);
+const char *get_default_config_profile_dir_CFG(struct cmd_context *cmd, struct profile *profile);
#endif
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index d6ccf0e..081d612 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -83,7 +83,7 @@ cfg_section(tags_CFG_SECTION, "tags", root_CFG_SECTION, 0, vsn(1, 0, 18), NULL)
cfg(config_checks_CFG, "checks", config_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 99), "Configuration tree check on each LVM command execution.")
cfg(config_abort_on_errors_CFG, "abort_on_errors", config_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2,2,99), "Abort LVM command execution if configuration is invalid.")
-cfg(config_profile_dir_CFG, "profile_dir", config_CFG_SECTION, 0, CFG_TYPE_STRING, 0, vsn(2, 2, 99), "Directory with configuration profiles.")
+cfg_runtime(config_profile_dir_CFG, "profile_dir", config_CFG_SECTION, 0, CFG_TYPE_STRING, vsn(2, 2, 99), "Directory with configuration profiles.")
cfg(devices_dir_CFG, "dir", devices_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEV_DIR, vsn(1, 0, 0), NULL)
cfg_array(devices_scan_CFG, "scan", devices_CFG_SECTION, 0, CFG_TYPE_STRING, "#S/dev", vsn(1, 0, 0), NULL)
10 years, 1 month