summaryrefslogtreecommitdiffstats
path: root/tools/lvconvert.c
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2012-08-25 20:35:48 +0100
committerAlasdair G Kergon <agk@redhat.com>2012-08-25 20:35:48 +0100
commit438e0050dfed1f8f2d74670a5f7c5e8c8819c777 (patch)
tree72488758b931b28d8a7f4294c9059a6fdd9db379 /tools/lvconvert.c
parent4047e4dfb16175daec348bf44032c02181bd4c70 (diff)
downloadlvm2-438e0050dfed1f8f2d74670a5f7c5e8c8819c777.tar.gz
lvm2-438e0050dfed1f8f2d74670a5f7c5e8c8819c777.tar.xz
lvm2-438e0050dfed1f8f2d74670a5f7c5e8c8819c777.zip
config: add silent mode
Accept -q as the short form of --quiet. Suppress non-essential standard output if -q is given twice. Treat log/silent in lvm.conf as equivalent to -qq. Review all log_print messages and change some to log_print_unless_silent. When silent, the following commands still produce output: dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay, pvs, version, vgcfgrestore -l, vgdisplay, vgs. [Needs checking.] Non-essential messages are shifted from log level 4 to log level 5 for syslog and lvm2_log_fn purposes.
Diffstat (limited to 'tools/lvconvert.c')
-rw-r--r--tools/lvconvert.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 2bfde243..ddda2f19 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -548,7 +548,7 @@ static int _finish_lvconvert_mirror(struct cmd_context *cmd,
if (!(_reload_lv(cmd, vg, lv)))
return_0;
- log_print("Logical volume %s converted.", lv->name);
+ log_print_unless_silent("Logical volume %s converted.", lv->name);
return 1;
}
@@ -564,7 +564,7 @@ static int _finish_lvconvert_merge(struct cmd_context *cmd,
return 0;
}
- log_print("Merge of snapshot into logical volume %s has finished.", lv->name);
+ log_print_unless_silent("Merge of snapshot into logical volume %s has finished.", lv->name);
if (!lv_remove_single(cmd, snap_seg->cow, DONT_PROMPT)) {
log_error("Could not remove snapshot %s merged into %s.",
snap_seg->cow->name, lv->name);
@@ -593,8 +593,8 @@ static progress_t _poll_merge_progress(struct cmd_context *cmd,
}
if (parms->progress_display)
- log_print("%s: %s: %.1f%%", lv->name, parms->progress_title,
- 100.0 - percent_to_float(percent));
+ log_print_unless_silent("%s: %s: %.1f%%", lv->name, parms->progress_title,
+ 100.0 - percent_to_float(percent));
else
log_verbose("%s: %s: %.1f%%", lv->name, parms->progress_title,
100.0 - percent_to_float(percent));
@@ -1511,7 +1511,7 @@ static int _lvconvert_mirrors(struct cmd_context *cmd,
return 0;
if (!lp->need_polling)
- log_print("Logical volume %s converted.", lv->name);
+ log_print_unless_silent("Logical volume %s converted.", lv->name);
backup(lv->vg);
return 1;
@@ -1638,8 +1638,8 @@ static int lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *lp
return 0;
}
- log_print("Faulty devices in %s/%s successfully"
- " replaced.", lv->vg->name, lv->name);
+ log_print_unless_silent("Faulty devices in %s/%s successfully"
+ " replaced.", lv->vg->name, lv->name);
return 1;
}
@@ -1703,7 +1703,7 @@ static int lvconvert_snapshot(struct cmd_context *cmd,
if (!_reload_lv(cmd, lv->vg, lv))
return_0;
- log_print("Logical volume %s converted to snapshot.", lv->name);
+ log_print_unless_silent("Logical volume %s converted to snapshot.", lv->name);
return 1;
}
@@ -1747,7 +1747,7 @@ static int lvconvert_merge(struct cmd_context *cmd,
}
if (lv_info(cmd, lv, 0, &info, 1, 0)) {
if (info.open_count) {
- log_print("Can't merge when snapshot is open");
+ log_print_unless_silent("Can't merge when snapshot is open");
merge_on_activate = 1;
}
}
@@ -1763,8 +1763,8 @@ static int lvconvert_merge(struct cmd_context *cmd,
if (!vg_commit(lv->vg))
return_0;
r = 1;
- log_print("Merging of snapshot %s will start "
- "next activation.", lv->name);
+ log_print_unless_silent("Merging of snapshot %s will start "
+ "next activation.", lv->name);
goto out;
}
@@ -1790,7 +1790,7 @@ static int lvconvert_merge(struct cmd_context *cmd,
lp->lv_to_poll = origin;
r = 1;
- log_print("Merging of volume %s started.", lv->name);
+ log_print_unless_silent("Merging of volume %s started.", lv->name);
out:
backup(lv->vg);
return r;
@@ -1892,8 +1892,8 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
if (!vg_write(pool_lv->vg) || !vg_commit(pool_lv->vg))
return_0;
- log_print("Converted %s/%s to thin pool.",
- pool_lv->vg->name, pool_lv->name);
+ log_print_unless_silent("Converted %s/%s to thin pool.",
+ pool_lv->vg->name, pool_lv->name);
if (was_active && !activate_lv(cmd, pool_lv)) {
log_error("Failed to activate pool logical volume %s/%s.",
pool_lv->vg->name, pool_lv->name);
@@ -2065,7 +2065,7 @@ static int poll_logical_volume(struct cmd_context *cmd, struct logical_volume *l
struct lvinfo info;
if (!lv_info(cmd, lv, 0, &info, 0, 0) || !info.exists) {
- log_print("Conversion starts after activation.");
+ log_print_unless_silent("Conversion starts after activation.");
return ECMD_PROCESSED;
}
return lvconvert_poll(cmd, lv, wait_completion ? 0 : 1U);