1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

raid: add messages to lvs command output in case RaidLVs require a refresh

If a RaidLV mapping is required to be refreshed as a result of temporarily failed
and recurred RAID leg device (pairs) caused by writes to the LV during failure,
the requirement is reported by volume health character r' in position 9 of the
LV's attribute field (see 'man lvs' about additional volume health characters).

As this character can be overlooked, this patch adds messages to the top
of the lvs command output informing the user explicitely about the fact.

(cherry picked from commit b69f73b13e)
This commit is contained in:
Heinz Mauelshagen 2023-12-06 12:58:14 +01:00 committed by Marian Csontos
parent fdfd76a3ff
commit 2e2e122eef

View File

@ -150,6 +150,13 @@ static int _check_merging_origin(const struct logical_volume *lv,
return 1;
}
static void _cond_warn_raid_volume_health(struct cmd_context *cmd, const struct logical_volume *lv)
{
if (lv_is_raid(lv) && !lv_raid_healthy(lv) && !lv_is_partial(lv))
log_warn("WARNING: RaidLV %s needs to be refreshed! See character 'r' at position 9 in the RaidLV's attributes%s.", display_lvname(lv),
arg_is_set(cmd, all_ARG) ? " and its SubLV(s)" : " and also its SubLV(s) with option '-a'");
}
static int _do_lvs_with_info_and_status_single(struct cmd_context *cmd,
const struct logical_volume *lv,
int do_info, int do_status,
@ -176,6 +183,8 @@ static int _do_lvs_with_info_and_status_single(struct cmd_context *cmd,
lv = lv->snapshot->lv;
}
_cond_warn_raid_volume_health(cmd, lv);
if (!report_object(sh ? : handle->custom_handle, sh != NULL,
lv->vg, lv, NULL, NULL, NULL, &status, NULL))
goto out;
@ -238,6 +247,8 @@ static int _do_segs_with_info_and_status_single(struct cmd_context *cmd,
seg = seg->lv->snapshot;
}
_cond_warn_raid_volume_health(cmd, seg->lv);
if (!report_object(sh ? : handle->custom_handle, sh != NULL,
seg->lv->vg, seg->lv, NULL, seg, NULL, &status, NULL))
goto_out;