All of lore.kernel.org
 help / color / mirror / Atom feed
From: wysochanski@sourceware.org <wysochanski@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/lib/metadata metadata.c
Date: 8 Apr 2010 15:18:35 -0000	[thread overview]
Message-ID: <20100408151835.31677.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski at sourceware.org	2010-04-08 15:18:35

Modified files:
	lib/metadata   : metadata.c 

Log message:
	Check for duplicate paths (pvids) on the commandline of vgcreate.
	
	A user specifying duplicate paths on the cmdline of vgcreate will
	get a message similar to the following:
	vgcreate vgtest2 /dev/loop3 /dev/loop5
	Found duplicate PV jk1lXsKzwyOKlXq6bhaFFKMQQ06oPgu8: using /dev/loop5 not /dev/loop3
	Found duplicate PV jk1lXsKzwyOKlXq6bhaFFKMQQ06oPgu8: using /dev/loop3 not /dev/loop5
	Internal error: Duplicate PV id jk1lXs-Kzwy-OKlX-q6bh-aFFK-MQQ0-6oPgu8 detected for /dev/loop3 in vgtest2.
	
	This is caught by vg_validate(), but it would be good to find
	this condition earlier in the vgcreate code.  add_pv_to_vg()
	currently checks by pvname, but does not look for duplcate pvids.
	This patch adds the check for duplicate pvids and results in new
	error output as follows:
	vgcreate vgtest2 /dev/loop3 /dev/loop5
	Found duplicate PV jk1lXsKzwyOKlXq6bhaFFKMQQ06oPgu8: using /dev/loop5 not /dev/loop3
	Found duplicate PV jk1lXsKzwyOKlXq6bhaFFKMQQ06oPgu8: using /dev/loop3 not /dev/loop5
	Physical volume '/dev/loop5 (jk1lXs-Kzwy-OKlX-q6bh-aFFK-MQQ0-6oPgu8)' listed more than once.
	Unable to add physical volume '/dev/loop5' to volume group 'vgtest2'.
	
	Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.331&r2=1.332

--- LVM2/lib/metadata/metadata.c	2010/04/06 14:04:57	1.331
+++ LVM2/lib/metadata/metadata.c	2010/04/08 15:18:35	1.332
@@ -52,6 +52,9 @@
 static struct pv_list *_find_pv_in_vg(const struct volume_group *vg,
 				      const char *pv_name);
 
+static struct pv_list *_find_pv_in_vg_by_uuid(const struct volume_group *vg,
+					      const struct id *id);
+
 static uint32_t _vg_bad_status_bits(const struct volume_group *vg,
 				    uint64_t status);
 
@@ -160,6 +163,7 @@
 	struct pv_list *pvl;
 	struct format_instance *fid = vg->fid;
 	struct dm_pool *mem = vg->vgmem;
+	char uuid[64] __attribute((aligned(8)));
 
 	log_verbose("Adding physical volume '%s' to volume group '%s'",
 		    pv_name, vg->name);
@@ -211,9 +215,14 @@
 		return 0;
 	}
 
-	if (_find_pv_in_vg(vg, pv_name)) {
-		log_error("Physical volume '%s' listed more than once.",
-			  pv_name);
+	if (_find_pv_in_vg(vg, pv_name) ||
+	    _find_pv_in_vg_by_uuid(vg, &pv->id)) {
+		if (!id_write_format(&pv->id, uuid, sizeof(uuid))) {
+			stack;
+			uuid[0] = '\0';
+		}
+		log_error("Physical volume '%s (%s)' listed more than once.",
+			  pv_name, uuid);
 		return 0;
 	}
 



             reply	other threads:[~2010-04-08 15:18 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08 15:18 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-12 14:43 LVM2/lib/metadata metadata.c zkabelac
2012-03-01  9:46 zkabelac
2012-02-29  0:19 mornfall
2012-02-29  0:18 mornfall
2012-02-28 11:10 zkabelac
2012-02-27  9:51 zkabelac
2012-02-12 20:19 agk
2012-01-25  8:50 zkabelac
2011-04-01 14:54 prajnoha
2011-03-30 13:35 zkabelac
2011-03-10 22:39 zkabelac
2011-02-21 12:13 prajnoha
2011-02-14 19:27 mornfall
2011-02-15  2:07 ` Alasdair G Kergon
2011-02-15 10:22   ` Milan Broz
2010-12-14 17:07 mornfall
2010-11-30 11:15 mornfall
2010-10-25 13:35 zkabelac
2010-07-30 16:47 wysochanski
2010-07-09 16:57 wysochanski
2010-07-08 17:41 wysochanski
2010-07-06 20:09 agk
2010-07-06 17:29 agk
2010-07-06 17:27 agk
2010-07-06 17:26 agk
2010-06-30 19:55 wysochanski
2010-06-30 14:54 agk
2010-06-30 14:52 agk
2010-06-30 14:48 wysochanski
2010-06-30 14:27 agk
2010-06-28 20:38 wysochanski
2010-06-28 20:38 wysochanski
2010-06-28 20:37 wysochanski
2010-06-28 20:35 wysochanski
2010-06-28 20:35 wysochanski
2010-04-06 14:03 wysochanski
2010-04-01 13:08 agk
2010-04-01 11:45 agk
2010-02-24 18:15 wysochanski
2010-01-21 21:04 wysochanski
2010-01-21 21:04 wysochanski
2010-01-07 14:29 zkabelac
2009-12-16 19:26 mornfall
2009-11-19 13:44 mornfall
2009-10-05 20:02 wysochanski
2009-10-05 20:02 wysochanski
2009-09-02 21:39 wysochanski
2009-08-10 17:15 wysochanski
2009-07-28 20:41 agk
2009-07-26 12:41 wysochanski
2009-07-26  1:53 wysochanski
2009-07-26  1:52 wysochanski
2009-07-24 15:15 wysochanski
2009-07-16 20:18 wysochanski
2009-07-01 17:03 wysochanski
2009-06-10 16:14 wysochanski
2009-05-13  1:48 agk
2009-04-28 17:46 wysochanski
2009-04-10 10:01 mbroz
2009-04-02 15:01 mbroz
2009-02-23 16:53 mbroz
2009-01-26 22:22 agk
2008-08-13 13:42 zkabelac
2008-01-22 16:02 agk
2008-01-16 22:52 agk
2007-10-12 21:08 wysochanski
2007-08-06 21:11 wysochanski
2007-07-12  4:12 wysochanski
2007-06-13 21:14 wysochanski
2007-06-12 21:39 wysochanski

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=20100408151835.31677.qmail@sourceware.org \
    --to=wysochanski@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.