All of lore.kernel.org
 help / color / mirror / Atom feed
From: agk@sourceware.org <agk@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/tools vgrename.c
Date: 6 Jun 2008 16:13:40 -0000	[thread overview]
Message-ID: <20080606161340.25161.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk at sourceware.org	2008-06-06 16:13:40

Modified files:
	tools          : vgrename.c 

Log message:
	cache dropping needs to use old name not new
	rename variable to reduce confusion

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.53&r2=1.54

--- LVM2/tools/vgrename.c	2008/06/06 13:04:43	1.53
+++ LVM2/tools/vgrename.c	2008/06/06 16:13:35	1.54
@@ -28,7 +28,7 @@
 	char *vg_name_new;
 	const char *vgid = NULL, *vg_name, *vg_name_old;
 	char old_path[NAME_LEN], new_path[NAME_LEN];
-	struct volume_group *vg_old, *vg_new;
+	struct volume_group *vg, *vg_new;
 
 	vg_name_old = skip_dev_dir(cmd, old_vg_path, NULL);
 	vg_name_new = skip_dev_dir(cmd, new_vg_path, NULL);
@@ -75,22 +75,22 @@
 		return 0;
 	}
 
-	if (!(vg_old = vg_read(cmd, vg_name_old, vgid, &consistent)) || !consistent) {
+	if (!(vg = vg_read(cmd, vg_name_old, vgid, &consistent)) || !consistent) {
 		log_error("Volume group %s %s%s%snot found.", vg_name_old,
 		vgid ? "(" : "", vgid ? vgid : "", vgid ? ") " : "");
 		unlock_vg(cmd, vg_name_old);
 		return 0;
 	}
 
-	if (!vg_check_status(vg_old, CLUSTERED | LVM_WRITE)) {
+	if (!vg_check_status(vg, CLUSTERED | LVM_WRITE)) {
 		unlock_vg(cmd, vg_name_old);
 		return 0;
 	}
 
 	/* Don't return failure for EXPORTED_VG */
-	vg_check_status(vg_old, EXPORTED_VG);
+	vg_check_status(vg, EXPORTED_VG);
 
-	if (lvs_in_vg_activated_by_uuid_only(vg_old)) {
+	if (lvs_in_vg_activated_by_uuid_only(vg)) {
 		unlock_vg(cmd, vg_name_old);
 		log_error("Volume group \"%s\" still has active LVs",
 			  vg_name_old);
@@ -113,11 +113,14 @@
 		goto error;
 	}
 
-	if (!archive(vg_old))
+	if (!archive(vg))
 		goto error;
 
+	/* Remove references based on old name */
+	drop_cached_metadata(vg);
+
 	/* Change the volume group name */
-	vg_rename(cmd, vg_old, vg_name_new);
+	vg_rename(cmd, vg, vg_name_new);
 
 	sprintf(old_path, "%s%s", dev_dir, vg_name_old);
 	sprintf(new_path, "%s%s", dev_dir, vg_name_new);
@@ -133,17 +136,15 @@
 		}
 	}
 
-	drop_cached_metadata(vg_old);
-
 	/* store it on disks */
 	log_verbose("Writing out updated volume group");
-	if (!vg_write(vg_old) || !vg_commit(vg_old)) {
+	if (!vg_write(vg) || !vg_commit(vg)) {
 		goto error;
 	}
 
 /******* FIXME Rename any active LVs! *****/
 
-	backup(vg_old);
+	backup(vg);
 
 	unlock_vg(cmd, vg_name_new);
 	unlock_vg(cmd, vg_name_old);



             reply	other threads:[~2008-06-06 16:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-06 16:13 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-09-02 21:29 LVM2/tools vgrename.c wysochanski
2009-09-02 21:29 wysochanski
2009-07-01 17:02 wysochanski
2009-06-09 14:30 wysochanski
2007-08-31 19:09 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=20080606161340.25161.qmail@sourceware.org \
    --to=agk@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.