diff --git a/WHATS_NEW b/WHATS_NEW index df4bbd6db..6e59f72da 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.96 - ================================ + Fix up-convert when mirror activation is controled by volume_list and tags. Disallow snapshots of mirror segment type. Fix bug in cmirror that caused incorrect status info to print on some nodes. Remove statement that snapshots cannot be tagged from lvm man page. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 4f8158573..7150fa443 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -3682,9 +3682,10 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd, const char *layer_suffix) { int r; - struct logical_volume *layer_lv; char *name; size_t len; + struct str_list *sl; + struct logical_volume *layer_lv; struct segment_type *segtype; struct lv_segment *mapseg; unsigned exclusive = 0; @@ -3722,6 +3723,14 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd, return NULL; } + /* Temporary tags for activation of the transient LV */ + dm_list_iterate_items(sl, &lv_where->tags) + if (!str_list_add(cmd->mem, &layer_lv->tags, sl->str)) { + log_error("Aborting. Unable to tag" + " transient mirror layer."); + return NULL; + } + if (!vg_write(lv_where->vg)) { log_error("Failed to write intermediate VG %s metadata for mirror conversion.", lv_where->vg->name); return NULL; @@ -3744,6 +3753,11 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd, name, lv_where->vg->name); return NULL; } + + /* Remove the temporary tags */ + dm_list_iterate_items(sl, &lv_where->tags) + str_list_del(&layer_lv->tags, sl->str); + } log_very_verbose("Inserting layer %s for %s", diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh index 8b02dc84c..3f572e51c 100644 --- a/test/shell/lvconvert-mirror.sh +++ b/test/shell/lvconvert-mirror.sh @@ -15,16 +15,28 @@ wait_for_mirror_in_sync_() { while test $(get lv_field $1 copy_percent) != "100.00"; do sleep 1; done } -# convert from linear to 2-way mirror aux prepare_pvs 5 10 # FIXME - test fails with extent size < 512k vgcreate -c n -s 512k $vg $(cat DEVICES) +# convert from linear to 2-way mirror lvcreate -l2 -n $lv1 $vg "$dev1" lvconvert -i1 -m+1 $vg/$lv1 "$dev2" "$dev3:0-1" check mirror $vg $lv1 "$dev3" lvremove -ff $vg +# convert from linear to 2-way mirror - with tags and volume_list (bz683270) +lvcreate -l2 -n $lv1 $vg --addtag hello +lvconvert -i1 -m+1 $vg/$lv1 \ + --config 'activation { volume_list = [ "@hello" ] }' +lvremove -ff $vg + +# convert from 2-way to 3-way mirror - with tags and volume_list (bz683270) +lvcreate -l2 -m1 -n $lv1 $vg --addtag hello +lvconvert -i1 -m+1 $vg/$lv1 \ + --config 'activation { volume_list = [ "@hello" ] }' +lvremove -ff $vg + # convert from 2-way mirror to linear lvcreate -l2 -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:0-1" lvconvert -m-1 $vg/$lv1