mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-23 13:57:47 +03:00
Make warnings go to stderr. Change log_warn to that effect, log_print
continues to send messages to stdout.
This commit is contained in:
parent
5ee976d276
commit
764858fa12
@ -6,6 +6,7 @@ Version 2.02.27 -
|
||||
Add --ignoremonitoring to disable all dmeventd interaction.
|
||||
Remove get_ prefix from get_pv_* functions.
|
||||
clvmd-openais now uses cpg_local_get() to get nodeid, rather than Clm.
|
||||
Print warnings to stderr instead of stdout.
|
||||
|
||||
Version 2.02.26 - 15th June 2007
|
||||
================================
|
||||
|
@ -245,7 +245,7 @@ void set_activation(int act)
|
||||
log_verbose("Activation enabled. Device-mapper kernel "
|
||||
"driver will be used.");
|
||||
else
|
||||
log_print("WARNING: Activation disabled. No device-mapper "
|
||||
log_warn("WARNING: Activation disabled. No device-mapper "
|
||||
"interaction will be attempted.");
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ static int _process_config(struct cmd_context *cmd)
|
||||
}
|
||||
|
||||
if (*cmd->proc_dir && !dir_exists(cmd->proc_dir)) {
|
||||
log_error("Warning: proc dir %s not found - some checks will be bypassed",
|
||||
log_error("WARNING: proc dir %s not found - some checks will be bypassed",
|
||||
cmd->proc_dir);
|
||||
cmd->proc_dir[0] = '\0';
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ static int __backup(struct volume_group *vg)
|
||||
int backup(struct volume_group *vg)
|
||||
{
|
||||
if (!vg->cmd->backup_params->enabled || !vg->cmd->backup_params->dir) {
|
||||
log_print("WARNING: This metadata update is NOT backed up");
|
||||
log_warn("WARNING: This metadata update is NOT backed up");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1204,7 +1204,7 @@ static int _mda_setup(const struct format_type *fmt,
|
||||
|
||||
/* Ensure it's not going to be bigger than the disk! */
|
||||
if (start1 + mda_size1 > disk_size) {
|
||||
log_print("Warning: metadata area fills disk leaving no "
|
||||
log_warn("WARNING: metadata area fills disk leaving no "
|
||||
"space for data on %s.", dev_name(pv->dev));
|
||||
/* Leave some free space for rounding */
|
||||
/* Avoid empty data area as could cause tools problems */
|
||||
|
@ -214,7 +214,7 @@ int init_locking(int type, struct cmd_context *cmd)
|
||||
switch (type) {
|
||||
case 0:
|
||||
init_no_locking(&_locking, cmd);
|
||||
log_print("WARNING: Locking disabled. Be careful! "
|
||||
log_warn("WARNING: Locking disabled. Be careful! "
|
||||
"This could corrupt your metadata.");
|
||||
return 1;
|
||||
|
||||
@ -255,8 +255,8 @@ int init_locking(int type, struct cmd_context *cmd)
|
||||
if ((type == 2 || type == 3) &&
|
||||
find_config_tree_int(cmd, "locking/fallback_to_local_locking",
|
||||
DEFAULT_FALLBACK_TO_LOCAL_LOCKING)) {
|
||||
log_print("WARNING: Falling back to local file-based locking.");
|
||||
log_print("Volume Groups with the clustered attribute will "
|
||||
log_warn("WARNING: Falling back to local file-based locking.");
|
||||
log_warn("Volume Groups with the clustered attribute will "
|
||||
"be inaccessible.");
|
||||
if (init_file_locking(&_locking, cmd))
|
||||
return 1;
|
||||
|
@ -302,6 +302,9 @@ void print_log(int level, const char *file, int line, const char *format, ...)
|
||||
int bufused, n;
|
||||
const char *message;
|
||||
const char *trformat; /* Translated format string */
|
||||
int use_stderr = level & _LOG_STDERR;
|
||||
|
||||
level &= ~_LOG_STDERR;
|
||||
|
||||
if (_log_suppress == 2)
|
||||
return;
|
||||
@ -373,9 +376,9 @@ void print_log(int level, const char *file, int line, const char *format, ...)
|
||||
break;
|
||||
case _LOG_WARN:
|
||||
if (_verbose_level >= _LOG_WARN) {
|
||||
printf("%s%s", _cmd_name, _msg_prefix);
|
||||
vprintf(trformat, ap);
|
||||
putchar('\n');
|
||||
fprintf(use_stderr ? stderr : stdout, "%s%s", _cmd_name, _msg_prefix);
|
||||
vfprintf(use_stderr ? stderr : stdout, trformat, ap);
|
||||
fputc('\n', use_stderr ? stderr : stdout);
|
||||
}
|
||||
break;
|
||||
case _LOG_ERR:
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include <string.h> /* strerror() */
|
||||
#include <errno.h>
|
||||
|
||||
#define _LOG_STDERR 128 /* force things to go to stderr, even if loglevel
|
||||
would make them go to stdout */
|
||||
#define _LOG_DEBUG 7
|
||||
#define _LOG_INFO 6
|
||||
#define _LOG_NOTICE 5
|
||||
@ -116,14 +118,14 @@ void print_log(int level, const char *file, int line, const char *format, ...)
|
||||
#define log_debug(x...) plog(_LOG_DEBUG, x)
|
||||
#define log_info(x...) plog(_LOG_INFO, x)
|
||||
#define log_notice(x...) plog(_LOG_NOTICE, x)
|
||||
#define log_warn(x...) plog(_LOG_WARN, x)
|
||||
#define log_warn(x...) plog(_LOG_WARN | _LOG_STDERR, x)
|
||||
#define log_err(x...) plog(_LOG_ERR, x)
|
||||
#define log_fatal(x...) plog(_LOG_FATAL, x)
|
||||
|
||||
#define stack log_debug("<backtrace>") /* Backtrace on error */
|
||||
|
||||
#define log_error(args...) log_err(args)
|
||||
#define log_print(args...) log_warn(args)
|
||||
#define log_print(args...) plog(_LOG_WARN, args)
|
||||
#define log_verbose(args...) log_notice(args)
|
||||
#define log_very_verbose(args...) log_info(args)
|
||||
|
||||
|
@ -207,7 +207,7 @@ int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
|
||||
}
|
||||
|
||||
if (!consistent)
|
||||
log_error("Warning: Volume group %s is not consistent",
|
||||
log_warn("WARNING: Volume group %s is not consistent",
|
||||
vg_name);
|
||||
|
||||
list_iterate_items(pvl, &vg->pvs) {
|
||||
@ -641,7 +641,7 @@ static struct physical_volume *_pv_create(const struct format_type *fmt,
|
||||
|
||||
if (size) {
|
||||
if (size > pv->size)
|
||||
log_print("WARNING: %s: Overriding real size. "
|
||||
log_warn("WARNING: %s: Overriding real size. "
|
||||
"You could lose data.", dev_name(pv->dev));
|
||||
log_verbose("%s: Pretending size is %" PRIu64 " sectors.",
|
||||
dev_name(pv->dev), size);
|
||||
@ -1324,7 +1324,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
|
||||
return correct_vg;
|
||||
}
|
||||
|
||||
log_print("Inconsistent metadata found for VG %s - updating "
|
||||
log_warn("WARNING: Inconsistent metadata found for VG %s - updating "
|
||||
"to use version %u", vgname, correct_vg->seqno);
|
||||
|
||||
if (!vg_write(correct_vg)) {
|
||||
@ -1620,7 +1620,7 @@ struct list *get_pvs(struct cmd_context *cmd)
|
||||
continue;
|
||||
}
|
||||
if (!consistent)
|
||||
log_print("Warning: Volume Group %s is not consistent",
|
||||
log_warn("WARNING: Volume Group %s is not consistent",
|
||||
vgname);
|
||||
|
||||
/* Move PVs onto results list */
|
||||
|
@ -377,7 +377,7 @@ int reconfigure_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirr
|
||||
/* Unable to remove bad devices */
|
||||
return 0;
|
||||
|
||||
log_print("WARNING: Bad device removed from mirror volume, %s/%s",
|
||||
log_warn("WARNING: Bad device removed from mirror volume, %s/%s",
|
||||
mirrored_seg->lv->vg->name, mirrored_seg->lv->name);
|
||||
|
||||
log_policy = get_mirror_log_fault_policy(mirrored_seg->lv->vg->cmd);
|
||||
@ -394,15 +394,15 @@ int reconfigure_mirror_images(struct lv_segment *mirrored_seg, uint32_t num_mirr
|
||||
mirrored_seg->lv->vg->name, mirrored_seg->lv->name);
|
||||
else if (r > 0)
|
||||
/* Success in replacing device(s) */
|
||||
log_print("WARNING: Mirror volume, %s/%s restored - substitute for failed device found.",
|
||||
log_warn("WARNING: Mirror volume, %s/%s restored - substitute for failed device found.",
|
||||
mirrored_seg->lv->vg->name, mirrored_seg->lv->name);
|
||||
else
|
||||
/* Bad device removed, but not replaced because of policy */
|
||||
if (mirrored_seg->area_count == 1) {
|
||||
log_print("WARNING: Mirror volume, %s/%s converted to linear due to device failure.",
|
||||
log_warn("WARNING: Mirror volume, %s/%s converted to linear due to device failure.",
|
||||
mirrored_seg->lv->vg->name, mirrored_seg->lv->name);
|
||||
} else if (had_log && !mirrored_seg->log_lv) {
|
||||
log_print("WARNING: Mirror volume, %s/%s disk log removed due to device failure.",
|
||||
log_warn("WARNING: Mirror volume, %s/%s disk log removed due to device failure.",
|
||||
mirrored_seg->lv->vg->name, mirrored_seg->lv->name);
|
||||
}
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@ start()
|
||||
{
|
||||
ret=0
|
||||
# TODO do we want to separate out already active groups only?
|
||||
VGS=`vgs --noheadings -o name`
|
||||
VGS=`vgs --noheadings -o name 2> /dev/null`
|
||||
for vg in $VGS
|
||||
do
|
||||
action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y $vg || ret=$?
|
||||
@ -49,7 +49,7 @@ stop()
|
||||
echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
|
||||
return 1
|
||||
fi
|
||||
VGS=`vgs --noheadings -o name`
|
||||
VGS=`vgs --noheadings -o name 2> /dev/null`
|
||||
for vg in $VGS
|
||||
do
|
||||
action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n $vg || ret=$?
|
||||
|
@ -447,7 +447,7 @@ static int lvconvert_snapshot(struct cmd_context *cmd,
|
||||
}
|
||||
|
||||
if (!lp->zero || !(lv->status & LVM_WRITE))
|
||||
log_print("WARNING: \"%s\" not zeroed", lv->name);
|
||||
log_warn("WARNING: \"%s\" not zeroed", lv->name);
|
||||
else if (!set_lv(cmd, lv, 0, 0)) {
|
||||
log_error("Aborting. Failed to wipe snapshot "
|
||||
"exception store.");
|
||||
|
@ -693,7 +693,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
||||
init_mirror_in_sync(lp->nosync);
|
||||
|
||||
if (lp->nosync) {
|
||||
log_print("WARNING: New mirror won't be synchronised. "
|
||||
log_warn("WARNING: New mirror won't be synchronised. "
|
||||
"Don't read what you didn't write!");
|
||||
status |= MIRROR_NOTSYNCED;
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ static int _get_settings(struct cmd_context *cmd)
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
init_trust_cache(1);
|
||||
log_print("WARNING: Cache file of PVs will be trusted. "
|
||||
log_warn("WARNING: Cache file of PVs will be trusted. "
|
||||
"New devices holding PVs may get ignored.");
|
||||
} else
|
||||
init_trust_cache(0);
|
||||
|
@ -106,7 +106,7 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute((unused)),
|
||||
pv_parts_found = 0;
|
||||
|
||||
if (arg_count(cmd, lvmpartition_ARG))
|
||||
log_print("WARNING: only considering LVM devices");
|
||||
log_warn("WARNING: only considering LVM devices");
|
||||
|
||||
max_len = _get_max_dev_name_len(cmd->filter);
|
||||
|
||||
|
@ -155,14 +155,14 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
||||
if (vg->fid->fmt->features & FMT_SEGMENTS)
|
||||
lp->stripes = arg_uint_value(cmd, stripes_ARG, 1);
|
||||
else
|
||||
log_print("Varied striping not supported. Ignoring.");
|
||||
log_warn("Varied striping not supported. Ignoring.");
|
||||
}
|
||||
|
||||
if (arg_count(cmd, mirrors_ARG)) {
|
||||
if (vg->fid->fmt->features & FMT_SEGMENTS)
|
||||
lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 1) + 1;
|
||||
else
|
||||
log_print("Mirrors not supported. Ignoring.");
|
||||
log_warn("Mirrors not supported. Ignoring.");
|
||||
if (arg_sign_value(cmd, mirrors_ARG, 0) == SIGN_MINUS) {
|
||||
log_error("Mirrors argument may not be negative");
|
||||
return 0;
|
||||
@ -182,7 +182,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
||||
}
|
||||
|
||||
if (!(vg->fid->fmt->features & FMT_SEGMENTS))
|
||||
log_print("Varied stripesize not supported. Ignoring.");
|
||||
log_warn("Varied stripesize not supported. Ignoring.");
|
||||
else if (arg_uint_value(cmd, stripesize_ARG, 0) > vg->extent_size) {
|
||||
log_error("Reducing stripe size %s to maximum, "
|
||||
"physical extent size %s",
|
||||
@ -447,7 +447,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
||||
|
||||
if (lp->resize == LV_REDUCE) {
|
||||
if (lp->argc)
|
||||
log_print("Ignoring PVs on command line when reducing");
|
||||
log_warn("Ignoring PVs on command line when reducing");
|
||||
} else if (!(pvh = lp->argc ? create_pv_list(cmd->mem, vg, lp->argc,
|
||||
lp->argv, 1) : &vg->pvs)) {
|
||||
stack;
|
||||
@ -469,12 +469,12 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
||||
}
|
||||
|
||||
if (info.exists && !lp->resizefs && (lp->resize == LV_REDUCE)) {
|
||||
log_print("WARNING: Reducing active%s logical volume "
|
||||
log_warn("WARNING: Reducing active%s logical volume "
|
||||
"to %s", info.open_count ? " and open" : "",
|
||||
display_size(cmd, (uint64_t) lp->extents *
|
||||
vg->extent_size));
|
||||
|
||||
log_print("THIS MAY DESTROY YOUR DATA "
|
||||
log_warn("THIS MAY DESTROY YOUR DATA "
|
||||
"(filesystem etc.)");
|
||||
|
||||
if (!arg_count(cmd, force_ARG)) {
|
||||
|
@ -110,7 +110,7 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name)
|
||||
return 0;
|
||||
|
||||
if (pv && !is_orphan(pv) && arg_count(cmd, force_ARG)) {
|
||||
log_print("WARNING: Forcing physical volume creation on "
|
||||
log_warn("WARNING: Forcing physical volume creation on "
|
||||
"%s%s%s%s", name,
|
||||
!is_orphan(pv) ? " of volume group \"" : "",
|
||||
!is_orphan(pv) ? pv_vg_name(pv) : "",
|
||||
|
@ -62,7 +62,7 @@ static int pvremove_check(struct cmd_context *cmd, const char *name)
|
||||
}
|
||||
|
||||
if (arg_count(cmd, force_ARG)) {
|
||||
log_print("WARNING: Wiping physical volume label from "
|
||||
log_warn("WARNING: Wiping physical volume label from "
|
||||
"%s%s%s%s", name,
|
||||
!is_orphan(pv) ? " of volume group \"" : "",
|
||||
!is_orphan(pv) ? pv_vg_name(pv) : "",
|
||||
|
@ -111,7 +111,7 @@ static int _pvresize_single(struct cmd_context *cmd,
|
||||
|
||||
if (params->new_size) {
|
||||
if (params->new_size > size)
|
||||
log_print("WARNING: %s: Overriding real size. "
|
||||
log_warn("WARNING: %s: Overriding real size. "
|
||||
"You could lose data.", pv_name);
|
||||
log_verbose("%s: Pretending size is %" PRIu64 " not %" PRIu64
|
||||
" sectors.", pv_name, params->new_size, pv_size(pv));
|
||||
|
@ -120,7 +120,7 @@ int pvscan(struct cmd_context *cmd, int argc __attribute((unused)),
|
||||
}
|
||||
|
||||
if (arg_count(cmd, exported_ARG) || arg_count(cmd, novolumegroup_ARG))
|
||||
log_print("WARNING: only considering physical volumes %s",
|
||||
log_warn("WARNING: only considering physical volumes %s",
|
||||
arg_count(cmd, exported_ARG) ?
|
||||
"of exported volume group(s)" : "in no volume group");
|
||||
|
||||
|
@ -61,7 +61,7 @@ static int vg_backup_single(struct cmd_context *cmd, const char *vg_name,
|
||||
}
|
||||
|
||||
if (!consistent)
|
||||
log_error("Warning: Volume group \"%s\" inconsistent", vg_name);
|
||||
log_error("WARNING: Volume group \"%s\" inconsistent", vg_name);
|
||||
|
||||
if (arg_count(cmd, file_ARG)) {
|
||||
if (!(filename = _expand_filename(arg_value(cmd, file_ARG),
|
||||
|
@ -95,11 +95,11 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
|
||||
return ECMD_FAILED;
|
||||
|
||||
if (max_lv != vg->max_lv)
|
||||
log_error("Warning: Setting maxlogicalvolumes to %d "
|
||||
log_warn("WARNING: Setting maxlogicalvolumes to %d "
|
||||
"(0 means unlimited)", vg->max_lv);
|
||||
|
||||
if (max_pv != vg->max_pv)
|
||||
log_error("Warning: Setting maxphysicalvolumes to %d "
|
||||
log_warn("WARNING: Setting maxphysicalvolumes to %d "
|
||||
"(0 means unlimited)", vg->max_pv);
|
||||
|
||||
if (arg_count(cmd, addtag_ARG)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user