master - vgimport: fix the all VGs case
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e15db1592642d5...
Commit: e15db1592642d5eb0a2a76b35882502c541302c7
Parent: 2972604f0c189217e9f46280798bd01243d37f83
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jul 15 09:26:10 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jul 15 09:26:10 2015 -0500
vgimport: fix the all VGs case
The ALL_VGS_IS_DEFAULT flag was wrongly removed;
it is needed for vgimport -a to work.
---
tools/commands.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index bab7bc9..7f4b4e2 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -1229,7 +1229,7 @@ xx(vgextend,
xx(vgimport,
"Register exported volume group with system",
- 0,
+ ALL_VGS_IS_DEFAULT,
"vgimport\n"
"\t[-a|--all]\n"
"\t[--commandprofile ProfileName]\n"
7 years, 11 months
master - vgexport: fix the all VGs case
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2972604f0c1892...
Commit: 2972604f0c189217e9f46280798bd01243d37f83
Parent: d947a815e8bc6080ee5b364bd55f8aa0c2807f4e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jul 15 09:21:45 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jul 15 09:23:30 2015 -0500
vgexport: fix the all VGs case
The ALL_VGS_IS_DEFAULT flag was wrongly removed;
it is needed for vgexport -a to work.
---
tools/commands.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index e50505d..bab7bc9 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -1191,7 +1191,7 @@ xx(vgdisplay,
xx(vgexport,
"Unregister volume group(s) from the system",
- 0,
+ ALL_VGS_IS_DEFAULT,
"vgexport\n"
"\t[-a|--all]\n"
"\t[--commandprofile ProfileName]\n"
7 years, 11 months
master - config: make a difference between "not found" and "is empty" in log msg for devices/preferred_names
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d947a815e8bc60...
Commit: d947a815e8bc6080ee5b364bd55f8aa0c2807f4e
Parent: d10fb73f63649baec3cec28e1ee573c2ef6b95d6
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jul 15 16:14:07 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jul 15 16:14:51 2015 +0200
config: make a difference between "not found" and "is empty" in log msg for devices/preferred_names
Replace misleading "not found" in the log message when
devices/preferred_names is set to empty array:
Really not found:
device/dev-cache.c:689 devices/preferred_names not found in config: using built-in preferences
Found, but empty:
config/config.c:1431 Setting devices/preferred_names to preferred_names = [ ]
device/dev-cache.c:689 devices/preferred_names is empty: using built-in preferences
---
lib/device/dev-cache.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 136921b..d854e2b 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -683,8 +683,10 @@ static int _init_preferred_names(struct cmd_context *cmd)
if (!(cn = find_config_tree_array(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");
+ log_very_verbose("devices/preferred_names %s: "
+ "using built-in preferences",
+ cn && cn->v->type == DM_CFG_EMPTY_ARRAY ? "is empty"
+ : "not found in config");
return 1;
}
7 years, 11 months
master - config: also log the value used if defined in config, not just defaults
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d10fb73f63649b...
Commit: d10fb73f63649baec3cec28e1ee573c2ef6b95d6
Parent: 64c41062191e3bd487374837ff6d21a077129c98
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jul 15 15:57:29 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jul 15 16:02:20 2015 +0200
config: also log the value used if defined in config, not just defaults
Commit 7e728fe1a164cc5d4f64e46fcfcbb224c22b2457 added a log call
directly in find_config_tree_array when defaults are used.
This patch also adds the log for the value which is found in
existing configuration and for which defaults are not used.
For example:
Defaults used:
config/config.c:1428 devices/scan not found in config: defaulting to scan = [ "/dev" ]
Value defined in configuration used:
config/config.c:1431 Setting devices/scan to scan = [ "/dev", "/mydev", "/abc" ]
This makes the logging consistent with the other find_config_tree_* functions.
---
lib/config/config.c | 53 +++++++++++++++++++++++++++++++++++---------------
1 files changed, 37 insertions(+), 16 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index a447de7..35ee3ac 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1403,15 +1403,44 @@ static int _config_array_line(const struct dm_config_node *cn, const char *line,
return 1;
}
+static void _log_array_value_used(struct dm_pool *mem, const struct dm_config_node *cn,
+ const char *path, int default_used)
+{
+ struct _config_array_out_handle out_handle = { 0 };
+ struct dm_config_node_out_spec out_spec = { 0 };
+ uint32_t old_format_flags;
+
+ out_handle.mem = mem;
+ out_spec.line_fn = _config_array_line;
+
+ old_format_flags = dm_config_value_get_format_flags(cn->v);
+ dm_config_value_set_format_flags(cn->v,
+ DM_CONFIG_VALUE_FMT_COMMON_EXTRA_SPACES |
+ DM_CONFIG_VALUE_FMT_COMMON_ARRAY);
+
+ if (!dm_config_write_one_node_out(cn, &out_spec, &out_handle)) {
+ log_error("_log_array_value_used: failed to write node value");
+ out_handle.mem = NULL;
+ }
+
+ if (default_used)
+ log_very_verbose("%s not found in config: defaulting to %s",
+ path, out_handle.mem ? out_handle.str : "<unknown>");
+ else
+ log_very_verbose("Setting %s to %s",
+ path, out_handle.mem ? out_handle.str : "<unknown>");
+
+ if (out_handle.mem)
+ dm_pool_free(out_handle.mem, out_handle.str);
+ dm_config_value_set_format_flags(cn->v, old_format_flags);
+}
+
const struct dm_config_node *find_config_tree_array(struct cmd_context *cmd, int id, struct profile *profile)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
char path[CFG_PATH_MAX_LEN];
int profile_applied;
- const struct dm_config_node *cn, *cn_def = NULL;
- struct _config_array_out_handle out_handle = { 0 };
- struct dm_config_node_out_spec out_spec = { 0 };
-
+ const struct dm_config_node *cn = NULL, *cn_def = NULL;
profile_applied = _apply_local_profile(cmd, profile);
_cfg_def_make_path(path, sizeof(path), item->id, item, 0);
@@ -1422,18 +1451,10 @@ const struct dm_config_node *find_config_tree_array(struct cmd_context *cmd, int
!(cn = find_config_tree_node(cmd, id, profile)))
cn_def = _get_array_def_node(cmd, item, profile);
- if (cn_def) {
- out_handle.mem = cmd->cft->mem;
- out_spec.line_fn = _config_array_line;
- dm_config_value_set_format_flags(cn_def->v,
- DM_CONFIG_VALUE_FMT_COMMON_EXTRA_SPACES |
- DM_CONFIG_VALUE_FMT_COMMON_ARRAY);
- if (!dm_config_write_one_node_out(cn_def, &out_spec, &out_handle))
- out_handle.mem = NULL;
- log_very_verbose("%s not found in config: defaulting to %s",
- path, out_handle.mem ? out_handle.str : "<unknown>");
- if (out_handle.mem)
- dm_pool_free(out_handle.mem, out_handle.str);
+ if (cn)
+ _log_array_value_used(cmd->cft->mem, cn, path, 0);
+ else if (cn_def) {
+ _log_array_value_used(cmd->cft->mem, cn_def, path, 1);
cn = cn_def;
}
7 years, 11 months
master - cleanup: drop unused header file
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=64c41062191e3b...
Commit: 64c41062191e3bd487374837ff6d21a077129c98
Parent: c45e6e3c78bc6ac4ddd96c764deed211cf1c6f31
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 10 11:16:11 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:22 2015 +0200
cleanup: drop unused header file
---
lib/raid/raid.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index e9dfbd4..ae70cdd 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -16,7 +16,6 @@
#include "segtype.h"
#include "display.h"
#include "text_export.h"
-#include "text_import.h"
#include "config.h"
#include "str_list.h"
#include "targets.h"
7 years, 11 months
master - cleanup: avoid double assign
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c45e6e3c78bc6a...
Commit: c45e6e3c78bc6ac4ddd96c764deed211cf1c6f31
Parent: a7101e7bfb1b8f5f792974a3b5f39fa4fcdb5656
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 10 11:16:23 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:22 2015 +0200
cleanup: avoid double assign
Variable n1 is assigned without using n1 before.
---
libdm/libdm-report.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index c08dcab..34374bb 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -2595,7 +2595,7 @@ static char *_get_date(char *str, struct tm *tm, time_range_t *range)
{
static const char incorrect_date_format_msg[] = "Incorrect date format.";
time_range_t tmp_range = RANGE_NONE;
- long n1 = -1, n2 = -1, n3 = -1;
+ long n1, n2 = -1, n3 = -1;
char *s = str, *end;
size_t len = 0;
@@ -2680,7 +2680,7 @@ static char *_get_time(char *str, struct tm *tm, time_range_t *range)
{
static const char incorrect_time_format_msg[] = "Incorrect time format.";
time_range_t tmp_range = RANGE_NONE;
- long n1 = -1, n2 = -1, n3 = -1;
+ long n1, n2 = -1, n3 = -1;
char *s = str, *end;
size_t len = 0;
@@ -2774,7 +2774,7 @@ static char *_get_time(char *str, struct tm *tm, time_range_t *range)
/* The offset is always an absolute offset against GMT! */
static char *_get_tz(char *str, int *tz_supplied, int *offset)
{
- long n1 = -1, n2 = -1;
+ long n1, n2 = -1;
char *s = str, *end;
int sign = 1; /* +HH:MM by default */
size_t len = 0;
7 years, 11 months
master - cleanup: drop duplicated seg test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a7101e7bfb1b8f...
Commit: a7101e7bfb1b8f5f792974a3b5f39fa4fcdb5656
Parent: beb65056cf450ac14c2354f87a981cd5a379560c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 10 13:51:15 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:22 2015 +0200
cleanup: drop duplicated seg test
Test is already in seg_is_pool() if branch.
and one minor indent fix.
---
lib/metadata/merge.c | 3 +--
tools/lvcreate.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 530b4e4..e38cb53 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -237,8 +237,7 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
inc_error_count;
}
- if (seg_is_pool(seg) &&
- !validate_pool_chunk_size(lv->vg->cmd, seg->segtype, seg->chunk_size)) {
+ if (!validate_pool_chunk_size(lv->vg->cmd, seg->segtype, seg->chunk_size)) {
log_error("LV %s: %s segment %u has invalid chunk size %u.",
lv->name, seg->segtype->name, seg_count, seg->chunk_size);
inc_error_count;
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 2595130..12b5166 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -587,7 +587,7 @@ static int _read_cache_params(struct cmd_context *cmd,
}
static int _read_activation_params(struct cmd_context *cmd,
- struct volume_group *vg,
+ struct volume_group *vg,
struct lvcreate_params *lp)
{
unsigned pagesize = lvm_getpagesize() >> SECTOR_SHIFT;
7 years, 11 months
master - makefiles: adding target for generating ctags
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=beb65056cf450a...
Commit: beb65056cf450ac14c2354f87a981cd5a379560c
Parent: c2d4330f27277717bc3b684b702189079b257b77
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 2 12:09:02 2009 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:22 2015 +0200
makefiles: adding target for generating ctags
make tags generates traditional tags ctags ref list.
---
Makefile.in | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 43a6ed0..1eb026b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -223,3 +223,13 @@ memcheck: test-programs
ruby-test:
$(RUBY) report-generators/test/ts.rb
endif
+
+ifneq ($(shell which ctags),)
+.PHONY: tags
+all: tags
+tags:
+ test -z "$(shell find $(top_srcdir) -type f -name '*.[ch]' -newer tags | head -1)" || $(RM) tags
+ test -f tags || find $(top_srcdir) -maxdepth 4 -type f -name '*.[ch]' -exec ctags -a '{}' +
+
+DISTCLEAN_TARGETS += tags
+endif
7 years, 11 months
master - cache: enhance cache-pool validation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c2d4330f272777...
Commit: c2d4330f27277717bc3b684b702189079b257b77
Parent: 077645476cdfd7de0a16c283712b6c01938015d7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 14 09:58:37 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:22 2015 +0200
cache: enhance cache-pool validation
Capture cache-pool without cache policy name set.
---
lib/metadata/merge.c | 6 ++++++
lib/report/report.c | 15 +++++----------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 7fd5a07..530b4e4 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -208,6 +208,12 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
}
}
+ if (seg_is_cache_pool(seg)) {
+ if (!seg->policy_name) {
+ log_error("LV %s is missing cache policy name.", lv->name);
+ inc_error_count;
+ }
+ }
if (seg_is_pool(seg)) {
if (seg->area_count != 1 ||
seg_type(seg, 0) != AREA_LV) {
diff --git a/lib/report/report.c b/lib/report/report.c
index 79802b7..c2ab991 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1381,7 +1381,6 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct lv_segment *seg = (const struct lv_segment *) data;
- const char *cache_policy_name;
if (seg_is_cache(seg))
seg = first_seg(seg->pool_lv);
@@ -1389,16 +1388,12 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
return _field_set_value(field, GET_FIRST_RESERVED_NAME(cache_policy_undef),
GET_FIELD_RESERVED_VALUE(cache_policy_undef));
- if (seg->policy_name) {
- if (!(cache_policy_name = dm_pool_strdup(mem, seg->policy_name))) {
- log_error("dm_pool_strdup failed");
- return 0;
- }
- return _field_set_value(field, cache_policy_name, NULL);
- } else {
- log_error(INTERNAL_ERROR "unexpected NULL policy name");
- return_0;
+ if (!seg->policy_name) {
+ log_error(INTERNAL_ERROR "Unexpected NULL policy name.");
+ return 0;
}
+
+ return _field_set_value(field, seg->policy_name, NULL);
}
static int _modules_disp(struct dm_report *rh, struct dm_pool *mem,
7 years, 11 months
master - cache: capture missing policy name
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=077645476cdfd7...
Commit: 077645476cdfd7de0a16c283712b6c01938015d7
Parent: e9e35b011e084616f97ede9a31305259e70f883d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 15 10:54:49 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 15 13:10:22 2015 +0200
cache: capture missing policy name
Policy name has to be always defined.
Capture it as an internal error before write.
When reading metadata without defined policy name, use default defined policy.
TODO: Unsure, but it might have to be actually always 'mq' in this case.
---
lib/cache_segtype/cache.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index ca30495..ad356a9 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -77,9 +77,13 @@ static int _cache_pool_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("policy must be a string in");
if (!(seg->policy_name = dm_pool_strdup(mem, str)))
return SEG_LOG_ERROR("Failed to duplicate policy in");
- } else
+ } else {
/* Cannot use 'just' default, so pick one */
seg->policy_name = DEFAULT_CACHE_POOL_POLICY; /* FIXME make configurable */
+ /* FIXME maybe here should be always 'mq' */
+ log_warn("WARNING: cache_policy undefined, using default \"%s\" policy.",
+ seg->policy_name);
+ }
/*
* Read in policy args:
@@ -130,13 +134,17 @@ static int _cache_pool_text_export(const struct lv_segment *seg,
if (!(cache_mode = get_cache_pool_cachemode_name(seg)))
return_0;
+ if (!seg->policy_name) {
+ log_error(INTERNAL_ERROR "Policy name for %s is not defined.",
+ display_lvname(seg->lv));
+ return 0;
+ }
+
outf(f, "data = \"%s\"", seg_lv(seg, 0)->name);
outf(f, "metadata = \"%s\"", seg->metadata_lv->name);
outf(f, "chunk_size = %" PRIu32, seg->chunk_size);
outf(f, "cache_mode = \"%s\"", cache_mode);
-
- if (seg->policy_name)
- outf(f, "policy = \"%s\"", seg->policy_name);
+ outf(f, "policy = \"%s\"", seg->policy_name);
if (seg->policy_settings) {
if (strcmp(seg->policy_settings->key, "policy_settings")) {
7 years, 11 months