return 1;
}
+static int _raid_transient_status(struct dm_pool *mem,
+ struct lv_segment *seg,
+ char *params)
+{
+ int failed = 0, r = 0;
+ unsigned i;
+ struct lvinfo info;
+ struct logical_volume *lv;
+ struct dm_status_raid *sr;
+
+ log_debug("Raid transient status %s.", params);
+
+ if (!dm_get_status_raid(mem, params, &sr))
+ return_0;
+
+ if (sr->dev_count != seg->area_count) {
+ log_error("Active raid has a wrong number of raid images!");
+ log_error("Metadata says %u, kernel says %u.",
+ seg->area_count, sr->dev_count);
+ goto out;
+ }
+
+ if (seg->meta_areas)
+ for (i = 0; i < seg->area_count; ++i) {
+ lv = seg_metalv(seg, i);
+ if (!lv_info(lv->vg->cmd, lv, 0, &info, 0, 0)) {
+ log_error("Check for existence of raid meta %s failed.",
+ display_lvname(lv));
+ goto out;
+ }
+ }
+
+ for (i = 0; i < seg->area_count; ++i) {
+ lv = seg_lv(seg, i);
+ if (!lv_info(lv->vg->cmd, lv, 0, &info, 0, 0)) {
+ log_error("Check for existence of raid image %s failed.",
+ display_lvname(lv));
+ goto out;
+ }
+ if (sr->dev_health[i] == 'D') {
+ lv->status |= PARTIAL_LV;
+ ++failed;
+ }
+ }
+
+ /* Update PARTIAL_LV flags across the VG */
+ if (failed)
+ vg_mark_partial_lvs(lv->vg, 0);
+
+ r = 1;
+out:
+ dm_pool_free(mem, sr);
+
+ return r;
+}
+
static int _raid_target_present(struct cmd_context *cmd,
const struct lv_segment *seg __attribute__((unused)),
unsigned *attributes)
#ifdef DEVMAPPER_SUPPORT
.target_percent = _raid_target_percent,
.target_present = _raid_target_present,
+ .check_transient_status = _raid_transient_status,
.modules_needed = _raid_modules_needed,
# ifdef DMEVENTD
.target_monitored = _raid_target_monitored,