1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-04 12:22:00 +03:00

Tweak some error message levels.

This commit is contained in:
Alasdair Kergon
2002-01-27 21:30:47 +00:00
parent 2fb0db7710
commit 1176eb2597
11 changed files with 41 additions and 36 deletions

View File

@ -46,7 +46,8 @@ static int _rm_dir(struct volume_group *vg)
if (!build_vg_path(vg_path, sizeof(vg_path), if (!build_vg_path(vg_path, sizeof(vg_path),
vg->cmd->dev_dir, vg->name)) { vg->cmd->dev_dir, vg->name)) {
log_err("Couldn't remove volume group directory."); log_error("Couldn't construct name of volume group dir for %s",
vg->name);
return 0; return 0;
} }
@ -62,16 +63,16 @@ static int _mk_link(struct logical_volume *lv)
struct stat buf; struct stat buf;
if (!build_dm_path(lv_path, sizeof(lv_path), lv->vg->name, lv->name)) { if (!build_dm_path(lv_path, sizeof(lv_path), lv->vg->name, lv->name)) {
log_err("Couldn't create destination path for " log_error("Couldn't create destination pathname for "
"logical volume link."); "logical volume link for %s", lv->name);
return 0; return 0;
} }
if (!build_lv_link_path(link_path, sizeof(link_path), if (!build_lv_link_path(link_path, sizeof(link_path),
lv->vg->cmd->dev_dir, lv->vg->cmd->dev_dir,
lv->vg->name, lv->name)) { lv->vg->name, lv->name)) {
log_err("Couldn't create source path for " log_error("Couldn't create source pathname for "
"logical volume link."); "logical volume link %s", lv->name);
return 0; return 0;
} }
@ -107,7 +108,7 @@ static int _rm_link(struct logical_volume *lv, const char *lv_name)
if (!build_lv_link_path(link_path, sizeof(link_path), if (!build_lv_link_path(link_path, sizeof(link_path),
lv->vg->cmd->dev_dir, lv->vg->cmd->dev_dir,
lv->vg->name, lv->name)) { lv->vg->name, lv->name)) {
log_err("Couldn't create link path (in order to remove it."); log_error("Couldn't determine link pathname.");
return 0; return 0;
} }

View File

@ -554,12 +554,12 @@ find_config_str(struct config_node *cn,
struct config_node *n = find_config_node(cn, path, sep); struct config_node *n = find_config_node(cn, path, sep);
if (n && n->v->type == CFG_STRING) { if (n && n->v->type == CFG_STRING) {
log_debug("Setting %s to %s", path, n->v->v.str); log_very_verbose("Setting %s to %s", path, n->v->v.str);
return n->v->v.str; return n->v->v.str;
} }
if (fail) if (fail)
log_debug("%s not found in config: defaulting to %s", log_very_verbose("%s not found in config: defaulting to %s",
path, fail); path, fail);
return fail; return fail;
} }
@ -570,11 +570,12 @@ int find_config_int(struct config_node *cn, const char *path,
struct config_node *n = find_config_node(cn, path, sep); struct config_node *n = find_config_node(cn, path, sep);
if (n && n->v->type == CFG_INT) { if (n && n->v->type == CFG_INT) {
log_debug("Setting %s to %d", path, n->v->v.i); log_very_verbose("Setting %s to %d", path, n->v->v.i);
return n->v->v.i; return n->v->v.i;
} }
log_debug("%s not found in config: defaulting to %d", path, fail); log_very_verbose("%s not found in config: defaulting to %d",
path, fail);
return fail; return fail;
} }
@ -584,11 +585,11 @@ float find_config_float(struct config_node *cn, const char *path,
struct config_node *n = find_config_node(cn, path, sep); struct config_node *n = find_config_node(cn, path, sep);
if (n && n->v->type == CFG_FLOAT) { if (n && n->v->type == CFG_FLOAT) {
log_debug("Setting %s to %f", path, n->v->v.r); log_very_verbose("Setting %s to %f", path, n->v->v.r);
return n->v->v.r; return n->v->v.r;
} }
log_debug("%s not found in config: defaulting to %f", log_very_verbose("%s not found in config: defaulting to %f",
path, fail); path, fail);
return fail; return fail;

View File

@ -134,7 +134,8 @@ static int _munge_formats(struct pv_disk *pvd)
int read_pvd(struct device *dev, struct pv_disk *pvd) int read_pvd(struct device *dev, struct pv_disk *pvd)
{ {
if (dev_read(dev, 0, sizeof(*pvd), pvd) != sizeof(*pvd)) { if (dev_read(dev, 0, sizeof(*pvd), pvd) != sizeof(*pvd)) {
log_debug("Failed to read PV data from %s", dev_name(dev)); log_very_verbose("Failed to read PV data from %s",
dev_name(dev));
return 0; return 0;
} }
@ -350,12 +351,13 @@ static void _add_pv_to_list(struct list *head, struct disk_list *data)
if (!strncmp(data->pvd.pv_uuid, pvd->pv_uuid, if (!strncmp(data->pvd.pv_uuid, pvd->pv_uuid,
sizeof(pvd->pv_uuid))) { sizeof(pvd->pv_uuid))) {
if (MAJOR(data->dev->dev) != md_major()) { if (MAJOR(data->dev->dev) != md_major()) {
log_debug("Ignoring duplicate PV %s on %s", log_very_verbose("Ignoring duplicate PV %s on "
pvd->pv_uuid, dev_name(data->dev)); "%s", pvd->pv_uuid,
dev_name(data->dev));
return; return;
} }
log_debug("Duplicate PV %s - using md %s", log_very_verbose("Duplicate PV %s - using md %s",
pvd->pv_uuid, dev_name(data->dev)); pvd->pv_uuid, dev_name(data->dev));
list_del(pvdh); list_del(pvdh);
break; break;
} }
@ -596,7 +598,8 @@ int write_disks(struct list *pvs)
if (!(_write_all_pvd(dl))) if (!(_write_all_pvd(dl)))
fail; fail;
log_debug("Successfully wrote data to %s", dev_name(dl->dev)); log_very_verbose("Successfully wrote data to %s",
dev_name(dl->dev));
} }
return 1; return 1;

View File

@ -29,8 +29,8 @@ static int _check_vgs(struct list *pvs)
first = dl; first = dl;
else if (memcmp(&first->vgd, &dl->vgd, sizeof(first->vgd))) { else if (memcmp(&first->vgd, &dl->vgd, sizeof(first->vgd))) {
log_err("VG data differs between PVs %s and %s", log_error("VG data differs between PVs %s and %s",
dev_name(first->dev), dev_name(dl->dev)); dev_name(first->dev), dev_name(dl->dev));
return 0; return 0;
} }
pv_count++; pv_count++;
@ -359,8 +359,8 @@ static int _pv_setup(struct format_instance *fi, struct physical_volume *pv,
static int _lv_setup(struct format_instance *fi, struct logical_volume *lv) static int _lv_setup(struct format_instance *fi, struct logical_volume *lv)
{ {
if (lv->le_count > MAX_LE_TOTAL) { if (lv->le_count > MAX_LE_TOTAL) {
log_err("Format 1 logical volumes cannot contain more than " log_error("logical volumes cannot contain more than "
"%d extents.", MAX_LE_TOTAL); "%d extents.", MAX_LE_TOTAL);
return 0; return 0;
} }

View File

@ -55,7 +55,7 @@ static void _inc_indent(struct formatter *f)
static void _dec_indent(struct formatter *f) static void _dec_indent(struct formatter *f)
{ {
if (!f->indent--) { if (!f->indent--) {
log_debug("Indenting seems to have messed up\n"); log_error("Internal error tracking indentation");
f->indent = 0; f->indent = 0;
} }
} }

View File

@ -70,7 +70,7 @@ void print_log(int level, const char *file, int line, const char *format, ...)
#define log_err(x...) plog(_LOG_ERR, x) #define log_err(x...) plog(_LOG_ERR, x)
#define log_fatal(x...) plog(_LOG_FATAL, x) #define log_fatal(x...) plog(_LOG_FATAL, x)
#define stack log_debug( "s" ) #define stack log_debug( "s" ) /* Backtrace on error */
#define log_error(fmt, args...) log_err(fmt , ## args) #define log_error(fmt, args...) log_err(fmt , ## args)
#define log_print(fmt, args...) log_warn(fmt , ## args) #define log_print(fmt, args...) log_warn(fmt , ## args)

View File

@ -66,7 +66,7 @@ int _add_pv_to_vg(struct format_instance *fi, struct volume_group *vg,
pv->pe_allocated = 0; pv->pe_allocated = 0;
if (!fi->ops->pv_setup(fi, pv, vg)) { if (!fi->ops->pv_setup(fi, pv, vg)) {
log_debug("Format-specific setup of physical volume '%s' " log_error("Format-specific setup of physical volume '%s' "
"failed.", pv_name); "failed.", pv_name);
return 0; return 0;
} }

View File

@ -125,8 +125,8 @@ void pool_free(struct pool *p, void *ptr)
} }
if (!c) if (!c)
log_debug("pool_free asked to free a pointer " log_error("Internal error: pool_free asked to free pointer "
"that wasn't in the pool, doing nothing"); "not in pool");
else else
p->chunk = c; p->chunk = c;
} }

View File

@ -128,7 +128,7 @@ static void _calc_functions(struct matcher *m)
break; break;
default: default:
log_debug("unknown node type"); log_error("Internal error: Unknown calc node type");
} }
/* /*
@ -301,7 +301,7 @@ struct matcher *matcher_create(struct pool *mem,
/* parse this expression */ /* parse this expression */
if(!(rx = rx_parse_tok(scratch, all, ptr))) { if(!(rx = rx_parse_tok(scratch, all, ptr))) {
log_debug("Couldn't parse the regex"); log_error("Couldn't parse regex");
goto bad; goto bad;
} }

View File

@ -70,7 +70,7 @@ static int _get_token(struct parse_sp *ps)
range = 1; range = 1;
ptr++; ptr++;
if(ptr == ps->rx_end) { if(ptr == ps->rx_end) {
log_info("incomplete charset " log_error("Incomplete range"
"specification"); "specification");
return -1; return -1;
} }
@ -142,8 +142,8 @@ static int _get_token(struct parse_sp *ps)
/* escaped character */ /* escaped character */
ptr++; ptr++;
if(ptr >= ps->rx_end) { if(ptr >= ps->rx_end) {
log_info("badly quoted character at end " log_error("Badly quoted character at end "
"of expression"); "of expression");
ps->type = -1; ps->type = -1;
return -1; return -1;
} }
@ -210,7 +210,7 @@ static struct rx_node *_term(struct parse_sp *ps)
_get_token(ps); /* match '(' */ _get_token(ps); /* match '(' */
n = _or_term(ps); n = _or_term(ps);
if(ps->type != ')') { if(ps->type != ')') {
log_debug("missing ')' in regular expression"); log_error("missing ')' in regular expression");
return 0; return 0;
} }
_get_token(ps); /* match ')' */ _get_token(ps); /* match ')' */
@ -292,7 +292,7 @@ static struct rx_node *_or_term(struct parse_sp *ps)
_get_token(ps); /* match '|' */ _get_token(ps); /* match '|' */
if (!(r = _or_term(ps))) { if (!(r = _or_term(ps))) {
log_info("badly formed 'or' expression"); log_error("Badly formed 'or' expression");
return NULL; return NULL;
} }
@ -320,7 +320,7 @@ struct rx_node *rx_parse_tok(struct pool *mem,
_get_token(ps); /* load the first token */ _get_token(ps); /* load the first token */
if (!(r = _or_term(ps))) { if (!(r = _or_term(ps))) {
log_err("parse error in regex"); log_error("Parse error in regex");
pool_free(mem, ps); pool_free(mem, ps);
} }

View File

@ -35,7 +35,7 @@ int vgscan(int argc, char **argv)
log_verbose("Wiping internal cache of PVs in VGs"); log_verbose("Wiping internal cache of PVs in VGs");
vgcache_destroy(); vgcache_destroy();
log_print("Reading all physical volumes (this may take a while...)"); log_print("Reading all physical volumes. This may take a while...");
return process_each_vg(argc, argv, &vgscan_single); return process_each_vg(argc, argv, &vgscan_single);
} }