summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/args.h2
-rw-r--r--tools/lvchange.c2
-rw-r--r--tools/lvconvert.c30
-rw-r--r--tools/lvcreate.c6
-rw-r--r--tools/lvm.c1
-rw-r--r--tools/lvmcmdline.c6
-rw-r--r--tools/lvrename.c4
-rw-r--r--tools/lvresize.c40
-rw-r--r--tools/lvscan.c8
-rw-r--r--tools/polldaemon.c8
-rw-r--r--tools/pvchange.c10
-rw-r--r--tools/pvmove.c16
-rw-r--r--tools/pvremove.c4
-rw-r--r--tools/pvresize.c6
-rw-r--r--tools/pvscan.c58
-rw-r--r--tools/toollib.c4
-rw-r--r--tools/vgcfgbackup.c2
-rw-r--r--tools/vgcfgrestore.c2
-rw-r--r--tools/vgchange.c18
-rw-r--r--tools/vgconvert.c2
-rw-r--r--tools/vgcreate.c4
-rw-r--r--tools/vgexport.c2
-rw-r--r--tools/vgextend.c2
-rw-r--r--tools/vgimport.c2
-rw-r--r--tools/vgmerge.c4
-rw-r--r--tools/vgreduce.c6
-rw-r--r--tools/vgrename.c4
-rw-r--r--tools/vgscan.c8
-rw-r--r--tools/vgsplit.c6
29 files changed, 133 insertions, 134 deletions
diff --git a/tools/args.h b/tools/args.h
index 796fc51e..d436db43 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -18,7 +18,6 @@
*/
/* *INDENT-OFF* */
arg(version_ARG, '\0', "version", NULL, 0)
-arg(quiet_ARG, '\0', "quiet", NULL, 0)
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0)
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0)
arg(nolocking_ARG, '\0', "nolocking", NULL, 0)
@@ -131,6 +130,7 @@ arg(permission_ARG, 'p', "permission", permission_arg, 0)
arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg, 0)
arg(partial_ARG, 'P', "partial", NULL, 0)
arg(physicalvolume_ARG, 'P', "physicalvolume", NULL, 0)
+arg(quiet_ARG, 'q', "quiet", NULL, ARG_COUNTABLE)
arg(readahead_ARG, 'r', "readahead", readahead_arg, 0)
arg(resizefs_ARG, 'r', "resizefs", NULL, 0)
arg(reset_ARG, 'R', "reset", NULL, 0)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 73a37fda..1f32d5c1 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -784,7 +784,7 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
}
if (doit)
- log_print("Logical volume \"%s\" changed", lv->name);
+ log_print_unless_silent("Logical volume \"%s\" changed", lv->name);
if (arg_count(cmd, resync_ARG))
if (!lvchange_resync(cmd, lv)) {
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);
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index aac8c22b..45a117f7 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -301,8 +301,8 @@ static int _update_extents_params(struct volume_group *vg,
if ((lcp->percent != PERCENT_NONE) && lp->stripes &&
(size_rest = lp->extents % (lp->stripes * stripesize_extents)) &&
(vg->free_count < lp->extents - size_rest + (lp->stripes * stripesize_extents))) {
- log_print("Rounding size (%d extents) down to stripe boundary "
- "size (%d extents)", lp->extents,
+ log_print_unless_silent("Rounding size (%d extents) down to stripe boundary "
+ "size (%d extents)", lp->extents,
lp->extents - size_rest);
lp->extents = lp->extents - size_rest;
}
@@ -750,7 +750,7 @@ static int _lvcreate_params(struct lvcreate_params *lp,
log_error("--mirrors must be at least 1 with segment type %s.", lp->segtype->name);
return 0;
}
- log_print("Redundant mirrors argument: default is 0");
+ log_print_unless_silent("Redundant mirrors argument: default is 0");
}
if ((lp->mirrors > 2) && !strcmp(lp->segtype->name, "raid10")) {
diff --git a/tools/lvm.c b/tools/lvm.c
index e002a761..425549ad 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -199,6 +199,7 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
/* EOF */
if (!input) {
+ /* readline sends prompt to stdout */
printf("\n");
break;
}
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index eea874e9..f3704d66 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -847,6 +847,9 @@ static int _get_settings(struct cmd_context *cmd)
cmd->current_settings.verbose = 0;
}
+ if (arg_count(cmd, quiet_ARG) > 1)
+ cmd->current_settings.silent = 1;
+
if (arg_count(cmd, test_ARG))
cmd->current_settings.test = arg_count(cmd, test_ARG);
@@ -863,7 +866,7 @@ static int _get_settings(struct cmd_context *cmd)
if (arg_count(cmd, partial_ARG)) {
cmd->partial_activation = 1;
- log_print("Partial mode. Incomplete logical volumes will be processed.");
+ log_warn("PARTIAL MODE. Incomplete logical volumes will be processed.");
}
if (arg_count(cmd, ignorelockingfailure_ARG) || arg_count(cmd, sysinit_ARG))
@@ -966,6 +969,7 @@ static void _apply_settings(struct cmd_context *cmd)
{
init_debug(cmd->current_settings.debug);
init_verbose(cmd->current_settings.verbose + VERBOSE_BASE_LEVEL);
+ init_silent(cmd->current_settings.silent);
init_test(cmd->current_settings.test);
init_full_scan_done(0);
init_mirror_in_sync(0);
diff --git a/tools/lvrename.c b/tools/lvrename.c
index ef67682d..3dc21dc7 100644
--- a/tools/lvrename.c
+++ b/tools/lvrename.c
@@ -133,8 +133,8 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
if (!lv_rename(cmd, lvl->lv, lv_name_new))
goto error;
- log_print("Renamed \"%s\" to \"%s\" in volume group \"%s\"",
- lv_name_old, lv_name_new, vg_name);
+ log_print_unless_silent("Renamed \"%s\" to \"%s\" in volume group \"%s\"",
+ lv_name_old, lv_name_new, vg_name);
r = ECMD_PROCESSED;
error:
diff --git a/tools/lvresize.c b/tools/lvresize.c
index 05041afd..5052bfbc 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -466,8 +466,8 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
lp->size += vg->extent_size -
(lp->size % vg->extent_size);
- log_print("Rounding size to boundary between physical extents: %s",
- display_size(cmd, lp->size));
+ log_print_unless_silent("Rounding size to boundary between physical extents: %s",
+ display_size(cmd, lp->size));
}
lp->extents = lp->size / vg->extent_size;
@@ -580,8 +580,8 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
}
if (!arg_count(cmd, mirrors_ARG) && seg_mirrors) {
- log_print("Extending %" PRIu32 " mirror images.",
- seg_mirrors);
+ log_print_unless_silent("Extending %" PRIu32 " mirror images.",
+ seg_mirrors);
lp->mirrors = seg_mirrors;
}
if ((arg_count(cmd, mirrors_ARG) || seg_mirrors) &&
@@ -636,16 +636,16 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
if (!lp->stripe_size && lp->stripes > 1) {
if (seg_stripesize) {
- log_print("Using stripesize of last segment %s",
- display_size(cmd, (uint64_t) seg_stripesize));
+ log_print_unless_silent("Using stripesize of last segment %s",
+ display_size(cmd, (uint64_t) seg_stripesize));
lp->stripe_size = seg_stripesize;
} else {
lp->stripe_size =
find_config_tree_int(cmd,
"metadata/stripesize",
DEFAULT_STRIPESIZE) * 2;
- log_print("Using default stripesize %s",
- display_size(cmd, (uint64_t) lp->stripe_size));
+ log_print_unless_silent("Using default stripesize %s",
+ display_size(cmd, (uint64_t) lp->stripe_size));
}
}
}
@@ -703,16 +703,16 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
!lp->percent ||
(vg->free_count >= (lp->extents - lv->le_count - size_rest +
(lp->stripes * stripesize_extents))))) {
- log_print("Rounding size (%d extents) up to stripe "
- "boundary size for segment (%d extents)",
- lp->extents, lp->extents - size_rest +
- (lp->stripes * stripesize_extents));
+ log_print_unless_silent("Rounding size (%d extents) up to stripe "
+ "boundary size for segment (%d extents)",
+ lp->extents, lp->extents - size_rest +
+ (lp->stripes * stripesize_extents));
lp->extents = lp->extents - size_rest +
(lp->stripes * stripesize_extents);
} else if (size_rest) {
- log_print("Rounding size (%d extents) down to stripe "
- "boundary size for segment (%d extents)",
- lp->extents, lp->extents - size_rest);
+ log_print_unless_silent("Rounding size (%d extents) down to stripe "
+ "boundary size for segment (%d extents)",
+ lp->extents, lp->extents - size_rest);
lp->extents = lp->extents - size_rest;
}
}
@@ -802,10 +802,10 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
return ECMD_FAILED;
}
- log_print("%sing logical volume %s to %s",
- (lp->resize == LV_REDUCE) ? "Reduc" : "Extend",
- lp->lv_name,
- display_size(cmd, (uint64_t) lp->extents * vg->extent_size));
+ log_print_unless_silent("%sing logical volume %s to %s",
+ (lp->resize == LV_REDUCE) ? "Reduc" : "Extend",
+ lp->lv_name,
+ display_size(cmd, (uint64_t) lp->extents * vg->extent_size));
if (lp->resize == LV_REDUCE) {
if (!lv_reduce(lv, lv->le_count - lp->extents)) {
@@ -871,7 +871,7 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
return ECMD_FAILED;
}
- log_print("Logical volume %s successfully resized", lp->lv_name);
+ log_print_unless_silent("Logical volume %s successfully resized", lp->lv_name);
if (lp->resizefs && (lp->resize == LV_EXTEND) &&
!_fsadm_cmd(cmd, vg, lp, FSADM_CMD_RESIZE, NULL)) {
diff --git a/tools/lvscan.c b/tools/lvscan.c
index 753b00d5..636ac453 100644
--- a/tools/lvscan.c
+++ b/tools/lvscan.c
@@ -59,10 +59,10 @@ static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
else
snapshot_str = " ";
- log_print("%s%s '%s%s/%s' [%s] %s", active_str, snapshot_str,
- cmd->dev_dir, lv->vg->name, lv->name,
- display_size(cmd, lv->size),
- get_alloc_string(lv->alloc));
+ log_print_unless_silent("%s%s '%s%s/%s' [%s] %s", active_str, snapshot_str,
+ cmd->dev_dir, lv->vg->name, lv->name,
+ display_size(cmd, lv->size),
+ get_alloc_string(lv->alloc));
return ECMD_PROCESSED;
}
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index f57484ea..a9138a15 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -108,8 +108,8 @@ progress_t poll_mirror_progress(struct cmd_context *cmd,
overall_percent = copy_percent(lv);
if (parms->progress_display)
- log_print("%s: %s: %.1f%%", name, parms->progress_title,
- percent_to_float(overall_percent));
+ log_print_unless_silent("%s: %s: %.1f%%", name, parms->progress_title,
+ percent_to_float(overall_percent));
else
log_verbose("%s: %s: %.1f%%", name, parms->progress_title,
percent_to_float(overall_percent));
@@ -213,8 +213,8 @@ static int _wait_for_single_lv(struct cmd_context *cmd, const char *name, const
lv = parms->poll_fns->get_copy_lv(cmd, vg, name, uuid, parms->lv_type);
if (!lv && parms->lv_type == PVMOVE) {
- log_print("%s: no pvmove in progress - already finished or aborted.",
- name);
+ log_print_unless_silent("%s: no pvmove in progress - already finished or aborted.",
+ name);
unlock_and_release_vg(cmd, vg, vg->name);
return 1;
}
diff --git a/tools/pvchange.c b/tools/pvchange.c
index f6d1abd3..70f1e629 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -168,7 +168,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
- log_print("Physical volume \"%s\" changed", pv_name);
+ log_print_unless_silent("Physical volume \"%s\" changed", pv_name);
return 1;
}
@@ -269,10 +269,10 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
unlock_vg(cmd, VG_GLOBAL);
}
- log_print("%d physical volume%s changed / %d physical volume%s "
- "not changed",
- done, done == 1 ? "" : "s",
- total - done, (total - done) == 1 ? "" : "s");
+ log_print_unless_silent("%d physical volume%s changed / %d physical volume%s "
+ "not changed",
+ done, done == 1 ? "" : "s",
+ total - done, (total - done) == 1 ? "" : "s");
return (total == done) ? ECMD_PROCESSED : ECMD_FAILED;
}
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 05ef33cc..9649f119 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -215,35 +215,35 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
}
if (lv_is_origin(lv) || lv_is_cow(lv)) {
lv_skipped = 1;
- log_print("Skipping snapshot-related LV %s", lv->name);
+ log_print_unless_silent("Skipping snapshot-related LV %s", lv->name);
continue;
}
if (lv->status & MIRRORED) {
lv_skipped = 1;
- log_print("Skipping mirror LV %s", lv->name);
+ log_print_unless_silent("Skipping mirror LV %s", lv->name);
continue;
}
if (lv->status & MIRROR_LOG) {
lv_skipped = 1;
- log_print("Skipping mirror log LV %s", lv->name);
+ log_print_unless_silent("Skipping mirror log LV %s", lv->name);
continue;
}
if (lv->status & MIRROR_IMAGE) {
lv_skipped = 1;
- log_print("Skipping mirror image LV %s", lv->name);
+ log_print_unless_silent("Skipping mirror image LV %s", lv->name);
continue;
}
if (lv->status & LOCKED) {
lv_skipped = 1;
- log_print("Skipping locked LV %s", lv->name);
+ log_print_unless_silent("Skipping locked LV %s", lv->name);
continue;
}
if (vg_is_clustered(vg) &&
lv_is_active_exclusive_remotely(lv)) {
lv_skipped = 1;
- log_print("Skipping LV %s which is activated "
- "exclusively on remote node.", lv->name);
+ log_print_unless_silent("Skipping LV %s which is activated "
+ "exclusively on remote node.", lv->name);
continue;
}
@@ -512,7 +512,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name,
exclusive = _pvmove_is_exclusive(cmd, vg);
if ((lv_mirr = find_pvmove_lv(vg, pv_dev(pv), PVMOVE))) {
- log_print("Detected pvmove in progress for %s", pv_name);
+ log_print_unless_silent("Detected pvmove in progress for %s", pv_name);
if (argc || lv_name)
log_error("Ignoring remaining command line arguments");
diff --git a/tools/pvremove.c b/tools/pvremove.c
index 7d057584..823c069d 100644
--- a/tools/pvremove.c
+++ b/tools/pvremove.c
@@ -131,8 +131,8 @@ static int pvremove_single(struct cmd_context *cmd, const char *pv_name,
if (!lvmetad_pv_gone_by_dev(dev, NULL))
goto_out;
- log_print("Labels on physical volume \"%s\" successfully wiped",
- pv_name);
+ log_print_unless_silent("Labels on physical volume \"%s\" successfully wiped",
+ pv_name);
ret = ECMD_PROCESSED;
diff --git a/tools/pvresize.c b/tools/pvresize.c
index ff198117..2f0693aa 100644
--- a/tools/pvresize.c
+++ b/tools/pvresize.c
@@ -118,7 +118,7 @@ static int _pv_resize_single(struct cmd_context *cmd,
backup(vg);
}
- log_print("Physical volume \"%s\" changed", pv_name);
+ log_print_unless_silent("Physical volume \"%s\" changed", pv_name);
r = 1;
out:
@@ -176,8 +176,8 @@ int pvresize(struct cmd_context *cmd, int argc, char **argv)
ret = process_each_pv(cmd, argc, argv, NULL, READ_FOR_UPDATE, 0, &params,
_pvresize_single);
- log_print("%d physical volume(s) resized / %d physical volume(s) "
- "not resized", params.done, params.total - params.done);
+ log_print_unless_silent("%d physical volume(s) resized / %d physical volume(s) "
+ "not resized", params.done, params.total - params.done);
return ret;
}
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 6c634e35..92873882 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -34,7 +34,7 @@ static void _pvscan_display_single(struct cmd_context *cmd,
/* short listing? */
if (arg_count(cmd, short_ARG) > 0) {
- log_print("%s", pv_dev_name(pv));
+ log_print_unless_silent("%s", pv_dev_name(pv));
return;
}
@@ -64,37 +64,31 @@ static void _pvscan_display_single(struct cmd_context *cmd,
}
if (is_orphan(pv)) {
- log_print("PV %-*s %-*s %s [%s]",
- pv_max_name_len, pv_tmp_name,
- vg_max_name_len, " ",
- pv->fmt ? pv->fmt->name : " ",
- display_size(cmd, pv_size(pv)));
+ log_print_unless_silent("PV %-*s %-*s %s [%s]",
+ pv_max_name_len, pv_tmp_name,
+ vg_max_name_len, " ",
+ pv->fmt ? pv->fmt->name : " ",
+ display_size(cmd, pv_size(pv)));
return;
}
if (pv_status(pv) & EXPORTED_VG) {
strncpy(vg_name_this, pv_vg_name(pv), vg_name_len);
- log_print("PV %-*s is in exported VG %s "
- "[%s / %s free]",
- pv_max_name_len, pv_tmp_name,
- vg_name_this,
- display_size(cmd, (uint64_t) pv_pe_count(pv) *
- pv_pe_size(pv)),
- display_size(cmd, (uint64_t) (pv_pe_count(pv) -
- pv_pe_alloc_count(pv))
- * pv_pe_size(pv)));
+ log_print_unless_silent("PV %-*s is in exported VG %s "
+ "[%s / %s free]",
+ pv_max_name_len, pv_tmp_name,
+ vg_name_this,
+ display_size(cmd, (uint64_t) pv_pe_count(pv) * pv_pe_size(pv)),
+ display_size(cmd, (uint64_t) (pv_pe_count(pv) - pv_pe_alloc_count(pv)) * pv_pe_size(pv)));
return;
}
sprintf(vg_tmp_name, "%s", pv_vg_name(pv));
- log_print("PV %-*s VG %-*s %s [%s / %s free]", pv_max_name_len,
- pv_tmp_name, vg_max_name_len, vg_tmp_name,
- pv->fmt ? pv->fmt->name : " ",
- display_size(cmd, (uint64_t) pv_pe_count(pv) *
- pv_pe_size(pv)),
- display_size(cmd, (uint64_t) (pv_pe_count(pv) -
- pv_pe_alloc_count(pv)) *
- pv_pe_size(pv)));
+ log_print_unless_silent("PV %-*s VG %-*s %s [%s / %s free]", pv_max_name_len,
+ pv_tmp_name, vg_max_name_len, vg_tmp_name,
+ pv->fmt ? pv->fmt->name : " ",
+ display_size(cmd, (uint64_t) pv_pe_count(pv) * pv_pe_size(pv)),
+ display_size(cmd, (uint64_t) (pv_pe_count(pv) - pv_pe_alloc_count(pv)) * pv_pe_size(pv)));
}
static int _auto_activation_handler(struct volume_group *vg, int partial,
@@ -223,8 +217,8 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv)
break;
}
- log_print("Device %s not found. "
- "Cleared from lvmetad cache.", buf ? : "");
+ log_print_unless_silent("Device %s not found. "
+ "Cleared from lvmetad cache.", buf ? : "");
if (buf)
dm_free(buf);
continue;
@@ -355,17 +349,17 @@ int pvscan(struct cmd_context *cmd, int argc, char **argv)
}
if (!pvs_found) {
- log_print("No matching physical volumes found");
+ log_print_unless_silent("No matching physical volumes found");
unlock_vg(cmd, VG_GLOBAL);
return ECMD_PROCESSED;
}
- log_print("Total: %d [%s] / in use: %d [%s] / in no VG: %d [%s]",
- pvs_found,
- display_size(cmd, size_total),
- pvs_found - new_pvs_found,
- display_size(cmd, (size_total - size_new)),
- new_pvs_found, display_size(cmd, size_new));
+ log_print_unless_silent("Total: %d [%s] / in use: %d [%s] / in no VG: %d [%s]",
+ pvs_found,
+ display_size(cmd, size_total),
+ pvs_found - new_pvs_found,
+ display_size(cmd, (size_total - size_new)),
+ new_pvs_found, display_size(cmd, size_new));
unlock_vg(cmd, VG_GLOBAL);
diff --git a/tools/toollib.c b/tools/toollib.c
index d6fc9519..1916bfde 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1527,13 +1527,13 @@ static int _validate_stripe_params(struct cmd_context *cmd, uint32_t *stripes,
uint32_t *stripe_size)
{
if (*stripes == 1 && *stripe_size) {
- log_print("Ignoring stripesize argument with single stripe");
+ log_print_unless_silent("Ignoring stripesize argument with single stripe");
*stripe_size = 0;
}
if (*stripes > 1 && !*stripe_size) {
*stripe_size = find_config_tree_int(cmd, "metadata/stripesize", DEFAULT_STRIPESIZE) * 2;
- log_print("Using default stripesize %s",
+ log_print_unless_silent("Using default stripesize %s",
display_size(cmd, (uint64_t) *stripe_size));
}
diff --git a/tools/vgcfgbackup.c b/tools/vgcfgbackup.c
index c5d712f1..32948d87 100644
--- a/tools/vgcfgbackup.c
+++ b/tools/vgcfgbackup.c
@@ -81,7 +81,7 @@ static int vg_backup_single(struct cmd_context *cmd, const char *vg_name,
}
}
- log_print("Volume group \"%s\" successfully backed up.", vg_name);
+ log_print_unless_silent("Volume group \"%s\" successfully backed up.", vg_name);
return ECMD_PROCESSED;
}
diff --git a/tools/vgcfgrestore.c b/tools/vgcfgrestore.c
index 9715c935..d62df99f 100644
--- a/tools/vgcfgrestore.c
+++ b/tools/vgcfgrestore.c
@@ -70,7 +70,7 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
- log_print("Restored volume group %s", vg_name);
+ log_print_unless_silent("Restored volume group %s", vg_name);
unlock_vg(cmd, VG_ORPHANS);
unlock_vg(cmd, vg_name);
diff --git a/tools/vgchange.c b/tools/vgchange.c
index c59d58e0..34f61674 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -194,9 +194,9 @@ static int _vgchange_monitoring(struct cmd_context *cmd, struct volume_group *vg
dmeventd_monitor_mode() != DMEVENTD_MONITOR_IGNORE) {
if (!_monitor_lvs_in_vg(cmd, vg, dmeventd_monitor_mode(), &monitored))
r = 0;
- log_print("%d logical volume(s) in volume group "
- "\"%s\" %smonitored",
- monitored, vg->name, (dmeventd_monitor_mode()) ? "" : "un");
+ log_print_unless_silent("%d logical volume(s) in volume group "
+ "\"%s\" %smonitored",
+ monitored, vg->name, (dmeventd_monitor_mode()) ? "" : "un");
}
return r;
@@ -209,9 +209,9 @@ static int _vgchange_background_polling(struct cmd_context *cmd, struct volume_g
if (lvs_in_vg_activated(vg) && background_polling()) {
polled = _poll_lvs_in_vg(cmd, vg);
if (polled)
- log_print("Background polling started for %d logical volume(s) "
- "in volume group \"%s\"",
- polled, vg->name);
+ log_print_unless_silent("Background polling started for %d logical volume(s) "
+ "in volume group \"%s\"",
+ polled, vg->name);
}
return 1;
@@ -260,8 +260,8 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
/* Print message only if there was not found a missing VG */
if (!vg->cmd_missing_vgs)
- log_print("%d logical volume(s) in volume group \"%s\" now active",
- lvs_in_vg_activated(vg), vg->name);
+ log_print_unless_silent("%d logical volume(s) in volume group \"%s\" now active",
+ lvs_in_vg_activated(vg), vg->name);
return r;
}
@@ -508,7 +508,7 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
backup(vg);
- log_print("Volume group \"%s\" successfully changed", vg->name);
+ log_print_unless_silent("Volume group \"%s\" successfully changed", vg->name);
}
if (arg_count(cmd, activate_ARG)) {
diff --git a/tools/vgconvert.c b/tools/vgconvert.c
index 1106724b..2ba40952 100644
--- a/tools/vgconvert.c
+++ b/tools/vgconvert.c
@@ -186,7 +186,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
"archived metadata.");
return ECMD_FAILED;
}
- log_print("Volume group %s successfully converted", vg_name);
+ log_print_unless_silent("Volume group %s successfully converted", vg_name);
backup(vg);
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index dcce544b..2b9fb2f0 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -119,8 +119,8 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
backup(vg);
- log_print("%s%colume group \"%s\" successfully created",
- clustered_message, *clustered_message ? 'v' : 'V', vg->name);
+ log_print_unless_silent("%s%colume group \"%s\" successfully created",
+ clustered_message, *clustered_message ? 'v' : 'V', vg->name);
release_vg(vg);
return ECMD_PROCESSED;
diff --git a/tools/vgexport.c b/tools/vgexport.c
index a1043d25..c573619d 100644
--- a/tools/vgexport.c
+++ b/tools/vgexport.c
@@ -44,7 +44,7 @@ static int vgexport_single(struct cmd_context *cmd __attribute__((unused)),
backup(vg);
- log_print("Volume group \"%s\" successfully exported", vg->name);
+ log_print_unless_silent("Volume group \"%s\" successfully exported", vg->name);
return ECMD_PROCESSED;
diff --git a/tools/vgextend.c b/tools/vgextend.c
index 161796ce..2ce7edbc 100644
--- a/tools/vgextend.c
+++ b/tools/vgextend.c
@@ -134,7 +134,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
goto_bad;
backup(vg);
- log_print("Volume group \"%s\" successfully extended", vg_name);
+ log_print_unless_silent("Volume group \"%s\" successfully extended", vg_name);
r = ECMD_PROCESSED;
bad:
diff --git a/tools/vgimport.c b/tools/vgimport.c
index 284f5361..5badcb5a 100644
--- a/tools/vgimport.c
+++ b/tools/vgimport.c
@@ -48,7 +48,7 @@ static int vgimport_single(struct cmd_context *cmd __attribute__((unused)),
backup(vg);
- log_print("Volume group \"%s\" successfully imported", vg->name);
+ log_print_unless_silent("Volume group \"%s\" successfully imported", vg->name);
return ECMD_PROCESSED;
diff --git a/tools/vgmerge.c b/tools/vgmerge.c
index 7b2183f3..2cecb059 100644
--- a/tools/vgmerge.c
+++ b/tools/vgmerge.c
@@ -148,8 +148,8 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
/* FIXME Remove /dev/vgfrom */
backup(vg_to);
- log_print("Volume group \"%s\" successfully merged into \"%s\"",
- vg_from->name, vg_to->name);
+ log_print_unless_silent("Volume group \"%s\" successfully merged into \"%s\"",
+ vg_from->name, vg_to->name);
r = ECMD_PROCESSED;
bad:
/*
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
index 975b9eab..1b04a492 100644
--- a/tools/vgreduce.c
+++ b/tools/vgreduce.c
@@ -193,7 +193,7 @@ static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
backup(vg);
- log_print("Removed \"%s\" from volume group \"%s\"", name, vg->name);
+ log_print_unless_silent("Removed \"%s\" from volume group \"%s\"", name, vg->name);
r = ECMD_PROCESSED;
bad:
if (pvl)
@@ -304,8 +304,8 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
backup(vg);
if (fixed) {
- log_print("Wrote out consistent volume group %s",
- vg_name);
+ log_print_unless_silent("Wrote out consistent volume group %s",
+ vg_name);
ret = ECMD_PROCESSED;
} else
ret = ECMD_FAILED;
diff --git a/tools/vgrename.c b/tools/vgrename.c
index 56031ec9..451d0854 100644
--- a/tools/vgrename.c
+++ b/tools/vgrename.c
@@ -177,8 +177,8 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
unlock_vg(cmd, vg_name_new);
unlock_and_release_vg(cmd, vg, vg_name_old);
- log_print("Volume group \"%s\" successfully renamed to \"%s\"",
- vg_name_old, vg_name_new);
+ log_print_unless_silent("Volume group \"%s\" successfully renamed to \"%s\"",
+ vg_name_old, vg_name_new);
/* FIXME lvmcache corruption - vginfo duplicated instead of renamed */
persistent_filter_wipe(cmd->filter);
diff --git a/tools/vgscan.c b/tools/vgscan.c
index f82c71f8..a34f3ba1 100644
--- a/tools/vgscan.c
+++ b/tools/vgscan.c
@@ -21,9 +21,9 @@ static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg,
void *handle __attribute__((unused)))
{
- log_print("Found %svolume group \"%s\" using metadata type %s",
- vg_is_exported(vg) ? "exported " : "", vg_name,
- vg->fid->fmt->name);
+ log_print_unless_silent("Found %svolume group \"%s\" using metadata type %s",
+ vg_is_exported(vg) ? "exported " : "", vg_name,
+ vg->fid->fmt->name);
check_current_backup(vg);
@@ -64,7 +64,7 @@ int vgscan(struct cmd_context *cmd, int argc, char **argv)
}
}
- log_print("Reading all physical volumes. This may take a while...");
+ log_print_unless_silent("Reading all physical volumes. This may take a while...");
maxret = process_each_vg(cmd, argc, argv, 0, NULL,
&vgscan_single);
diff --git a/tools/vgsplit.c b/tools/vgsplit.c
index 73f94a8d..3bbb9faf 100644
--- a/tools/vgsplit.c
+++ b/tools/vgsplit.c
@@ -493,9 +493,9 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
backup(vg_to);
- log_print("%s volume group \"%s\" successfully split from \"%s\"",
- existing_vg ? "Existing" : "New",
- vg_to->name, vg_from->name);
+ log_print_unless_silent("%s volume group \"%s\" successfully split from \"%s\"",
+ existing_vg ? "Existing" : "New",
+ vg_to->name, vg_from->name);
r = ECMD_PROCESSED;