summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2013-06-25 12:31:24 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2013-07-02 15:19:09 +0200
commitdbea545ffbfa08c799c35b85417e42684bc550e2 (patch)
tree04b3a022f3e8d1df7dc397f39a66600343d89129 /lib
parent50bf2c0db14400d80b08afabe917deee51f32ac8 (diff)
downloadlvm2-dbea545ffbfa08c799c35b85417e42684bc550e2.tar.gz
config: add profile arg to find_config_tree_int64
Diffstat (limited to 'lib')
-rw-r--r--lib/commands/toolcontext.c2
-rw-r--r--lib/config/config.c14
-rw-r--r--lib/config/config.h2
3 files changed, 14 insertions, 4 deletions
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 8fce261de..ead77e566 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 ae0046144..f7194a7eb 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 a93cef9c0..cf94c035b 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);