mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Fix confusing metadata syntax error messages.
If there is syntax error in metadata, it now prints messages like: Couldn't read 'start_extent' for segment 'extent_count'. Couldn't read all logical volumes for volume group vg_test. The segment specification is wrong and confusing. Patch fixes it by introducing "parent" member in config_node which points to parent section and config_parent_name function, which provides pointer to node section name. Also it adds several LV references where possible.
This commit is contained in:
parent
7fdf112457
commit
25497e2fa5
@ -1,5 +1,7 @@
|
|||||||
Version 2.02.49 -
|
Version 2.02.49 -
|
||||||
================================
|
================================
|
||||||
|
Fix segment metadata read function errors to use proper segment name.
|
||||||
|
Add parent node to config_node structure.
|
||||||
Fix segment import functions to print segment name and logical volume name.
|
Fix segment import functions to print segment name and logical volume name.
|
||||||
Update vgsplit and vgcreate to call the new vg_create, then call 'set' fns.
|
Update vgsplit and vgcreate to call the new vg_create, then call 'set' fns.
|
||||||
Change vg_create to take minimal parameters, obtain a lock, and return vg_t.
|
Change vg_create to take minimal parameters, obtain a lock, and return vg_t.
|
||||||
|
@ -546,6 +546,7 @@ static struct config_node *_file(struct parser *p)
|
|||||||
root = n;
|
root = n;
|
||||||
else
|
else
|
||||||
l->sib = n;
|
l->sib = n;
|
||||||
|
n->parent = root;
|
||||||
l = n;
|
l = n;
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
@ -573,6 +574,7 @@ static struct config_node *_section(struct parser *p)
|
|||||||
root->child = n;
|
root->child = n;
|
||||||
else
|
else
|
||||||
l->sib = n;
|
l->sib = n;
|
||||||
|
n->parent = root;
|
||||||
l = n;
|
l = n;
|
||||||
}
|
}
|
||||||
match(TOK_SECTION_E);
|
match(TOK_SECTION_E);
|
||||||
@ -1251,6 +1253,10 @@ static unsigned _count_tokens(const char *str, unsigned len, int type)
|
|||||||
return count_chars(str, len, c);
|
return count_chars(str, len, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *config_parent_name(const struct config_node *n)
|
||||||
|
{
|
||||||
|
return (n->parent ? n->parent->key : "(root)");
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Heuristic function to make a quick guess as to whether a text
|
* Heuristic function to make a quick guess as to whether a text
|
||||||
* region probably contains a valid config "section". (Useful for
|
* region probably contains a valid config "section". (Useful for
|
||||||
|
@ -40,7 +40,7 @@ struct config_value {
|
|||||||
|
|
||||||
struct config_node {
|
struct config_node {
|
||||||
char *key;
|
char *key;
|
||||||
struct config_node *sib, *child;
|
struct config_node *parent, *sib, *child;
|
||||||
struct config_value *v;
|
struct config_value *v;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,4 +110,6 @@ int get_config_str(const struct config_node *cn, const char *path,
|
|||||||
|
|
||||||
unsigned maybe_config_section(const char *str, unsigned len);
|
unsigned maybe_config_section(const char *str, unsigned len);
|
||||||
|
|
||||||
|
const char *config_parent_name(const struct config_node *n);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -78,7 +78,7 @@ static int _mirrored_text_import_area_count(struct config_node *sn, uint32_t *ar
|
|||||||
{
|
{
|
||||||
if (!get_config_uint32(sn, "mirror_count", area_count)) {
|
if (!get_config_uint32(sn, "mirror_count", area_count)) {
|
||||||
log_error("Couldn't read 'mirror_count' for "
|
log_error("Couldn't read 'mirror_count' for "
|
||||||
"segment '%s'.", sn->key);
|
"segment '%s'.", config_parent_name(sn));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,8 @@ static int _mirrored_text_import(struct lv_segment *seg, const struct config_nod
|
|||||||
seg->status |= PVMOVE;
|
seg->status |= PVMOVE;
|
||||||
else {
|
else {
|
||||||
log_error("Couldn't read 'extents_moved' for "
|
log_error("Couldn't read 'extents_moved' for "
|
||||||
"segment '%s'.", sn->key);
|
"segment %s of logical volume %s.",
|
||||||
|
config_parent_name(sn), seg->lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +107,8 @@ static int _mirrored_text_import(struct lv_segment *seg, const struct config_nod
|
|||||||
if (!get_config_uint32(sn, "region_size",
|
if (!get_config_uint32(sn, "region_size",
|
||||||
&seg->region_size)) {
|
&seg->region_size)) {
|
||||||
log_error("Couldn't read 'region_size' for "
|
log_error("Couldn't read 'region_size' for "
|
||||||
"segment '%s'.", sn->key);
|
"segment %s of logical volume %s.",
|
||||||
|
config_parent_name(sn), seg->lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,22 +120,25 @@ static int _mirrored_text_import(struct lv_segment *seg, const struct config_nod
|
|||||||
}
|
}
|
||||||
logname = cn->v->v.str;
|
logname = cn->v->v.str;
|
||||||
if (!(seg->log_lv = find_lv(seg->lv->vg, logname))) {
|
if (!(seg->log_lv = find_lv(seg->lv->vg, logname))) {
|
||||||
log_error("Unrecognised mirror log in segment %s.",
|
log_error("Unrecognised mirror log in "
|
||||||
sn->key);
|
"segment %s of logical volume %s.",
|
||||||
|
config_parent_name(sn), seg->lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
seg->log_lv->status |= MIRROR_LOG;
|
seg->log_lv->status |= MIRROR_LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (logname && !seg->region_size) {
|
if (logname && !seg->region_size) {
|
||||||
log_error("Missing region size for mirror log for segment "
|
log_error("Missing region size for mirror log for "
|
||||||
"'%s'.", sn->key);
|
"segment %s of logical volume %s.",
|
||||||
|
config_parent_name(sn), seg->lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cn = find_config_node(sn, "mirrors"))) {
|
if (!(cn = find_config_node(sn, "mirrors"))) {
|
||||||
log_error("Couldn't find mirrors array for segment "
|
log_error("Couldn't find mirrors array for "
|
||||||
"'%s'.", sn->key);
|
"segment %s of logical volume %s.",
|
||||||
|
config_parent_name(sn), seg->lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ static int _striped_text_import_area_count(struct config_node *sn, uint32_t *are
|
|||||||
{
|
{
|
||||||
if (!get_config_uint32(sn, "stripe_count", area_count)) {
|
if (!get_config_uint32(sn, "stripe_count", area_count)) {
|
||||||
log_error("Couldn't read 'stripe_count' for "
|
log_error("Couldn't read 'stripe_count' for "
|
||||||
"segment '%s'.", sn->key);
|
"segment '%s'.", config_parent_name(sn));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,14 +68,14 @@ static int _striped_text_import(struct lv_segment *seg, const struct config_node
|
|||||||
|
|
||||||
if ((seg->area_count != 1) &&
|
if ((seg->area_count != 1) &&
|
||||||
!get_config_uint32(sn, "stripe_size", &seg->stripe_size)) {
|
!get_config_uint32(sn, "stripe_size", &seg->stripe_size)) {
|
||||||
log_error("Couldn't read stripe_size for segment '%s'.",
|
log_error("Couldn't read stripe_size for segment %s "
|
||||||
sn->key);
|
"of logical volume %s.", config_parent_name(sn), seg->lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cn = find_config_node(sn, "stripes"))) {
|
if (!(cn = find_config_node(sn, "stripes"))) {
|
||||||
log_error("Couldn't find stripes array for segment "
|
log_error("Couldn't find stripes array for segment %s "
|
||||||
"'%s'.", sn->key);
|
"of logical volume %s.", config_parent_name(sn), seg->lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user