[lvm-devel] master - config: add profile arg to find_config_tree_int64
Peter Rajnoha
prajnoha at fedoraproject.org
Tue Jul 2 13:32:45 UTC 2013
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dbea545ffbfa08c799c35b85417e42684bc550e2
Commit: dbea545ffbfa08c799c35b85417e42684bc550e2
Parent: 50bf2c0db14400d80b08afabe917deee51f32ac8
Author: Peter Rajnoha <prajnoha at redhat.com>
AuthorDate: Tue Jun 25 12:31:24 2013 +0200
Committer: Peter Rajnoha <prajnoha at 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);
More information about the lvm-devel
mailing list