summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2008-06-06 19:28:35 +0000
committerAlasdair Kergon <agk@redhat.com>2008-06-06 19:28:35 +0000
commitec40d92889759b7d5a26add17b14ab41aa77e1c9 (patch)
treee08d4b918447ef0f18d10fcb77d35fb086a44591
parentbccf22f6b4bae14eaca3574df515ddf537ab338b (diff)
downloadlvm2-ec40d92889759b7d5a26add17b14ab41aa77e1c9.tar.gz
lvm2-ec40d92889759b7d5a26add17b14ab41aa77e1c9.tar.xz
lvm2-ec40d92889759b7d5a26add17b14ab41aa77e1c9.zip
post-release
-rw-r--r--VERSION2
-rw-r--r--WHATS_NEW7
-rw-r--r--WHATS_NEW_DM3
-rw-r--r--lib/log/log.c14
-rw-r--r--lib/log/log.h2
-rw-r--r--lib/metadata/metadata.c3
-rw-r--r--lib/report/report.c6
-rw-r--r--tools/args.h2
-rw-r--r--tools/commands.h17
-rw-r--r--tools/lvm.c4
-rw-r--r--tools/lvmcmdline.c16
-rw-r--r--tools/reporter.c2
12 files changed, 66 insertions, 12 deletions
diff --git a/VERSION b/VERSION
index 2d46bc7c..e48e36bc 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.37-cvs (2008-06-06)
+2.02.38-cvs (2008-06-06)
diff --git a/WHATS_NEW b/WHATS_NEW
index dd053c8b..118d6c26 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,10 @@
+Version 2.02.38 -
+=================================
+ In script-processing mode, stop if any command fails.
+ Warn if command exits with non-zero status code without a prior log_error.
+ Check lv_count in vg_validate.
+ Add --nameprefixes to reporting tools for field name prefix output format.
+
Version 2.02.37 - 6th June 2008
===============================
Make clvmd-cman use a hash rather than an array for node updown info.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index d69811bd..a904396b 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.27 -
+===============================
+
Version 1.02.26 - 6th June 2008
===============================
Initialise params buffer to empty string in _emit_segment.
diff --git a/lib/log/log.c b/lib/log/log.c
index f32e56ea..e8806619 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -51,6 +51,7 @@ static int _already_logging = 0;
static int _mirror_in_sync = 0;
static int _dmeventd_monitor = DEFAULT_DMEVENTD_MONITOR;
static int _ignore_suspended_devices = 0;
+static int _error_message_produced = 0;
static lvm2_log_fn_t _lvm2_log_fn = NULL;
@@ -238,6 +239,16 @@ void init_indent(int indent)
_indent = indent;
}
+void init_error_message_produced(int error_message_produced)
+{
+ _error_message_produced = error_message_produced;
+}
+
+int error_message_produced(void)
+{
+ return _error_message_produced;
+}
+
int test_mode()
{
return _test;
@@ -322,6 +333,9 @@ void print_log(int level, const char *file, int line, const char *format, ...)
if (_log_suppress == 2)
return;
+ if (level <= _LOG_ERR)
+ _error_message_produced = 1;
+
trformat = _(format);
if (_lvm2_log_fn) {
diff --git a/lib/log/log.h b/lib/log/log.h
index d5e0664e..8b85758b 100644
--- a/lib/log/log.h
+++ b/lib/log/log.h
@@ -79,6 +79,7 @@ void init_security_level(int level);
void init_mirror_in_sync(int in_sync);
void init_dmeventd_monitor(int reg);
void init_ignore_suspended_devices(int ignore);
+void init_error_message_produced(int error_message_produced);
void set_cmd_name(const char *cmd_name);
@@ -94,6 +95,7 @@ int lockingfailed(void);
int security_level(void);
int mirror_in_sync(void);
int ignore_suspended_devices(void);
+int error_message_produced(void);
#define DMEVENTD_MONITOR_IGNORE -1
int dmeventd_monitor_mode(void);
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 8fc39515..d385814a 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1213,10 +1213,11 @@ int vg_validate(struct volume_group *vg)
if ((lv_count = (uint32_t) list_size(&vg->lvs)) !=
vg->lv_count + 2 * vg->snapshot_count) {
- log_debug("Internal error: #internal LVs (%u) != #LVs (%"
+ log_error("Internal error: #internal LVs (%u) != #LVs (%"
PRIu32 ") + 2 * #snapshots (%" PRIu32 ") in VG %s",
list_size(&vg->lvs), vg->lv_count,
vg->snapshot_count, vg->name);
+ r = 0;
}
list_iterate_items(lvl, &vg->lvs) {
diff --git a/lib/report/report.c b/lib/report/report.c
index d067bd30..f2ffd982 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1091,9 +1091,15 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
if (headings)
report_flags |= DM_REPORT_OUTPUT_HEADINGS;
+ if (field_prefixes)
+ report_flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX;
+
rh = dm_report_init(report_type, _report_types, _fields, format,
separator, report_flags, keys, cmd);
+ if (field_prefixes)
+ dm_report_set_output_field_name_prefix(rh, "lvm2_");
+
return rh;
}
diff --git a/tools/args.h b/tools/args.h
index 07178008..220659c9 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -53,7 +53,7 @@ arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0)
arg(config_ARG, '\0', "config", string_arg, 0)
arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
-arg(prefixes_ARG, '\0', "prefixes", NULL, 0)
+arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0)
/* Allow some variations */
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
diff --git a/tools/commands.h b/tools/commands.h
index 7c0921c1..5c382779 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -363,6 +363,7 @@ xx(lvs,
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
"\t[--ignorelockingfailure]\n"
+ "\t[--nameprefixes]\n"
"\t[--noheadings]\n"
"\t[--nosuffix]\n"
"\t[-o|--options [+]Field[,Field]]\n"
@@ -377,8 +378,8 @@ xx(lvs,
"\t[--version]" "\n"
"\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n",
- aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
- nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
+ aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
+ noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG,
units_ARG)
@@ -570,8 +571,9 @@ xx(pvs,
"\t[-a|--all]\n"
"\t[-d|--debug]" "\n"
"\t[-h|-?|--help] " "\n"
- "\t[--noheadings]\n"
"\t[--ignorelockingfailure]\n"
+ "\t[--nameprefixes]\n"
+ "\t[--noheadings]\n"
"\t[--nosuffix]\n"
"\t[-o|--options [+]Field[,Field]]\n"
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
@@ -585,8 +587,8 @@ xx(pvs,
"\t[--version]\n"
"\t[PhysicalVolume [PhysicalVolume...]]\n",
- aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
- nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
+ aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
+ noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG,
units_ARG)
@@ -887,6 +889,7 @@ xx(vgs,
"\t[-d|--debug]\n"
"\t[-h|--help]\n"
"\t[--ignorelockingfailure]\n"
+ "\t[--nameprefixes]\n"
"\t[--noheadings]\n"
"\t[--nosuffix]\n"
"\t[-o|--options [+]Field[,Field]]\n"
@@ -900,8 +903,8 @@ xx(vgs,
"\t[--version]\n"
"\t[VolumeGroupName [VolumeGroupName...]]\n",
- aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
- nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
+ aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG,
+ noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG,
separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG)
xx(vgscan,
diff --git a/tools/lvm.c b/tools/lvm.c
index 7d58ae82..3576515d 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -236,6 +236,10 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
log_error("No such command '%s'. Try 'help'.",
argv[0]);
+ if ((ret != ECMD_PROCESSED) && !error_message_produced()) {
+ log_debug("Internal error: Failed command did not use log_error");
+ log_error("Command failed with status code %d.", ret);
+ }
_write_history();
}
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index bb3fdaec..0344c735 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -875,6 +875,8 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
int ret = 0;
int locking_type;
+ init_error_message_produced(0);
+
/* each command should start out with sigint flag cleared */
sigint_clear();
@@ -1096,7 +1098,14 @@ static int _run_script(struct cmd_context *cmd, int argc, char **argv)
continue;
if (!strcmp(argv[0], "quit") || !strcmp(argv[0], "exit"))
break;
- lvm_run_command(cmd, argc, argv);
+ ret = lvm_run_command(cmd, argc, argv);
+ if (ret != ECMD_PROCESSED) {
+ if (!error_message_produced()) {
+ log_debug("Internal error: Failed command did not use log_error");
+ log_error("Command failed with status code %d.", ret);
+ }
+ break;
+ }
}
if (fclose(script))
@@ -1218,6 +1227,11 @@ int lvm2_main(int argc, char **argv, unsigned is_static)
if (ret == ENO_SUCH_CMD)
log_error("No such command. Try 'help'.");
+ if ((ret != ECMD_PROCESSED) && !error_message_produced()) {
+ log_debug("Internal error: Failed command did not use log_error");
+ log_error("Command failed with status code %d.", ret);
+ }
+
out:
lvm_fin(cmd);
if (ret == ECMD_PROCESSED)
diff --git a/tools/reporter.c b/tools/reporter.c
index 5e13ed41..2da41d7e 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -272,7 +272,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
buffered = 0;
if (arg_count(cmd, noheadings_ARG))
headings = 0;
- if (arg_count(cmd, prefixes_ARG)) {
+ if (arg_count(cmd, nameprefixes_ARG)) {
aligned = 0;
field_prefixes = 1;
}