diff --git a/lib/format_text/export.c b/lib/format_text/export.c index d88ed2886..1efe5add7 100644 --- a/lib/format_text/export.c +++ b/lib/format_text/export.c @@ -400,6 +400,10 @@ static int _print_segment(struct formatter *f, struct volume_group *vg, _outf(f, "%s_count = %u%s", type, seg->area_count, (seg->area_count == 1) ? "\t# linear" : ""); + if ((seg->type == SEG_MIRRORED) && (seg->status & PVMOVE)) + _out_size(f, (uint64_t) seg->extents_moved, + "extents_moved = %u", seg->extents_moved); + if ((seg->type == SEG_STRIPED) && (seg->area_count > 1)) _out_size(f, (uint64_t) seg->stripe_size, "stripe_size = %u", seg->stripe_size); diff --git a/lib/format_text/flags.c b/lib/format_text/flags.c index 1b85e847d..9a63273e2 100644 --- a/lib/format_text/flags.c +++ b/lib/format_text/flags.c @@ -22,7 +22,7 @@ static struct flag _vg_flags[] = { {EXPORTED_VG, "EXPORTED"}, {RESIZEABLE_VG, "RESIZEABLE"}, {PARTIAL_VG, "PARTIAL"}, - {PVMOVE_VG, "PVMOVE"}, + {PVMOVE, "PVMOVE"}, {LVM_READ, "READ"}, {LVM_WRITE, "WRITE"}, {CLUSTERED, "CLUSTERED"}, @@ -41,6 +41,8 @@ static struct flag _lv_flags[] = { {LVM_WRITE, "WRITE"}, {FIXED_MINOR, "FIXED_MINOR"}, {VISIBLE_LV, "VISIBLE"}, + {PVMOVE, "PVMOVE"}, + {LOCKED, "LOCKED"}, {0, NULL} }; diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index eaa74f54f..e8e342c03 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1147,7 +1147,7 @@ static int _pv_read(const struct format_type *fmt, const char *pv_name, } /* Perform full scan and try again */ - cache_label_scan(fmt->cmd, 0); + cache_label_scan(fmt->cmd, 1); if (info->vginfo && info->vginfo->vgname && *info->vginfo->vgname && _get_pv_from_vg(info->fmt, info->vginfo->vgname, info->dev->pvid, diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c index 11b4d56fb..41e1d29f1 100644 --- a/lib/format_text/import_vsn1.c +++ b/lib/format_text/import_vsn1.c @@ -221,7 +221,7 @@ static int _read_segment(struct pool *mem, struct volume_group *vg, struct config_value *cv; const char *seg_name = sn->key; uint32_t start_extent, extent_count; - uint32_t chunk_size; + uint32_t chunk_size, extents_moved = 0u, seg_status = 0u; const char *org_name, *cow_name; struct logical_volume *org, *cow, *lv1; segment_type_t segtype; @@ -267,6 +267,16 @@ static int _read_segment(struct pool *mem, struct volume_group *vg, "segment '%s'.", sn->key); return 0; } + + if (find_config_node(sn, "extents_moved", '/')) { + if (_read_uint32(sn, "extents_moved", &extents_moved)) + seg_status |= PVMOVE; + else { + log_error("Couldn't read 'extents_moved' for " + "segment '%s'.", sn->key); + return 0; + } + } } if (!(seg = pool_zalloc(mem, sizeof(*seg) + @@ -280,6 +290,8 @@ static int _read_segment(struct pool *mem, struct volume_group *vg, seg->len = extent_count; seg->area_len = extent_count; seg->type = segtype; + seg->status = seg_status; + seg->extents_moved = extents_moved; switch (segtype) { case SEG_SNAPSHOT: