public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: jbrassow@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/metadata/lv_manip.c test/ ...
Date: Sat, 05 May 2012 02:08:00 -0000	[thread overview]
Message-ID: <20120505020848.8450.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	jbrassow@sourceware.org	2012-05-05 02:08:47

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	test/shell     : lvconvert-mirror.sh 

Log message:
	Fix up-convert when mirror activation is controled by volume_list and tags.
	
	When mirrors are up-converted, a transient mirror layer is put in so that
	only the new devices are sync'ed.  That transient layer must carry the tags
	of the original mirror LV, otherwise it will fail to activate when activation
	is regulated by lvm.conf:activation/volume_list.  The conversion would then
	fail.
	
	The fix is to do exactly the same thing that is being done for linear ->
	mirror converting (lib/metadata/mirror.c:_init_mirror_log()).  We copy the
	tags temporarily for the new LV and remove them after the activation.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2396&r2=1.2397
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.373&r2=1.374
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/shell/lvconvert-mirror.sh.diff?cvsroot=lvm2&r1=1.5&r2=1.6

--- LVM2/WHATS_NEW	2012/05/01 19:21:24	1.2396
+++ LVM2/WHATS_NEW	2012/05/05 02:08:46	1.2397
@@ -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.
--- LVM2/lib/metadata/lv_manip.c	2012/05/01 19:21:24	1.373
+++ LVM2/lib/metadata/lv_manip.c	2012/05/05 02:08:47	1.374
@@ -3682,9 +3682,10 @@
 					   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 @@
 			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 @@
 				  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",
--- LVM2/test/shell/lvconvert-mirror.sh	2012/03/16 13:00:06	1.5
+++ LVM2/test/shell/lvconvert-mirror.sh	2012/05/05 02:08:47	1.6
@@ -15,16 +15,28 @@
 	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


             reply	other threads:[~2012-05-05  2:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-05  2:08 jbrassow [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-01 19:21 jbrassow
2011-11-18 19:25 zkabelac
2011-06-23 10:53 mbroz
2009-06-01 15:55 mbroz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120505020848.8450.qmail@sourceware.org \
    --to=jbrassow@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).