1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-09 01:18:39 +03:00

raid: adjust temporary logic in _lv_ativate_lv() to work for lvcreate; log messages

This commit is contained in:
Heinz Mauelshagen 2024-11-06 22:36:02 +01:00
parent 5df527eef9
commit 007fe46089
2 changed files with 13 additions and 9 deletions

View File

@ -1474,7 +1474,8 @@ static int _lv_activate_lv(const struct logical_volume *lv, struct lv_activate_o
*
* Has to be wired up in the "lvconvert --repair ... $RaidLV" code.
*/
if (seg_is_raid_with_meta(first_seg(lv))) {
if (strcmp(lv->vg->cmd->name, "lvcreate") &&
seg_is_raid_with_meta(first_seg(lv))) {
uint32_t failed_cnt;
struct lv_segment *raid_seg = first_seg(lv);
@ -1483,7 +1484,7 @@ static int _lv_activate_lv(const struct logical_volume *lv, struct lv_activate_o
if (failed_cnt) {
if (failed_cnt > raid_seg->segtype->parity_devs) {
log_error("%s has %u failed device%s which is more than the allowed %u",
log_error("Can't activate as %s has %u failed device%s which is more than the allowed %u",
display_lvname(lv), failed_cnt, failed_cnt > 1 ? "s" :"",
raid_seg->segtype->parity_devs);
return 0;

View File

@ -3239,7 +3239,7 @@ static int _sublv_is_degraded(const struct logical_volume *slv)
return !slv || lv_is_partial(slv) || lv_is_virtual(slv);
}
/* Return failed component SubLV count for @lv. */
/* Return failed component SubLV pair count for @lv. */
static uint32_t _lv_get_nr_failed_components(const struct logical_volume *lv)
{
uint32_t r = 0, s;
@ -7455,19 +7455,22 @@ static int _raid_count_or_clear_failed_devices(const struct logical_volume *lv,
const char *str;
if (!failed_sublvs)
str = "now fully operational";
str = "fully operational";
else if (failed_sublvs <= raid_seg->segtype->parity_devs)
str = "now degraded";
str = "degraded";
else
str = "still failed";
/* FIXME: log amount of actually cleared devices in superblock! */
log_print_unless_silent("%u transiently failed devices back online for %s %s. Please check content.",
failed_cnt - failed_sublvs, str, display_lvname(lv));
log_print_unless_silent("%u transiently failed devices back online for %s %s.%s",
failed_cnt - failed_sublvs, str, display_lvname(lv),
failed_cnt > raid_seg->segtype->parity_devs ? " Please check content." : "");
}
} else if (failed_devices)
*failed_devices = min(failed_sublvs, failed_cnt);
}
if (failed_devices)
*failed_devices = max(failed_sublvs, raid_seg->segtype->parity_devs);
return 1;
}