mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
improve error messages when command rules fail
When certain cmd def RULE's fail, the error messages can sometimes be confusing. This expands the error messages to help clarify why the rule failed, especially in cases where options are used incorrectly.
This commit is contained in:
parent
f2ee0e7aca
commit
0ab9e4b6a7
@ -677,7 +677,7 @@ DESC: Replace failed PVs in a raid or mirror LV.
|
|||||||
DESC: Repair a thin pool.
|
DESC: Repair a thin pool.
|
||||||
DESC: Repair a cache pool.
|
DESC: Repair a cache pool.
|
||||||
RULE: all not lv_is_locked lv_is_pvmove
|
RULE: all not lv_is_locked lv_is_pvmove
|
||||||
RULE: --poolmetadataspare Bool and LV_cache LV_cachepool LV_thinpool
|
RULE: --poolmetadataspare and LV_cache LV_cachepool LV_thinpool
|
||||||
|
|
||||||
lvconvert --replace PV LV_raid
|
lvconvert --replace PV LV_raid
|
||||||
OO: OO_LVCONVERT
|
OO: OO_LVCONVERT
|
||||||
|
@ -2819,7 +2819,7 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
if (rule->check_opts && (rule->rule == RULE_INVALID) && opts_match_count) {
|
if (rule->check_opts && (rule->rule == RULE_INVALID) && opts_match_count) {
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
|
opt_array_to_str(cmd, rule->check_opts, rule->check_opts_count, buf, sizeof(buf));
|
||||||
log_warn("Command on LV %s does not accept option %s.",
|
log_warn("Command on LV %s has invalid use of option %s.",
|
||||||
display_lvname(lv), buf);
|
display_lvname(lv), buf);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
@ -2837,8 +2837,12 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
/* Fail if the LV matches any of the invalid LV types. */
|
/* Fail if the LV matches any of the invalid LV types. */
|
||||||
|
|
||||||
if (rule->check_lvt_bits && (rule->rule == RULE_INVALID) && lv_types_match_bits) {
|
if (rule->check_lvt_bits && (rule->rule == RULE_INVALID) && lv_types_match_bits) {
|
||||||
log_warn("Command on LV %s does not accept LV type %s.",
|
if (rule->opts_count)
|
||||||
display_lvname(lv), lvtype ? lvtype->name : "unknown");
|
log_warn("Command on LV %s uses options invalid with LV type %s.",
|
||||||
|
display_lvname(lv), lvtype ? lvtype->name : "unknown");
|
||||||
|
else
|
||||||
|
log_warn("Command on LV %s with invalid LV type %s.",
|
||||||
|
display_lvname(lv), lvtype ? lvtype->name : "unknown");
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2847,8 +2851,12 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
if (rule->check_lvt_bits && (rule->rule == RULE_REQUIRE) && !lv_types_match_bits) {
|
if (rule->check_lvt_bits && (rule->rule == RULE_REQUIRE) && !lv_types_match_bits) {
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
lvt_bits_to_str(rule->check_lvt_bits, buf, sizeof(buf));
|
lvt_bits_to_str(rule->check_lvt_bits, buf, sizeof(buf));
|
||||||
log_warn("Command on LV %s does not accept LV type %s. Required LV types are %s.",
|
if (rule->opts_count)
|
||||||
display_lvname(lv), lvtype ? lvtype->name : "unknown", buf);
|
log_warn("Command on LV %s uses options that require LV types %s.",
|
||||||
|
display_lvname(lv), buf);
|
||||||
|
else
|
||||||
|
log_warn("Command on LV %s does not accept LV type %s. Required LV types are %s.",
|
||||||
|
display_lvname(lv), lvtype ? lvtype->name : "unknown", buf);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2857,8 +2865,12 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
if (rule->check_lvp_bits && (rule->rule == RULE_INVALID) && lv_props_match_bits) {
|
if (rule->check_lvp_bits && (rule->rule == RULE_INVALID) && lv_props_match_bits) {
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
lvp_bits_to_str(lv_props_match_bits, buf, sizeof(buf));
|
lvp_bits_to_str(lv_props_match_bits, buf, sizeof(buf));
|
||||||
log_warn("Command on LV %s does not accept LV with properties: %s.",
|
if (rule->opts_count)
|
||||||
display_lvname(lv), buf);
|
log_warn("Command on LV %s uses options that are invalid with LV properties: %s.",
|
||||||
|
display_lvname(lv), buf);
|
||||||
|
else
|
||||||
|
log_warn("Command on LV %s is invalid on LV with properties: %s.",
|
||||||
|
display_lvname(lv), buf);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2867,8 +2879,12 @@ static int _check_lv_rules(struct cmd_context *cmd, struct logical_volume *lv)
|
|||||||
if (rule->check_lvp_bits && (rule->rule == RULE_REQUIRE) && lv_props_unmatch_bits) {
|
if (rule->check_lvp_bits && (rule->rule == RULE_REQUIRE) && lv_props_unmatch_bits) {
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
lvp_bits_to_str(lv_props_unmatch_bits, buf, sizeof(buf));
|
lvp_bits_to_str(lv_props_unmatch_bits, buf, sizeof(buf));
|
||||||
log_warn("Command on LV %s requires LV with properties: %s.",
|
if (rule->opts_count)
|
||||||
display_lvname(lv), buf);
|
log_warn("Command on LV %s uses options that require LV properties: %s.",
|
||||||
|
display_lvname(lv), buf);
|
||||||
|
else
|
||||||
|
log_warn("Command on LV %s requires LV with properties: %s.",
|
||||||
|
display_lvname(lv), buf);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user