master - config: add profile arg to find_config_tree_float
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=aeffa4cb5bbb70...
Commit: aeffa4cb5bbb707d7d42eea6d2504a10ed0b798f
Parent: dbea545ffbfa08c799c35b85417e42684bc550e2
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:31:36 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_float
---
lib/config/config.c | 14 ++++++++++++--
lib/config/config.h | 2 +-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index f7194a7..28229f4 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -886,15 +886,25 @@ int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *
return i64;
}
-float find_config_tree_float(struct cmd_context *cmd, int id)
+float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
const char *path = cfg_def_get_path(item);
+ int profile_applied = 0;
+ float f;
if (item->type != CFG_TYPE_FLOAT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as float.", path);
- return dm_config_tree_find_float(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_FLOAT));
+ if (profile && !cmd->profile_params->global_profile)
+ profile_applied = override_config_tree_from_profile(cmd, profile);
+
+ f = dm_config_tree_find_float(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_FLOAT));
+
+ if (profile_applied)
+ remove_config_tree_by_source(cmd, CONFIG_PROFILE);
+
+ return f;
}
int find_config_tree_bool(struct cmd_context *cmd, int id)
diff --git a/lib/config/config.h b/lib/config/config.h
index cf94c03..ece4613 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -169,7 +169,7 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile);
int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile);
int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile);
-float find_config_tree_float(struct cmd_context *cmd, int id);
+float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *profile);
int find_config_tree_bool(struct cmd_context *cmd, int id);
#endif
10 years, 10 months
master - config: add profile arg to find_config_tree_int64
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dbea545ffbfa08...
Commit: dbea545ffbfa08c799c35b85417e42684bc550e2
Parent: 50bf2c0db14400d80b08afabe917deee51f32ac8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:31:24 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_int64
---
lib/commands/toolcontext.c | 2 +-
lib/config/config.c | 14 ++++++++++++--
lib/config/config.h | 2 +-
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 8fce261..ead77e5 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -400,7 +400,7 @@ static int _process_config(struct cmd_context *cmd)
cmd->metadata_read_only = find_config_tree_bool(cmd, global_metadata_read_only_CFG);
- pv_min_kb = find_config_tree_int64(cmd, devices_pv_min_size_CFG);
+ pv_min_kb = find_config_tree_int64(cmd, devices_pv_min_size_CFG, NULL);
if (pv_min_kb < PV_MIN_SIZE_KB) {
log_warn("Ignoring too small pv_min_size %" PRId64 "KB, using default %dKB.",
pv_min_kb, PV_MIN_SIZE_KB);
diff --git a/lib/config/config.c b/lib/config/config.c
index ae00461..f7194a7 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -865,15 +865,25 @@ int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profil
return i;
}
-int64_t find_config_tree_int64(struct cmd_context *cmd, int id)
+int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
const char *path = cfg_def_get_path(item);
+ int profile_applied = 0;
+ int i64;
if (item->type != CFG_TYPE_INT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
- return dm_config_tree_find_int64(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_INT));
+ if (profile && !cmd->profile_params->global_profile)
+ profile_applied = override_config_tree_from_profile(cmd, profile);
+
+ i64 = dm_config_tree_find_int64(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_INT));
+
+ if (profile_applied)
+ remove_config_tree_by_source(cmd, CONFIG_PROFILE);
+
+ return i64;
}
float find_config_tree_float(struct cmd_context *cmd, int id)
diff --git a/lib/config/config.h b/lib/config/config.h
index a93cef9..cf94c03 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -168,7 +168,7 @@ const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int
const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile);
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile);
int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile);
-int64_t find_config_tree_int64(struct cmd_context *cmd, int id);
+int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *profile);
float find_config_tree_float(struct cmd_context *cmd, int id);
int find_config_tree_bool(struct cmd_context *cmd, int id);
10 years, 10 months
master - config: add profile arg to find_config_tree_int
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=50bf2c0db14400...
Commit: 50bf2c0db14400d80b08afabe917deee51f32ac8
Parent: 8ac4fcf8ffa4af3ee8d524add632f0f3139b929d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:30:34 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_int
---
daemons/clvmd/lvm-functions.c | 2 +-
lib/commands/toolcontext.c | 12 ++++++------
lib/config/config.c | 14 ++++++++++++--
lib/config/config.h | 2 +-
lib/format_text/format-text.c | 2 +-
lib/locking/locking.c | 2 +-
lib/metadata/lv_manip.c | 4 ++--
lib/metadata/metadata.c | 2 +-
lib/metadata/thin_manip.c | 2 +-
lib/mm/memlock.c | 6 +++---
tools/lvcreate.c | 2 +-
tools/lvm.c | 2 +-
tools/lvresize.c | 10 +++++-----
tools/polldaemon.c | 4 ++--
tools/pvscan.c | 2 +-
tools/toollib.c | 10 +++++-----
tools/vgconvert.c | 4 ++--
17 files changed, 46 insertions(+), 36 deletions(-)
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index 5be9ee1..9d62675 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -803,7 +803,7 @@ static void check_config(void)
{
int locking_type;
- locking_type = find_config_tree_int(cmd, global_locking_type_CFG);
+ locking_type = find_config_tree_int(cmd, global_locking_type_CFG, NULL);
if (locking_type == 3) /* compiled-in cluster support */
return;
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index f5b8d48..8fce261 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -182,7 +182,7 @@ static void _init_logging(struct cmd_context *cmd)
init_syslog(cmd->default_settings.syslog);
/* Debug level for log file output */
- cmd->default_settings.debug = find_config_tree_int(cmd, log_level_CFG);
+ cmd->default_settings.debug = find_config_tree_int(cmd, log_level_CFG, NULL);
init_debug(cmd->default_settings.debug);
/*
@@ -281,7 +281,7 @@ static int _process_config(struct cmd_context *cmd)
}
/* umask */
- cmd->default_settings.umask = find_config_tree_int(cmd, global_umask_CFG);
+ cmd->default_settings.umask = find_config_tree_int(cmd, global_umask_CFG, NULL);
if ((old_umask = umask((mode_t) cmd->default_settings.umask)) !=
(mode_t) cmd->default_settings.umask)
@@ -426,7 +426,7 @@ static int _process_config(struct cmd_context *cmd)
cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL);
lvmetad_set_token(cn ? cn->v : NULL);
- if (find_config_tree_int(cmd, global_locking_type_CFG) == 3 &&
+ if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 &&
find_config_tree_bool(cmd, global_use_lvmetad_CFG)) {
log_warn("WARNING: configuration setting use_lvmetad overridden to 0 due to locking_type 3. "
"Clustered environment not supported by lvmetad yet.");
@@ -716,7 +716,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
int device_list_from_udev;
init_dev_disable_after_error_count(
- find_config_tree_int(cmd, devices_disable_after_error_count_CFG));
+ find_config_tree_int(cmd, devices_disable_after_error_count_CFG, NULL));
if (!dev_cache_init(cmd))
return_0;
@@ -1255,9 +1255,9 @@ static int _init_backup(struct cmd_context *cmd)
cmd->default_settings.archive =
find_config_tree_bool(cmd, backup_archive_CFG);
- days = (uint32_t) find_config_tree_int(cmd, backup_retain_days_CFG);
+ days = (uint32_t) find_config_tree_int(cmd, backup_retain_days_CFG, NULL);
- min = (uint32_t) find_config_tree_int(cmd, backup_retain_min_CFG);
+ min = (uint32_t) find_config_tree_int(cmd, backup_retain_min_CFG, NULL);
if (dm_snprintf
(default_dir, sizeof(default_dir), "%s/%s", cmd->system_dir,
diff --git a/lib/config/config.c b/lib/config/config.c
index 1576153..ae00461 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -844,15 +844,25 @@ const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, st
return str;
}
-int find_config_tree_int(struct cmd_context *cmd, int id)
+int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
const char *path = cfg_def_get_path(item);
+ int profile_applied = 0;
+ int i;
if (item->type != CFG_TYPE_INT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
- return dm_config_tree_find_int(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_INT));
+ if (profile && !cmd->profile_params->global_profile)
+ profile_applied = override_config_tree_from_profile(cmd, profile);
+
+ i = dm_config_tree_find_int(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_INT));
+
+ if (profile_applied)
+ remove_config_tree_by_source(cmd, CONFIG_PROFILE);
+
+ return i;
}
int64_t find_config_tree_int64(struct cmd_context *cmd, int id)
diff --git a/lib/config/config.h b/lib/config/config.h
index 56ed4ea..a93cef9 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -167,7 +167,7 @@ int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft,
const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile);
const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile);
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile);
-int find_config_tree_int(struct cmd_context *cmd, int id);
+int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profile);
int64_t find_config_tree_int64(struct cmd_context *cmd, int id);
float find_config_tree_float(struct cmd_context *cmd, int id);
int find_config_tree_bool(struct cmd_context *cmd, int id);
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 96c4f8b..a5b9b6c 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -1478,7 +1478,7 @@ static int _text_pv_initialise(const struct format_type *fmt,
unsigned long adjustment, final_alignment = 0;
if (!data_alignment)
- data_alignment = find_config_tree_int(pv->fmt->cmd, devices_data_alignment_CFG) * 2;
+ data_alignment = find_config_tree_int(pv->fmt->cmd, devices_data_alignment_CFG, NULL) * 2;
if (set_pe_align(pv, data_alignment) != data_alignment &&
data_alignment) {
diff --git a/lib/locking/locking.c b/lib/locking/locking.c
index 044570f..7d9db60 100644
--- a/lib/locking/locking.c
+++ b/lib/locking/locking.c
@@ -225,7 +225,7 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
suppress_messages = 1;
if (type < 0)
- type = find_config_tree_int(cmd, global_locking_type_CFG);
+ type = find_config_tree_int(cmd, global_locking_type_CFG, NULL);
_blocking_supported = find_config_tree_bool(cmd, global_wait_for_locks_CFG);
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index ef7c75a..e74b6f1 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -182,8 +182,8 @@ int get_default_region_size(struct cmd_context *cmd)
* 'mirror_region_size' is the old setting. It is overridden
* by the new setting, 'raid_region_size'.
*/
- mrs = 2 * find_config_tree_int(cmd, activation_mirror_region_size_CFG);
- rrs = 2 * find_config_tree_int(cmd, activation_raid_region_size_CFG);
+ mrs = 2 * find_config_tree_int(cmd, activation_mirror_region_size_CFG, NULL);
+ rrs = 2 * find_config_tree_int(cmd, activation_raid_region_size_CFG, NULL);
if (!mrs && !rrs)
return DEFAULT_RAID_REGION_SIZE * 2;
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 8a98aa6..0dfb23b 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -65,7 +65,7 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
goto out;
}
- default_pe_align = find_config_tree_int(pv->fmt->cmd, devices_default_data_alignment_CFG);
+ default_pe_align = find_config_tree_int(pv->fmt->cmd, devices_default_data_alignment_CFG, NULL);
if (default_pe_align)
/* align on 1 MiB multiple */
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 7ddadcf..9fccc6f 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -335,7 +335,7 @@ int pool_below_threshold(const struct lv_segment *pool_seg)
{
percent_t percent;
int threshold = PERCENT_1 *
- find_config_tree_int(pool_seg->lv->vg->cmd, activation_thin_pool_autoextend_threshold_CFG);
+ find_config_tree_int(pool_seg->lv->vg->cmd, activation_thin_pool_autoextend_threshold_CFG, NULL);
/* Data */
if (!lv_thin_pool_percent(pool_seg->lv, 0, &percent))
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index d2cb61c..594687e 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -463,9 +463,9 @@ void memlock_init(struct cmd_context *cmd)
{
/* When threaded, caller already limited stack size so just use the default. */
_size_stack = 1024ULL * (cmd->threaded ? DEFAULT_RESERVED_STACK :
- find_config_tree_int(cmd, activation_reserved_stack_CFG));
- _size_malloc_tmp = find_config_tree_int(cmd, activation_reserved_memory_CFG) * 1024ULL;
- _default_priority = find_config_tree_int(cmd, activation_process_priority_CFG);
+ find_config_tree_int(cmd, activation_reserved_stack_CFG, NULL));
+ _size_malloc_tmp = find_config_tree_int(cmd, activation_reserved_memory_CFG, NULL) * 1024ULL;
+ _default_priority = find_config_tree_int(cmd, activation_process_priority_CFG, NULL);
}
void memlock_reset(void)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index e49b9cb..dcd05d0 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -542,7 +542,7 @@ static int _read_raid_params(struct lvcreate_params *lp,
}
/* No stripe argument was given - default to 2 */
lp->stripes = 2;
- lp->stripe_size = find_config_tree_int(cmd, metadata_stripesize_CFG) * 2;
+ lp->stripe_size = find_config_tree_int(cmd, metadata_stripesize_CFG, NULL) * 2;
}
/*
diff --git a/tools/lvm.c b/tools/lvm.c
index ebce811..51e9293 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -165,7 +165,7 @@ static void _read_history(struct cmd_context *cmd)
if (read_history(hist_file))
log_very_verbose("Couldn't read history from %s.", hist_file);
- stifle_history(find_config_tree_int(cmd, shell_history_size_CFG));
+ stifle_history(find_config_tree_int(cmd, shell_history_size_CFG, NULL));
}
static void _write_history(void)
diff --git a/tools/lvresize.c b/tools/lvresize.c
index 1ba5a5c..bd29bc6 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -306,16 +306,16 @@ static int _adjust_policy_params(struct cmd_context *cmd,
if (lv_is_thin_pool(lv)) {
policy_threshold =
- find_config_tree_int(cmd, activation_thin_pool_autoextend_threshold_CFG) * PERCENT_1;
+ find_config_tree_int(cmd, activation_thin_pool_autoextend_threshold_CFG, NULL) * PERCENT_1;
policy_amount =
- find_config_tree_int(cmd, activation_thin_pool_autoextend_percent_CFG);
+ find_config_tree_int(cmd, activation_thin_pool_autoextend_percent_CFG, NULL);
if (!policy_amount && policy_threshold < PERCENT_100)
return 0;
} else {
policy_threshold =
- find_config_tree_int(cmd, activation_snapshot_autoextend_threshold_CFG) * PERCENT_1;
+ find_config_tree_int(cmd, activation_snapshot_autoextend_threshold_CFG, NULL) * PERCENT_1;
policy_amount =
- find_config_tree_int(cmd, activation_snapshot_autoextend_percent_CFG);
+ find_config_tree_int(cmd, activation_snapshot_autoextend_percent_CFG, NULL);
}
if (policy_threshold >= PERCENT_100)
@@ -754,7 +754,7 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
lp->stripe_size = seg_stripesize;
} else {
lp->stripe_size =
- find_config_tree_int(cmd, metadata_stripesize_CFG) * 2;
+ find_config_tree_int(cmd, metadata_stripesize_CFG, NULL) * 2;
log_print_unless_silent("Using default stripesize %s",
display_size(cmd, (uint64_t) lp->stripe_size));
}
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 5724623..c139d2b 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -319,7 +319,7 @@ int poll_daemon(struct cmd_context *cmd, const char *name, const char *uuid,
if (interval_sign == SIGN_MINUS)
log_error("Argument to --interval cannot be negative");
parms.interval = arg_uint_value(cmd, interval_ARG,
- find_config_tree_int(cmd, activation_polling_interval_CFG));
+ find_config_tree_int(cmd, activation_polling_interval_CFG, NULL));
parms.wait_before_testing = (interval_sign == SIGN_PLUS);
parms.progress_display = 1;
parms.progress_title = progress_title;
@@ -336,7 +336,7 @@ int poll_daemon(struct cmd_context *cmd, const char *name, const char *uuid,
/* FIXME Disabled multiple-copy wait_event */
if (!name)
- parms.interval = find_config_tree_int(cmd, activation_polling_interval_CFG);
+ parms.interval = find_config_tree_int(cmd, activation_polling_interval_CFG, NULL);
}
if (parms.background) {
diff --git a/tools/pvscan.c b/tools/pvscan.c
index a194c68..f4d104a 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -148,7 +148,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
* and to prevent hangs in clustered environment.
*/
/* TODO: Remove this once lvmetad + cluster supported! */
- if (find_config_tree_int(cmd, global_locking_type_CFG) == 3 ||
+ if (find_config_tree_int(cmd, global_locking_type_CFG, NULL) == 3 ||
!find_config_tree_bool(cmd, global_use_lvmetad_CFG)) {
log_debug_lvmetad("_pvscan_lvmetad: immediate return");
return ret;
diff --git a/tools/toollib.c b/tools/toollib.c
index f1ceecb..879e7f9 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1288,7 +1288,7 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
vp_new->vgmetadatacopies = arg_int_value(cmd, vgmetadatacopies_ARG,
DEFAULT_VGMETADATACOPIES);
} else {
- vp_new->vgmetadatacopies = find_config_tree_int(cmd, metadata_vgmetadatacopies_CFG);
+ vp_new->vgmetadatacopies = find_config_tree_int(cmd, metadata_vgmetadatacopies_CFG, NULL);
}
return 1;
@@ -1503,11 +1503,11 @@ int pvcreate_params_validate(struct cmd_context *cmd,
pp->pvmetadatasize = arg_uint64_value(cmd, metadatasize_ARG, UINT64_C(0));
if (!pp->pvmetadatasize)
- pp->pvmetadatasize = find_config_tree_int(cmd, metadata_pvmetadatasize_CFG);
+ pp->pvmetadatasize = find_config_tree_int(cmd, metadata_pvmetadatasize_CFG, NULL);
pp->pvmetadatacopies = arg_int_value(cmd, pvmetadatacopies_ARG, -1);
if (pp->pvmetadatacopies < 0)
- pp->pvmetadatacopies = find_config_tree_int(cmd, metadata_pvmetadatacopies_CFG);
+ pp->pvmetadatacopies = find_config_tree_int(cmd, metadata_pvmetadatacopies_CFG, NULL);
pp->rp.ba_size = arg_uint64_value(cmd, bootloaderareasize_ARG, pp->rp.ba_size);
@@ -1575,7 +1575,7 @@ int get_pool_params(struct cmd_context *cmd, int *passed_args,
log_very_verbose("Setting pool chunk size: %s",
display_size(cmd, *chunk_size));
} else
- *chunk_size = find_config_tree_int(cmd, allocation_thin_pool_chunk_size_CFG) * 2;
+ *chunk_size = find_config_tree_int(cmd, allocation_thin_pool_chunk_size_CFG, NULL) * 2;
if ((*chunk_size < DM_THIN_MIN_DATA_BLOCK_SIZE) ||
(*chunk_size > DM_THIN_MAX_DATA_BLOCK_SIZE)) {
@@ -1653,7 +1653,7 @@ static int _validate_stripe_params(struct cmd_context *cmd, uint32_t *stripes,
}
if (*stripes > 1 && !*stripe_size) {
- *stripe_size = find_config_tree_int(cmd, metadata_stripesize_CFG) * 2;
+ *stripe_size = find_config_tree_int(cmd, metadata_stripesize_CFG, NULL) * 2;
log_print_unless_silent("Using default stripesize %s",
display_size(cmd, (uint64_t) *stripe_size));
}
diff --git a/tools/vgconvert.c b/tools/vgconvert.c
index 3c984d7..fbb1b4e 100644
--- a/tools/vgconvert.c
+++ b/tools/vgconvert.c
@@ -49,12 +49,12 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
UINT64_C(0));
if (!pvmetadatasize)
pvmetadatasize =
- find_config_tree_int(cmd, metadata_pvmetadatasize_CFG);
+ find_config_tree_int(cmd, metadata_pvmetadatasize_CFG, NULL);
pvmetadatacopies = arg_int_value(cmd, pvmetadatacopies_ARG, -1);
if (pvmetadatacopies < 0)
pvmetadatacopies =
- find_config_tree_int(cmd, metadata_pvmetadatacopies_CFG);
+ find_config_tree_int(cmd, metadata_pvmetadatacopies_CFG, NULL);
}
if (cmd->fmt->features & FMT_BAS) {
10 years, 10 months
master - config: add profile arg to find_config_tree_str_allow_empty
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8ac4fcf8ffa4af...
Commit: 8ac4fcf8ffa4af3ee8d524add632f0f3139b929d
Parent: 06dd66af546dfc18a80b6ee574ce91e5d512d2f2
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:30:08 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_str_allow_empty
---
lib/activate/dev_manager.c | 2 +-
lib/commands/toolcontext.c | 2 +-
lib/config/config.c | 14 ++++++++++++--
lib/config/config.h | 2 +-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 7054656..d07e04a 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1560,7 +1560,7 @@ static int _thin_pool_callback(struct dm_tree_node *node,
const struct dm_config_node *cn;
const struct dm_config_value *cv;
const char *thin_check =
- find_config_tree_str_allow_empty(data->pool_lv->vg->cmd, global_thin_check_executable_CFG);
+ find_config_tree_str_allow_empty(data->pool_lv->vg->cmd, global_thin_check_executable_CFG, NULL);
const struct logical_volume *mlv = first_seg(data->pool_lv)->metadata_lv;
size_t len = strlen(dmdir) + 2 * (strlen(mlv->vg->name) + strlen(mlv->name)) + 3;
char meta_path[len];
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index c593f5e..f5b8d48 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -202,7 +202,7 @@ static void _init_logging(struct cmd_context *cmd)
init_indent(find_config_tree_bool(cmd, log_indent_CFG));
init_abort_on_internal_errors(find_config_tree_bool(cmd, global_abort_on_internal_errors_CFG));
- cmd->default_settings.msg_prefix = find_config_tree_str_allow_empty(cmd, log_prefix_CFG);
+ cmd->default_settings.msg_prefix = find_config_tree_str_allow_empty(cmd, log_prefix_CFG, NULL);
init_msg_prefix(cmd->default_settings.msg_prefix);
cmd->default_settings.cmd_name = find_config_tree_bool(cmd, log_command_names_CFG);
diff --git a/lib/config/config.c b/lib/config/config.c
index 5267424..1576153 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -821,17 +821,27 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile
return str;
}
-const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id)
+const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
const char *path = cfg_def_get_path(item);
+ int profile_applied = 0;
+ const char *str;
if (item->type != CFG_TYPE_STRING)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
if (!(item->flags & CFG_ALLOW_EMPTY))
log_error(INTERNAL_ERROR "%s cfg tree element not declared to allow empty values.", path);
- return dm_config_tree_find_str_allow_empty(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_STRING));
+ if (profile && !cmd->profile_params->global_profile)
+ profile_applied = override_config_tree_from_profile(cmd, profile);
+
+ str = dm_config_tree_find_str_allow_empty(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_STRING));
+
+ if (profile_applied)
+ remove_config_tree_by_source(cmd, CONFIG_PROFILE);
+
+ return str;
}
int find_config_tree_int(struct cmd_context *cmd, int id)
diff --git a/lib/config/config.h b/lib/config/config.h
index 6c6089e..56ed4ea 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -166,7 +166,7 @@ int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft,
*/
const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile);
const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile);
-const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id);
+const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile);
int find_config_tree_int(struct cmd_context *cmd, int id);
int64_t find_config_tree_int64(struct cmd_context *cmd, int id);
float find_config_tree_float(struct cmd_context *cmd, int id);
10 years, 10 months
master - config: add profile arg to find_config_tree_str
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=06dd66af546dfc...
Commit: 06dd66af546dfc18a80b6ee574ce91e5d512d2f2
Parent: eeb7b0f7faeced4dbaa664b4857275e7c7a9e2a8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:29:54 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_str
---
daemons/clvmd/lvm-functions.c | 2 +-
lib/activate/activate.c | 2 +-
lib/commands/toolcontext.c | 28 ++++++++++++++--------------
lib/config/config.c | 14 ++++++++++++--
lib/config/config.h | 2 +-
lib/locking/external_locking.c | 2 +-
lib/locking/file_locking.c | 2 +-
lib/mirror/mirrored.c | 2 +-
lib/misc/sharedlib.c | 2 +-
lib/raid/raid.c | 2 +-
lib/snapshot/snapshot.c | 2 +-
lib/thin/thin.c | 2 +-
tools/lvconvert.c | 11 ++++++-----
tools/lvcreate.c | 4 ++--
tools/reporter.c | 32 ++++++++++++++++----------------
tools/toollib.c | 2 +-
16 files changed, 61 insertions(+), 50 deletions(-)
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index c7f3488..5be9ee1 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -811,7 +811,7 @@ static void check_config(void)
if (locking_type == 2) { /* External library, check name */
const char *libname;
- libname = find_config_tree_str(cmd, global_locking_library_CFG);
+ libname = find_config_tree_str(cmd, global_locking_library_CFG, NULL);
if (libname && strstr(libname, "liblvm2clusterlock.so"))
return;
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 5a4b111..2f1718b 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1286,7 +1286,7 @@ static struct dm_event_handler *_create_dm_event_handler(struct cmd_context *cmd
if (!(dmevh = dm_event_handler_create()))
return_NULL;
- if (dm_event_handler_set_dmeventd_path(dmevh, find_config_tree_str(cmd, dmeventd_executable_CFG)))
+ if (dm_event_handler_set_dmeventd_path(dmevh, find_config_tree_str(cmd, dmeventd_executable_CFG, NULL)))
goto_bad;
if (dm_event_handler_set_dso(dmevh, dso))
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 53cda72..c593f5e 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -217,7 +217,7 @@ static void _init_logging(struct cmd_context *cmd)
if (find_config_tree_bool(cmd, log_overwrite_CFG))
append = 0;
- log_file = find_config_tree_str(cmd, log_file_CFG);
+ log_file = find_config_tree_str(cmd, log_file_CFG, NULL);
if (log_file) {
release_log_memory();
@@ -225,7 +225,7 @@ static void _init_logging(struct cmd_context *cmd)
init_log_file(log_file, append);
}
- log_file = find_config_tree_str(cmd, log_activate_file_CFG);
+ log_file = find_config_tree_str(cmd, log_activate_file_CFG, NULL);
if (log_file)
init_log_direct(log_file, append);
@@ -290,7 +290,7 @@ static int _process_config(struct cmd_context *cmd)
/* dev dir */
if (dm_snprintf(cmd->dev_dir, sizeof(cmd->dev_dir), "%s/",
- find_config_tree_str(cmd, devices_dir_CFG)) < 0) {
+ find_config_tree_str(cmd, devices_dir_CFG, NULL)) < 0) {
log_error("Device directory given in config file too long");
return 0;
}
@@ -303,7 +303,7 @@ static int _process_config(struct cmd_context *cmd)
/* proc dir */
if (dm_snprintf(cmd->proc_dir, sizeof(cmd->proc_dir), "%s",
- find_config_tree_str(cmd, global_proc_CFG)) < 0) {
+ find_config_tree_str(cmd, global_proc_CFG, NULL)) < 0) {
log_error("Device directory given in config file too long");
return 0;
}
@@ -324,13 +324,13 @@ static int _process_config(struct cmd_context *cmd)
cmd->default_settings.suffix = find_config_tree_bool(cmd, global_suffix_CFG);
if (!(cmd->default_settings.unit_factor =
- units_to_bytes(find_config_tree_str(cmd, global_units_CFG),
+ units_to_bytes(find_config_tree_str(cmd, global_units_CFG, NULL),
&cmd->default_settings.unit_type))) {
log_error("Invalid units specification");
return 0;
}
- read_ahead = find_config_tree_str(cmd, activation_readahead_CFG);
+ read_ahead = find_config_tree_str(cmd, activation_readahead_CFG, NULL);
if (!strcasecmp(read_ahead, "auto"))
cmd->default_settings.read_ahead = DM_READ_AHEAD_AUTO;
else if (!strcasecmp(read_ahead, "none"))
@@ -369,7 +369,7 @@ static int _process_config(struct cmd_context *cmd)
cmd->use_linear_target = find_config_tree_bool(cmd, activation_use_linear_target_CFG);
- cmd->stripe_filler = find_config_tree_str(cmd, activation_missing_stripe_filler_CFG);
+ cmd->stripe_filler = find_config_tree_str(cmd, activation_missing_stripe_filler_CFG, NULL);
/* FIXME Missing error code checks from the stats, not log_warn?, notify if setting overridden, delay message/check till it is actually used (eg consider if lvm shell - file could appear later after this check)? */
if (!strcmp(cmd->stripe_filler, "/dev/ioerror") &&
@@ -606,7 +606,7 @@ static int _init_profiles(struct cmd_context *cmd)
return 0;
}
- if (!(dir = find_config_tree_str(cmd, config_profile_dir_CFG))) {
+ 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'.",
@@ -890,8 +890,8 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
/*
* If 'cache_dir' or 'cache_file_prefix' is set, ignore 'cache'.
*/
- cache_dir = find_config_tree_str(cmd, devices_cache_dir_CFG);
- cache_file_prefix = find_config_tree_str(cmd, devices_cache_file_prefix_CFG);
+ cache_dir = find_config_tree_str(cmd, devices_cache_dir_CFG, NULL);
+ cache_file_prefix = find_config_tree_str(cmd, devices_cache_file_prefix_CFG, NULL);
if (cache_dir || cache_file_prefix) {
if (dm_snprintf(cache_file, sizeof(cache_file),
@@ -903,7 +903,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
log_error("Persistent cache filename too long.");
goto bad;
}
- } else if (!(dev_cache = find_config_tree_str(cmd, devices_cache_CFG)) &&
+ } else if (!(dev_cache = find_config_tree_str(cmd, devices_cache_CFG, NULL)) &&
(dm_snprintf(cache_file, sizeof(cache_file),
"%s/%s/%s.cache",
cmd->system_dir, DEFAULT_CACHE_SUBDIR,
@@ -1044,7 +1044,7 @@ static int _init_formats(struct cmd_context *cmd)
cmd->fmt_backup = fmt;
- format = find_config_tree_str(cmd, global_format_CFG);
+ format = find_config_tree_str(cmd, global_format_CFG, NULL);
dm_list_iterate_items(fmt, &cmd->formats) {
if (!strcasecmp(fmt->name, format) ||
@@ -1267,7 +1267,7 @@ static int _init_backup(struct cmd_context *cmd)
return 0;
}
- if (!(dir = find_config_tree_str(cmd, backup_archive_dir_CFG)))
+ if (!(dir = find_config_tree_str(cmd, backup_archive_dir_CFG, NULL)))
dir = default_dir;
if (!archive_init(cmd, dir, days, min,
@@ -1287,7 +1287,7 @@ static int _init_backup(struct cmd_context *cmd)
return 0;
}
- if (!(dir = find_config_tree_str(cmd, backup_backup_dir_CFG)))
+ if (!(dir = find_config_tree_str(cmd, backup_backup_dir_CFG, NULL)))
dir = default_dir;
if (!backup_init(cmd, dir, cmd->default_settings.backup)) {
diff --git a/lib/config/config.c b/lib/config/config.c
index 8bb9be9..5267424 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -800,15 +800,25 @@ const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int
return cn;
}
-const char *find_config_tree_str(struct cmd_context *cmd, int id)
+const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
const char *path = cfg_def_get_path(item);
+ int profile_applied = 0;
+ const char *str;
if (item->type != CFG_TYPE_STRING)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
- return dm_config_tree_find_str(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_STRING));
+ if (profile && !cmd->profile_params->global_profile)
+ profile_applied = override_config_tree_from_profile(cmd, profile);
+
+ str = dm_config_tree_find_str(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_STRING));
+
+ if (profile_applied)
+ remove_config_tree_by_source(cmd, CONFIG_PROFILE);
+
+ return str;
}
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id)
diff --git a/lib/config/config.h b/lib/config/config.h
index 6f3cabd..6c6089e 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -165,7 +165,7 @@ int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft,
* These versions check an override tree, if present, first.
*/
const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile);
-const char *find_config_tree_str(struct cmd_context *cmd, int id);
+const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile);
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id);
int find_config_tree_int(struct cmd_context *cmd, int id);
int64_t find_config_tree_int64(struct cmd_context *cmd, int id);
diff --git a/lib/locking/external_locking.c b/lib/locking/external_locking.c
index d5c39d7..8b63a29 100644
--- a/lib/locking/external_locking.c
+++ b/lib/locking/external_locking.c
@@ -80,7 +80,7 @@ int init_external_locking(struct locking_type *locking, struct cmd_context *cmd,
locking->reset_locking = _reset_external_locking;
locking->flags = 0;
- if (!(libname = find_config_tree_str(cmd, global_locking_library_CFG)))
+ if (!(libname = find_config_tree_str(cmd, global_locking_library_CFG, NULL)))
libname = DEFAULT_LOCKING_LIB;
if (!(_locking_lib = load_shared_library(cmd, libname, "locking", 1)))
diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c
index 934bfe2..9cfd8eb 100644
--- a/lib/locking/file_locking.c
+++ b/lib/locking/file_locking.c
@@ -346,7 +346,7 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd,
locking->flags = 0;
/* Get lockfile directory from config file */
- locking_dir = find_config_tree_str(cmd, global_locking_dir_CFG);
+ locking_dir = find_config_tree_str(cmd, global_locking_dir_CFG, NULL);
if (strlen(locking_dir) >= sizeof(_lock_dir)) {
log_error("Path for locking_dir %s is invalid.", locking_dir);
return 0;
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index 6ce929d..c3eb27b 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -540,7 +540,7 @@ static int _mirrored_target_present(struct cmd_context *cmd,
#ifdef DMEVENTD
static const char *_get_mirror_dso_path(struct cmd_context *cmd)
{
- return get_monitor_dso_path(cmd, find_config_tree_str(cmd, dmeventd_mirror_library_CFG));
+ return get_monitor_dso_path(cmd, find_config_tree_str(cmd, dmeventd_mirror_library_CFG, NULL));
}
/* FIXME Cache this */
diff --git a/lib/misc/sharedlib.c b/lib/misc/sharedlib.c
index b899781..fca079b 100644
--- a/lib/misc/sharedlib.c
+++ b/lib/misc/sharedlib.c
@@ -30,7 +30,7 @@ void get_shared_library_path(struct cmd_context *cmd, const char *libname,
/* If libname doesn't begin with '/' then use lib_dir/libname,
* if present */
if (libname[0] == '/' ||
- !(lib_dir = find_config_tree_str(cmd, global_library_dir_CFG)) ||
+ !(lib_dir = find_config_tree_str(cmd, global_library_dir_CFG, NULL)) ||
(dm_snprintf(path, path_len, "%s/%s", lib_dir,
libname) == -1) || stat(path, &info) == -1) {
strncpy(path, libname, path_len - 1);
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index bc00691..6d627fe 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -343,7 +343,7 @@ static void _raid_destroy(struct segment_type *segtype)
#ifdef DMEVENTD
static const char *_get_raid_dso_path(struct cmd_context *cmd)
{
- const char *config_str = find_config_tree_str(cmd, dmeventd_raid_library_CFG);
+ const char *config_str = find_config_tree_str(cmd, dmeventd_raid_library_CFG, NULL);
return get_monitor_dso_path(cmd, config_str);
}
diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c
index 453d96a..506d618 100644
--- a/lib/snapshot/snapshot.c
+++ b/lib/snapshot/snapshot.c
@@ -171,7 +171,7 @@ static int _snap_target_present(struct cmd_context *cmd,
static const char *_get_snapshot_dso_path(struct cmd_context *cmd)
{
- return get_monitor_dso_path(cmd, find_config_tree_str(cmd, dmeventd_snapshot_library_CFG));
+ return get_monitor_dso_path(cmd, find_config_tree_str(cmd, dmeventd_snapshot_library_CFG, NULL));
}
/* FIXME Cache this */
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index f4f785f..1867ef9 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -379,7 +379,7 @@ static int _thin_pool_target_percent(void **target_state __attribute__((unused))
# ifdef DMEVENTD
static const char *_get_thin_dso_path(struct cmd_context *cmd)
{
- return get_monitor_dso_path(cmd, find_config_tree_str(cmd, dmeventd_thin_library_CFG));
+ return get_monitor_dso_path(cmd, find_config_tree_str(cmd, dmeventd_thin_library_CFG, NULL));
}
/* FIXME Cache this */
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 650b1be..ffdc3f4 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -488,7 +488,8 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
if (!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size))
return_0;
- lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, find_config_tree_str(cmd, global_mirror_segtype_default_CFG)));
+ lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG,
+ find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL)));
if (!lp->segtype)
return_0;
}
@@ -859,10 +860,10 @@ static void _lvconvert_mirrors_repair_ask(struct cmd_context *cmd,
*replace_log = *replace_mirrors = 1;
if (arg_count(cmd, use_policies_ARG)) {
- leg_policy = find_config_tree_str(cmd, activation_mirror_image_fault_policy_CFG);
+ 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);
- log_policy = find_config_tree_str(cmd, activation_mirror_log_fault_policy_CFG);
+ 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");
return;
@@ -1585,7 +1586,7 @@ static void _lvconvert_raid_repair_ask(struct cmd_context *cmd, int *replace_dev
*replace_dev = 1;
if (arg_count(cmd, use_policies_ARG)) {
- dev_policy = find_config_tree_str(cmd, activation_raid_fault_policy_CFG);
+ dev_policy = find_config_tree_str(cmd, activation_raid_fault_policy_CFG, NULL);
if (!strcmp(dev_policy, "allocate") ||
!strcmp(dev_policy, "replace"))
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 057ccd5..e49b9cb 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -724,9 +724,9 @@ static int _lvcreate_params(struct lvcreate_params *lp,
if (arg_count(cmd, mirrors_ARG))
if (arg_uint_value(cmd, arg_count(cmd, stripes_long_ARG) ?
stripes_long_ARG : stripes_ARG, 1) > 1) {
- segtype_str = find_config_tree_str(cmd, global_raid10_segtype_default_CFG);;
+ segtype_str = find_config_tree_str(cmd, global_raid10_segtype_default_CFG, NULL);;
} else {
- segtype_str = find_config_tree_str(cmd, global_mirror_segtype_default_CFG);
+ segtype_str = find_config_tree_str(cmd, global_mirror_segtype_default_CFG, NULL);
}
else if (arg_count(cmd, thin_ARG) || arg_count(cmd, thinpool_ARG))
segtype_str = "thin";
diff --git a/tools/reporter.c b/tools/reporter.c
index 6e78355..53a7883 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -225,7 +225,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
aligned = find_config_tree_bool(cmd, report_aligned_CFG);
buffered = find_config_tree_bool(cmd, report_buffered_CFG);
headings = find_config_tree_bool(cmd, report_headings_CFG);
- separator = find_config_tree_str(cmd, report_separator_CFG);
+ separator = find_config_tree_str(cmd, report_separator_CFG, NULL);
field_prefixes = find_config_tree_bool(cmd, report_prefixes_CFG);
quoted = find_config_tree_bool(cmd, report_quoted_CFG);
columns_as_rows = find_config_tree_bool(cmd, report_colums_as_rows_CFG);
@@ -236,40 +236,40 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
switch (report_type) {
case LVS:
- keys = find_config_tree_str(cmd, report_lvs_sort_CFG);
+ keys = find_config_tree_str(cmd, report_lvs_sort_CFG, NULL);
if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_lvs_cols_CFG);
+ options = find_config_tree_str(cmd, report_lvs_cols_CFG, NULL);
else
- options = find_config_tree_str(cmd, report_lvs_cols_verbose_CFG);
+ options = find_config_tree_str(cmd, report_lvs_cols_verbose_CFG, NULL);
break;
case VGS:
- keys = find_config_tree_str(cmd, report_vgs_sort_CFG);
+ keys = find_config_tree_str(cmd, report_vgs_sort_CFG, NULL);
if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_vgs_cols_CFG);
+ options = find_config_tree_str(cmd, report_vgs_cols_CFG, NULL);
else
- options = find_config_tree_str(cmd, report_vgs_cols_verbose_CFG);
+ options = find_config_tree_str(cmd, report_vgs_cols_verbose_CFG, NULL);
break;
case LABEL:
case PVS:
- keys = find_config_tree_str(cmd, report_pvs_sort_CFG);
+ keys = find_config_tree_str(cmd, report_pvs_sort_CFG, NULL);
if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_pvs_cols_CFG);
+ options = find_config_tree_str(cmd, report_pvs_cols_CFG, NULL);
else
- options = find_config_tree_str(cmd, report_pvs_cols_verbose_CFG);
+ options = find_config_tree_str(cmd, report_pvs_cols_verbose_CFG, NULL);
break;
case SEGS:
- keys = find_config_tree_str(cmd, report_segs_sort_CFG);
+ keys = find_config_tree_str(cmd, report_segs_sort_CFG, NULL);
if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_segs_cols_CFG);
+ options = find_config_tree_str(cmd, report_segs_cols_CFG, NULL);
else
- options = find_config_tree_str(cmd, report_segs_cols_verbose_CFG);
+ options = find_config_tree_str(cmd, report_segs_cols_verbose_CFG, NULL);
break;
case PVSEGS:
- keys = find_config_tree_str(cmd, report_pvsegs_sort_CFG);
+ keys = find_config_tree_str(cmd, report_pvsegs_sort_CFG, NULL);
if (!arg_count(cmd, verbose_ARG))
- options = find_config_tree_str(cmd, report_pvsegs_cols_CFG);
+ options = find_config_tree_str(cmd, report_pvsegs_cols_CFG, NULL);
else
- options = find_config_tree_str(cmd, report_pvsegs_cols_verbose_CFG);
+ options = find_config_tree_str(cmd, report_pvsegs_cols_verbose_CFG, NULL);
break;
default:
log_error(INTERNAL_ERROR "Unknown report type.");
diff --git a/tools/toollib.c b/tools/toollib.c
index 5853800..f1ceecb 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1559,7 +1559,7 @@ int get_pool_params(struct cmd_context *cmd, int *passed_args,
log_very_verbose("Setting pool discards: %s",
get_pool_discards_name(*discards));
} else {
- dstr = find_config_tree_str(cmd, allocation_thin_pool_discards_CFG);
+ dstr = find_config_tree_str(cmd, allocation_thin_pool_discards_CFG, NULL);
if (!get_pool_discards(dstr, discards))
return_0;
}
10 years, 10 months
master - config: add profile arg to find_config_tree_node
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=eeb7b0f7faeced...
Commit: eeb7b0f7faeced4dbaa664b4857275e7c7a9e2a8
Parent: c5e6bc393e2d6d8477b115b57697200265aaa595
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:29:33 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
config: add profile arg to find_config_tree_node
---
lib/activate/activate.c | 6 +++---
lib/activate/dev_manager.c | 2 +-
lib/commands/toolcontext.c | 24 ++++++++++++------------
lib/config/config.c | 15 +++++++++++++--
lib/config/config.h | 2 +-
lib/device/dev-cache.c | 2 +-
lib/format_text/format-text.c | 4 ++--
lib/metadata/lv_manip.c | 2 +-
lib/mm/memlock.c | 2 +-
lib/thin/thin.c | 2 +-
10 files changed, 36 insertions(+), 25 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 2cdda49..5a4b111 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -430,7 +430,7 @@ static int _passes_activation_filter(struct cmd_context *cmd,
{
const struct dm_config_node *cn;
- if (!(cn = find_config_tree_node(cmd, activation_volume_list_CFG))) {
+ if (!(cn = find_config_tree_node(cmd, activation_volume_list_CFG, NULL))) {
log_verbose("activation/volume_list configuration setting "
"not defined: Checking only host tags for %s/%s",
lv->vg->name, lv->name);
@@ -459,7 +459,7 @@ static int _passes_readonly_filter(struct cmd_context *cmd,
{
const struct dm_config_node *cn;
- if (!(cn = find_config_tree_node(cmd, activation_read_only_volume_list_CFG)))
+ if (!(cn = find_config_tree_node(cmd, activation_read_only_volume_list_CFG, NULL)))
return 0;
return _lv_passes_volumes_filter(cmd, lv, cn, activation_read_only_volume_list_CFG);
@@ -470,7 +470,7 @@ int lv_passes_auto_activation_filter(struct cmd_context *cmd, struct logical_vol
{
const struct dm_config_node *cn;
- if (!(cn = find_config_tree_node(cmd, activation_auto_activation_volume_list_CFG))) {
+ if (!(cn = find_config_tree_node(cmd, activation_auto_activation_volume_list_CFG, NULL))) {
log_verbose("activation/auto_activation_volume_list configuration setting "
"not defined: All logical volumes will be auto-activated.");
return 1;
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index e471f95..7054656 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1578,7 +1578,7 @@ static int _thin_pool_callback(struct dm_tree_node *node,
return 0;
}
- if ((cn = find_config_tree_node(mlv->vg->cmd, global_thin_check_options_CFG))) {
+ if ((cn = find_config_tree_node(mlv->vg->cmd, global_thin_check_options_CFG, NULL))) {
for (cv = cn->v; cv && args < 16; cv = cv->next) {
if (cv->type != DM_CFG_STRING) {
log_error("Invalid string in config file: "
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index f8b861b..53cda72 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -129,7 +129,7 @@ static int _parse_debug_classes(struct cmd_context *cmd)
const struct dm_config_value *cv;
int debug_classes = 0;
- if (!(cn = find_config_tree_node(cmd, log_debug_classes_CFG)))
+ if (!(cn = find_config_tree_node(cmd, log_debug_classes_CFG, NULL)))
return DEFAULT_LOGGED_DEBUG_CLASSES;
for (cv = cn->v; cv; cv = cv->next) {
@@ -393,7 +393,7 @@ static int _process_config(struct cmd_context *cmd)
cmd->si_unit_consistency = find_config_tree_bool(cmd, global_si_unit_consistency_CFG);
- if ((cn = find_config_tree_node(cmd, activation_mlock_filter_CFG)))
+ if ((cn = find_config_tree_node(cmd, activation_mlock_filter_CFG, NULL)))
for (cv = cn->v; cv; cv = cv->next)
if ((cv->type != DM_CFG_STRING) || !cv->v.str[0])
log_error("Ignoring invalid activation/mlock_filter entry in config file");
@@ -423,7 +423,7 @@ static int _process_config(struct cmd_context *cmd)
DEFAULT_RUN_DIR "/lvmetad.socket");
*/
lvmetad_set_socket(lvmetad_socket);
- cn = find_config_tree_node(cmd, devices_global_filter_CFG);
+ cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL);
lvmetad_set_token(cn ? cn->v : NULL);
if (find_config_tree_int(cmd, global_locking_type_CFG) == 3 &&
@@ -493,7 +493,7 @@ static int _init_tags(struct cmd_context *cmd, struct dm_config_tree *cft)
const char *tag;
int passes;
- if (!(tn = find_config_tree_node(cmd, tags_CFG_SECTION)) || !tn->child)
+ if (!(tn = find_config_tree_node(cmd, tags_CFG_SECTION, NULL)) || !tn->child)
return 1;
/* NB hosttags 0 when already 1 intentionally does not delete the tag */
@@ -734,7 +734,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
init_obtain_device_list_from_udev(device_list_from_udev);
- if (!(cn = find_config_tree_node(cmd, devices_scan_CFG))) {
+ if (!(cn = find_config_tree_node(cmd, devices_scan_CFG, NULL))) {
if (!dev_cache_add_dir("/dev")) {
log_error("Failed to add /dev to internal "
"device cache");
@@ -780,7 +780,7 @@ static int _init_dev_cache(struct cmd_context *cmd)
}
}
- if (!(cn = find_config_tree_node(cmd, devices_loopfiles_CFG)))
+ if (!(cn = find_config_tree_node(cmd, devices_loopfiles_CFG, NULL)))
return 1;
for (cv = cn->v; cv; cv = cv->next) {
@@ -827,7 +827,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
}
/* regex filter. Optional. */
- if (!(cn = find_config_tree_node(cmd, devices_filter_CFG)))
+ if (!(cn = find_config_tree_node(cmd, devices_filter_CFG, NULL)))
log_very_verbose("devices/filter not found in config file: "
"no regex filter installed");
@@ -941,7 +941,7 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
log_verbose("Failed to load existing device cache from %s",
dev_cache);
- if (!(cn = find_config_tree_node(cmd, devices_global_filter_CFG))) {
+ if (!(cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL))) {
cmd->filter = f4;
} else if (!(cmd->lvmetad_filter = regex_filter_create(cn->v)))
goto_bad;
@@ -1003,7 +1003,7 @@ static int _init_formats(struct cmd_context *cmd)
#ifdef HAVE_LIBDL
/* Load any formats in shared libs if not static */
if (!is_static() &&
- (cn = find_config_tree_node(cmd, global_format_libraries_CFG))) {
+ (cn = find_config_tree_node(cmd, global_format_libraries_CFG, NULL))) {
const struct dm_config_value *cv;
struct format_type *(*init_format_fn) (struct cmd_context *);
@@ -1165,7 +1165,7 @@ static int _init_segtypes(struct cmd_context *cmd)
#ifdef HAVE_LIBDL
/* Load any formats in shared libs unless static */
if (!is_static() &&
- (cn = find_config_tree_node(cmd, global_segment_libraries_CFG))) {
+ (cn = find_config_tree_node(cmd, global_segment_libraries_CFG, NULL))) {
const struct dm_config_value *cv;
int (*init_multiple_segtypes_fn) (struct cmd_context *,
@@ -1472,7 +1472,7 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
goto_out;
if (!(cmd->dev_types = create_dev_types(cmd->proc_dir,
- find_config_tree_node(cmd, devices_types_CFG))))
+ find_config_tree_node(cmd, devices_types_CFG, NULL))))
goto_out;
if (!_init_dev_cache(cmd))
@@ -1660,7 +1660,7 @@ int refresh_toolcontext(struct cmd_context *cmd)
return 0;
if (!(cmd->dev_types = create_dev_types(cmd->proc_dir,
- find_config_tree_node(cmd, devices_types_CFG))))
+ find_config_tree_node(cmd, devices_types_CFG, NULL))))
return 0;
if (!_init_dev_cache(cmd))
diff --git a/lib/config/config.c b/lib/config/config.c
index 1a14a38..8bb9be9 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -784,9 +784,20 @@ out:
return r;
}
-const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id)
+const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile)
{
- return dm_config_tree_find_node(cmd->cft, cfg_def_get_path(cfg_def_get_item_p(id)));
+ int profile_applied = 0;
+ const struct dm_config_node *cn;
+
+ if (profile && !cmd->profile_params->global_profile)
+ profile_applied = override_config_tree_from_profile(cmd, profile);
+
+ cn = dm_config_tree_find_node(cmd->cft, cfg_def_get_path(cfg_def_get_item_p(id)));
+
+ if (profile_applied)
+ remove_config_tree_by_source(cmd, CONFIG_PROFILE);
+
+ return cn;
}
const char *find_config_tree_str(struct cmd_context *cmd, int id)
diff --git a/lib/config/config.h b/lib/config/config.h
index 0e4c0d5..6f3cabd 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -164,7 +164,7 @@ int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft,
/*
* These versions check an override tree, if present, first.
*/
-const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id);
+const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile);
const char *find_config_tree_str(struct cmd_context *cmd, int id);
const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id);
int find_config_tree_int(struct cmd_context *cmd, int id);
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 9981967..24046ca 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -676,7 +676,7 @@ static int _init_preferred_names(struct cmd_context *cmd)
_cache.preferred_names_matcher = NULL;
- if (!(cn = find_config_tree_node(cmd, devices_preferred_names_CFG)) ||
+ if (!(cn = find_config_tree_node(cmd, devices_preferred_names_CFG, NULL)) ||
cn->v->type == DM_CFG_EMPTY_ARRAY) {
log_very_verbose("devices/preferred_names not found in config file: "
"using built-in preferences");
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index fae3ad7..96c4f8b 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -2439,7 +2439,7 @@ struct format_type *create_text_format(struct cmd_context *cmd)
goto bad;
}
- if ((cn = find_config_tree_node(cmd, metadata_dirs_CFG))) {
+ if ((cn = find_config_tree_node(cmd, metadata_dirs_CFG, NULL))) {
for (cv = cn->v; cv; cv = cv->next) {
if (cv->type != DM_CFG_STRING) {
log_error("Invalid string in config file: "
@@ -2456,7 +2456,7 @@ struct format_type *create_text_format(struct cmd_context *cmd)
}
}
- if ((cn = find_config_tree_node(cmd, metadata_disk_areas_CFG))) {
+ if ((cn = find_config_tree_node(cmd, metadata_disk_areas_CFG, NULL))) {
for (cn = cn->child; cn; cn = cn->sib) {
if (!_get_config_disk_area(cmd, cn, &mda_lists->raws))
goto_bad;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 8acca49..ef7c75a 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1055,7 +1055,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->parallel_areas = parallel_areas;
- ah->cling_tag_list_cn = find_config_tree_node(cmd, allocation_cling_tag_list_CFG);
+ ah->cling_tag_list_cn = find_config_tree_node(cmd, allocation_cling_tag_list_CFG, NULL);
ah->maximise_cling = find_config_tree_bool(cmd, allocation_maximise_cling_CFG);
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index fda3bb8..d2cb61c 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -293,7 +293,7 @@ static int _memlock_maps(struct cmd_context *cmd, lvmlock_t lock, size_t *mstats
}
line = _maps_buffer;
- cn = find_config_tree_node(cmd, activation_mlock_filter_CFG);
+ cn = find_config_tree_node(cmd, activation_mlock_filter_CFG, NULL);
while ((line_end = strchr(line, '\n'))) {
*line_end = '\0'; /* remove \n */
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 116b7e1..f4f785f 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -601,7 +601,7 @@ static int _thin_target_present(struct cmd_context *cmd,
if (attributes) {
if (!_feature_mask) {
/* Support runtime lvm.conf changes, N.B. avoid 32 feature */
- if ((cn = find_config_tree_node(cmd, global_thin_disabled_features_CFG))) {
+ if ((cn = find_config_tree_node(cmd, global_thin_disabled_features_CFG, NULL))) {
for (cv = cn->v; cv; cv = cv->next) {
if (cv->type != DM_CFG_STRING) {
log_error("Ignoring invalid string in config file %s.",
10 years, 10 months
master - metadata: read VG/LV profile name from metadata if it exists and load it
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c5e6bc393e2d6d...
Commit: c5e6bc393e2d6d8477b115b57697200265aaa595
Parent: bfde83eb345621821332a8daeaa3aa6b82da69ea
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:28:36 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:09 2013 +0200
metadata: read VG/LV profile name from metadata if it exists and load it
This is per VG/LV profile loading on demand. The profile itself is saved
in struct volume_group/logical_volume as "profile" field so we can
reference it whenever needed.
---
lib/format_text/import_vsn1.c | 28 ++++++++++++++++++++++++----
lib/metadata/lv.h | 1 +
lib/metadata/vg.h | 1 +
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 99dd52a..54a4a9c 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -525,7 +525,7 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
{
struct dm_pool *mem = vg->vgmem;
struct logical_volume *lv;
- const char *lv_alloc;
+ const char *str;
const struct dm_config_value *cv;
const char *hostname;
uint64_t timestamp = 0;
@@ -565,14 +565,25 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)),
}
lv->alloc = ALLOC_INHERIT;
- if (dm_config_get_str(lvn, "allocation_policy", &lv_alloc)) {
- lv->alloc = get_alloc_from_string(lv_alloc);
+ if (dm_config_get_str(lvn, "allocation_policy", &str)) {
+ lv->alloc = get_alloc_from_string(str);
if (lv->alloc == ALLOC_INVALID) {
- log_warn("WARNING: Ignoring unrecognised allocation policy %s for LV %s", lv_alloc, lv->name);
+ log_warn("WARNING: Ignoring unrecognised allocation policy %s for LV %s", str, lv->name);
lv->alloc = ALLOC_INHERIT;
}
}
+ if (dm_config_get_str(lvn, "profile", &str)) {
+ log_debug_metadata("Adding profile configuration %s for LV %s/%s.",
+ str, vg->name, lv->name);
+ lv->profile = add_profile(vg->cmd, str);
+ if (!lv->profile) {
+ log_error("Failed to add configuration profile %s for LV %s/%s",
+ str, vg->name, lv->name);
+ return 0;
+ }
+ }
+
if (!_read_int32(lvn, "read_ahead", &lv->read_ahead))
/* If not present, choice of auto or none is configurable */
lv->read_ahead = vg->cmd->default_settings.read_ahead;
@@ -789,6 +800,15 @@ static struct volume_group *_read_vg(struct format_instance *fid,
}
}
+ if (dm_config_get_str(vgn, "profile", &str)) {
+ log_debug_metadata("Adding profile configuration %s for VG %s.", str, vg->name);
+ vg->profile = add_profile(vg->cmd, str);
+ if (!vg->profile) {
+ log_error("Failed to add configuration profile %s for VG %s", str, vg->name);
+ goto bad;
+ }
+ }
+
if (!_read_uint32(vgn, "metadata_copies", &vg->mda_copies)) {
vg->mda_copies = DEFAULT_VGMETADATACOPIES;
}
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index b1cce51..b123109 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -30,6 +30,7 @@ struct logical_volume {
uint64_t status;
alloc_policy_t alloc;
+ struct profile *profile;
uint32_t read_ahead;
int32_t major;
int32_t minor;
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index 0dc3ba7..f33fe11 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -58,6 +58,7 @@ struct volume_group {
struct volume_group *vg_ondisk;
alloc_policy_t alloc;
+ struct profile *profile;
uint64_t status;
struct id id;
10 years, 10 months
master - config: add override_config_tree_from_profile fn to add the profile to a configuration cascade
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bfde83eb345621...
Commit: bfde83eb345621821332a8daeaa3aa6b82da69ea
Parent: ebc236d085116e869b5873e2b5409674c2cd2a8d
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:27:37 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:08 2013 +0200
config: add override_config_tree_from_profile fn to add the profile to a configuration cascade
When placing the profile in a configuration cascade, this sequence is
used exactly:
CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/MERGED_FILES
So if the profile is used, it overloads the lvm.conf (and any
existing tag configs). However, if "--config" is used to define
a custom configuration on command line, this overloads even the
profile config!
---
lib/config/config.c | 35 ++++++++++++++++++++++++++++++++++-
lib/config/config.h | 1 +
tools/lvmcmdline.c | 4 ++++
3 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index 5711ead..1a14a38 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -301,7 +301,7 @@ int override_config_tree_from_string(struct cmd_context *cmd,
/*
* Follow this sequence:
- * CONFIG_STRING -> CONFIG_FILE/CONFIG_MERGED_FILES
+ * CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/CONFIG_MERGED_FILES
*/
if (cs->type == CONFIG_STRING) {
@@ -329,6 +329,39 @@ int override_config_tree_from_string(struct cmd_context *cmd,
return 1;
}
+int override_config_tree_from_profile(struct cmd_context *cmd,
+ struct profile *profile)
+{
+ struct dm_config_tree *cft = cmd->cft, *cft_string = NULL;
+ struct config_source *cs = dm_config_get_custom(cft);
+
+ /*
+ * Follow this sequence:
+ * CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/CONFIG_MERGED_FILES
+ */
+
+ if (!profile->cft && !load_profile(cmd, profile))
+ return_0;
+
+ if (cs->type == CONFIG_STRING) {
+ cft_string = cft;
+ cft = cft->cascade;
+ cs = dm_config_get_custom(cft);
+ if (cs->type == CONFIG_PROFILE) {
+ log_error(INTERNAL_ERROR "override_config_tree_from_profile: "
+ "config cascade already contains a profile config.");
+ return 0;
+ }
+ dm_config_insert_cascaded_tree(cft_string, profile->cft);
+ }
+
+ cmd->cft = dm_config_insert_cascaded_tree(profile->cft, cft);
+
+ cmd->cft = cft_string ? : profile->cft;
+
+ return 1;
+}
+
int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
off_t offset, size_t size, off_t offset2, size_t size2,
checksum_fn_t checksum_fn, uint32_t checksum)
diff --git a/lib/config/config.h b/lib/config/config.h
index ef75580..0e4c0d5 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -135,6 +135,7 @@ int config_def_get_path(char *buf, size_t buf_size, int id);
int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_messages);
int override_config_tree_from_string(struct cmd_context *cmd, const char *config_settings);
+int override_config_tree_from_profile(struct cmd_context *cmd, struct profile *profile);
struct dm_config_tree *remove_config_tree_by_source(struct cmd_context *cmd, config_source_t source);
config_source_t config_get_source_type(struct dm_config_tree *cft);
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 1111df6..c50ea90 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1099,6 +1099,10 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
log_debug("Setting global configuration profile \"%s\".", profile->name);
/* This profile will override any VG/LV-based profile if present */
cmd->profile_params->global_profile = profile;
+ if (!override_config_tree_from_profile(cmd, profile)) {
+ log_error("Failed to apply configuration profile.");
+ return ECMD_FAILED;
+ }
}
if ((ret = _get_settings(cmd)))
10 years, 10 months
master - config: add support for loading profiles
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ebc236d085116e...
Commit: ebc236d085116e869b5873e2b5409674c2cd2a8d
Parent: f89a8b81cf795d9e658341b4755046b3824acdaa
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:27:04 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:08 2013 +0200
config: add support for loading profiles
This patch adds --profile arg to lvm cmds and adds config/profile_dir
configuration setting to select the directory where profiles are stored
By default it's /etc/lvm/profile.
The profiles are added by using new "add_profile" fn and then loaded
using the "load_profile" fn. All profiles are stored in a cmd context
within the new "struct profile_params":
struct profile_params {
const char *dir;
struct profile *global_profile;
struct dm_list profiles_to_load;
struct dm_list profiles;
};
...where "dir" is the directory with profiles, "global_profile" is
the profile that is set globally via the --profile arg (IOW, not
set per VG/LV basis based on metadata record) and the "profiles"
is the list with loaded profiles.
---
doc/example.conf.in | 3 ++
lib/commands/toolcontext.c | 47 +++++++++++++++++++++++++-
lib/commands/toolcontext.h | 3 ++
lib/config/config.c | 75 ++++++++++++++++++++++++++++++++++++++++++
lib/config/config.h | 17 +++++++++
lib/config/config_settings.h | 1 +
lib/mm/memlock.c | 7 ++++
tools/args.h | 1 +
tools/lvmcmdline.c | 14 +++++++-
9 files changed, 166 insertions(+), 2 deletions(-)
diff --git a/doc/example.conf.in b/doc/example.conf.in
index 1620721..3bc8c3c 100644
--- a/doc/example.conf.in
+++ b/doc/example.conf.in
@@ -23,6 +23,9 @@ config {
# If enabled, any configuration mismatch aborts the LVM2 process.
abort_on_errors = 0
+
+ # Directory where LVM looks for configuration profiles.
+ profile_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_PROFILE_SUBDIR"
}
# This section allows you to configure which block devices should
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 718fa65..f8b861b 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -595,6 +595,35 @@ static int _init_tag_configs(struct cmd_context *cmd)
return 1;
}
+static int _init_profiles(struct cmd_context *cmd)
+{
+ static char default_dir[PATH_MAX];
+ const char *dir;
+ struct profile_params *pp;
+
+ if (!(pp = dm_pool_zalloc(cmd->libmem, sizeof(*pp)))) {
+ log_error("profile_params alloc failed");
+ return 0;
+ }
+
+ if (!(dir = find_config_tree_str(cmd, config_profile_dir_CFG))) {
+ 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;
+ }
+
+ pp->dir = dm_pool_strdup(cmd->libmem, dir);
+ dm_list_init(&pp->profiles_to_load);
+ dm_list_init(&pp->profiles);
+
+ cmd->profile_params = pp;
+ return 1;
+}
+
static struct dm_config_tree *_merge_config_files(struct cmd_context *cmd, struct dm_config_tree *cft)
{
struct config_tree_list *cfl;
@@ -641,10 +670,11 @@ static void _destroy_config(struct cmd_context *cmd)
{
struct config_tree_list *cfl;
struct dm_config_tree *cft;
+ struct profile *profile;
/*
* Configuration cascade:
- * CONFIG_STRING -> CONFIG_FILE/CONFIG_MERGED_FILES
+ * CONFIG_STRING -> CONFIG_PROFILE -> CONFIG_FILE/CONFIG_MERGED_FILES
*/
/* CONFIG_FILE/CONFIG_MERGED_FILES */
@@ -657,6 +687,17 @@ static void _destroy_config(struct cmd_context *cmd)
config_destroy(cfl->cft);
dm_list_init(&cmd->config_files);
+ /* CONFIG_PROFILE */
+ if (cmd->profile_params) {
+ remove_config_tree_by_source(cmd, CONFIG_PROFILE);
+ dm_list_iterate_items(profile, &cmd->profile_params->profiles_to_load)
+ config_destroy(profile->cft);
+ dm_list_iterate_items(profile, &cmd->profile_params->profiles)
+ config_destroy(profile->cft);
+ dm_list_init(&cmd->profile_params->profiles_to_load);
+ dm_list_init(&cmd->profile_params->profiles);
+ }
+
/* CONFIG_STRING */
if ((cft = remove_config_tree_by_source(cmd, CONFIG_STRING)))
config_destroy(cft);
@@ -1427,6 +1468,9 @@ struct cmd_context *create_toolcontext(unsigned is_long_lived,
if (!_process_config(cmd))
goto_out;
+ if (!_init_profiles(cmd))
+ goto_out;
+
if (!(cmd->dev_types = create_dev_types(cmd->proc_dir,
find_config_tree_node(cmd, devices_types_CFG))))
goto_out;
@@ -1470,6 +1514,7 @@ out:
cmd = NULL;
}
+
return cmd;
}
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index f6a09a7..7551245 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -51,6 +51,7 @@ struct config_info {
};
struct dm_config_tree;
+struct profile_params;
struct archive_params;
struct backup_params;
struct arg_values;
@@ -104,6 +105,8 @@ struct cmd_context {
struct config_info current_settings;
struct dm_hash_table *cft_def_hash; /* cft definition hash used for validity check */
+ struct profile_params *profile_params;
+
struct archive_params *archive_params;
struct backup_params *backup_params;
const char *stripe_filler;
diff --git a/lib/config/config.c b/lib/config/config.c
index df65d38..5711ead 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -22,6 +22,7 @@
#include "str_list.h"
#include "toolcontext.h"
#include "lvm-file.h"
+#include "memlock.h"
#include <sys/stat.h>
#include <sys/mman.h>
@@ -1302,3 +1303,77 @@ struct dm_config_tree *config_def_create_tree(struct config_def_tree_spec *spec)
cft->root = root;
return cft;
}
+
+struct profile *add_profile(struct cmd_context *cmd, const char *profile_name)
+{
+ struct profile *profile;
+
+ /* Do some sanity checks first. */
+ if (!profile_name || !*profile_name) {
+ log_error("Undefined profile name.");
+ return NULL;
+ }
+
+ if (strchr(profile_name, '/')) {
+ log_error("%s: bad profile name, it contains '/'.", profile_name);
+ return NULL;
+ }
+
+ /* Check if the profile is added already... */
+ dm_list_iterate_items(profile, &cmd->profile_params->profiles_to_load) {
+ if (!strcmp(profile->name, profile_name))
+ return profile;
+ }
+ dm_list_iterate_items(profile, &cmd->profile_params->profiles) {
+ if (!strcmp(profile->name, profile_name))
+ return profile;
+ }
+
+ if (!(profile = dm_pool_zalloc(cmd->libmem, sizeof(*profile)))) {
+ log_error("profile allocation failed");
+ return NULL;
+ }
+
+ profile->name = dm_pool_strdup(cmd->libmem, profile_name);
+ dm_list_add(&cmd->profile_params->profiles_to_load, &profile->list);
+
+ return profile;
+}
+
+int load_profile(struct cmd_context *cmd, struct profile *profile) {
+ static char profile_path[PATH_MAX];
+
+ if (critical_section()) {
+ log_error(INTERNAL_ERROR "trying to load profile %s "
+ "in critical section.", profile->name);
+ return 0;
+ }
+
+ if (profile->cft)
+ return 1;
+
+ if (dm_snprintf(profile_path, sizeof(profile_path), "%s/%s.profile",
+ cmd->profile_params->dir, profile->name) < 0) {
+ log_error("LVM_SYSTEM_DIR or profile name too long");
+ return 0;
+ }
+
+ if (!(profile->cft = config_file_open_and_read(profile_path, CONFIG_PROFILE)))
+ return 0;
+
+ dm_list_move(&cmd->profile_params->profiles, &profile->list);
+
+ return 1;
+}
+
+int load_pending_profiles(struct cmd_context *cmd)
+{
+ struct profile *profile, *temp_profile;
+
+ dm_list_iterate_items_safe(profile, temp_profile, &cmd->profile_params->profiles_to_load) {
+ if (!load_profile(cmd, profile))
+ return 0;
+ }
+
+ return 1;
+}
diff --git a/lib/config/config.h b/lib/config/config.h
index f4c77ed..ef75580 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -34,6 +34,19 @@ typedef enum {
CONFIG_PROFILE /* profile config */
} config_source_t;
+struct profile {
+ struct dm_list list;
+ const char *name;
+ struct dm_config_tree *cft;
+};
+
+struct profile_params {
+ const char *dir; /* subdir in LVM_SYSTEM_DIR where LVM looks for profiles */
+ struct profile *global_profile; /* profile that overrides any other VG/LV-based profile ('--profile' cmd line arg) */
+ struct dm_list profiles_to_load;/* list of profiles which are only added, but still need to be loaded for any use */
+ struct dm_list profiles; /* list of profiles which are loaded already and which are ready for use */
+};
+
#define CFG_PATH_MAX_LEN 64
/*
@@ -114,6 +127,10 @@ enum {
#undef cfg_array
};
+struct profile *add_profile(struct cmd_context *cmd, const char *profile_name);
+int load_profile(struct cmd_context *cmd, struct profile *profile);
+int load_pending_profiles(struct cmd_context *cmd);
+
int config_def_get_path(char *buf, size_t buf_size, int id);
int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_messages);
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 6229f2e..65d869b 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -68,6 +68,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(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)
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 08876b0..fda3bb8 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -406,6 +406,13 @@ static void _unlock_mem_if_possible(struct cmd_context *cmd)
void critical_section_inc(struct cmd_context *cmd, const char *reason)
{
+ /*
+ * Profiles are loaded on-demand so make sure that before
+ * entering the critical section all needed profiles are
+ * loaded to avoid the disk access later.
+ */
+ load_pending_profiles(cmd);
+
if (!_critical_section) {
_critical_section = 1;
log_debug_mem("Entering critical section (%s).", reason);
diff --git a/tools/args.h b/tools/args.h
index 2fed97e..cadd211 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -91,6 +91,7 @@ arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE)
arg(writebehind_ARG, '\0', "writebehind", int_arg, 0)
arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0)
arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0)
+arg(profile_ARG, '\0', "profile", string_arg, 0)
/* Allow some variations */
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 0372434..1111df6 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -620,7 +620,8 @@ void lvm_register_commands(void)
debug_ARG, help_ARG, help2_ARG, \
version_ARG, verbose_ARG, \
yes_ARG, \
- quiet_ARG, config_ARG, -1);
+ quiet_ARG, config_ARG, \
+ profile_ARG, -1);
#include "commands.h"
#undef xx
}
@@ -1051,6 +1052,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
int locking_type;
int monitoring;
struct dm_config_tree *old_cft;
+ struct profile *profile;
init_error_message_produced(0);
@@ -1089,6 +1091,16 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
}
}
+ if (arg_count(cmd, profile_ARG)) {
+ if (!(profile = add_profile(cmd, arg_str_value(cmd, profile_ARG, NULL)))) {
+ log_error("Failed to add configuration profile.");
+ return ECMD_FAILED;
+ }
+ log_debug("Setting global configuration profile \"%s\".", profile->name);
+ /* This profile will override any VG/LV-based profile if present */
+ cmd->profile_params->global_profile = profile;
+ }
+
if ((ret = _get_settings(cmd)))
goto_out;
_apply_settings(cmd);
10 years, 10 months
master - configure: add configure --with-default-profile-subdir
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f89a8b81cf795d...
Commit: f89a8b81cf795d9e658341b4755046b3824acdaa
Parent: da3ea66a96e83b69da60af1540492d50f11b055f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jun 25 12:26:40 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 2 15:19:08 2013 +0200
configure: add configure --with-default-profile-subdir
Configuration profiles are selected configuration items that can
be loaded dynamically on demand and overlayed over existing
configuration on demand (either on cmd line by selecting the profile
name to be used globally or retrieved from metadata and used per
VG/LV basis only).
The default directory where profiles are stored is configurable
at compile time with --with-default-profile-subdir.
---
configure | 19 +++++++++++++++++++
configure.in | 8 ++++++++
lib/misc/configure.h.in | 3 +++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index e8ef786..8a1db74 100755
--- a/configure
+++ b/configure
@@ -671,6 +671,7 @@ DEFAULT_RUN_DIR
DEFAULT_DM_RUN_DIR
DEFAULT_LOCK_DIR
DEFAULT_DATA_ALIGNMENT
+DEFAULT_PROFILE_SUBDIR
DEFAULT_CACHE_SUBDIR
DEFAULT_BACKUP_SUBDIR
DEFAULT_ARCHIVE_SUBDIR
@@ -873,6 +874,7 @@ with_tmpfilesdir
with_dmeventd_pidfile
with_dmeventd_path
with_default_system_dir
+with_default_profile_subdir
with_default_archive_subdir
with_default_backup_subdir
with_default_cache_subdir
@@ -1638,6 +1640,8 @@ Optional Packages:
dmeventd path [[EPREFIX/sbin/dmeventd]]
--with-default-system-dir=DIR
default LVM system directory [[/etc/lvm]]
+ --with-default-profile-subdir=SUBDIR
+ default configuration profile subdir [[profile]]
--with-default-archive-subdir=SUBDIR
default metadata archive subdir [[archive]]
--with-default-backup-subdir=SUBDIR
@@ -10555,6 +10559,20 @@ _ACEOF
+# Check whether --with-default-profile-subdir was given.
+if test "${with_default_profile_subdir+set}" = set; then :
+ withval=$with_default_profile_subdir; DEFAULT_PROFILE_SUBDIR=$withval
+else
+ DEFAULT_PROFILE_SUBDIR=profile
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_PROFILE_SUBDIR "$DEFAULT_PROFILE_SUBDIR"
+_ACEOF
+
+
+
# Check whether --with-default-archive-subdir was given.
if test "${with_default_archive_subdir+set}" = set; then :
withval=$with_default_archive_subdir; DEFAULT_ARCHIVE_SUBDIR=$withval
@@ -10790,6 +10808,7 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
+
################################################################################
ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile doc/Makefile doc/example.conf include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/bl
k_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/dm_event_systemd_red_hat.socket scripts/dm_event_systemd_red_hat.service scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_tmpfiles_red_hat.conf scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
diff --git a/configure.in b/configure.in
index b286358..d90eb1a 100644
--- a/configure.in
+++ b/configure.in
@@ -1421,6 +1421,13 @@ AC_ARG_WITH(default-system-dir,
AC_DEFINE_UNQUOTED(DEFAULT_SYS_DIR, ["$DEFAULT_SYS_DIR"],
[Path to LVM system directory.])
+AC_ARG_WITH(default-profile-subdir,
+ AC_HELP_STRING([--with-default-profile-subdir=SUBDIR],
+ [default configuration profile subdir [[profile]]]),
+ DEFAULT_PROFILE_SUBDIR=$withval, DEFAULT_PROFILE_SUBDIR=profile)
+AC_DEFINE_UNQUOTED(DEFAULT_PROFILE_SUBDIR, ["$DEFAULT_PROFILE_SUBDIR"],
+ [Name of default configuration profile subdirectory.])
+
AC_ARG_WITH(default-archive-subdir,
AC_HELP_STRING([--with-default-archive-subdir=SUBDIR],
[default metadata archive subdir [[archive]]]),
@@ -1521,6 +1528,7 @@ AC_SUBST(DEFAULT_SYS_DIR)
AC_SUBST(DEFAULT_ARCHIVE_SUBDIR)
AC_SUBST(DEFAULT_BACKUP_SUBDIR)
AC_SUBST(DEFAULT_CACHE_SUBDIR)
+AC_SUBST(DEFAULT_PROFILE_SUBDIR)
AC_SUBST(DEFAULT_DATA_ALIGNMENT)
AC_SUBST(DEFAULT_LOCK_DIR)
AC_SUBST(DEFAULT_DM_RUN_DIR)
diff --git a/lib/misc/configure.h.in b/lib/misc/configure.h.in
index fdc5a26..aae4f24 100644
--- a/lib/misc/configure.h.in
+++ b/lib/misc/configure.h.in
@@ -53,6 +53,9 @@
/* Default directory to keep PID files in. */
#undef DEFAULT_PID_DIR
+/* Name of default configuration profile subdirectory. */
+#undef DEFAULT_PROFILE_SUBDIR
+
/* Default LVM run directory. */
#undef DEFAULT_RUN_DIR
10 years, 10 months