public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW tools/vgrename.c
@ 2010-04-14 13:03 prajnoha
  0 siblings, 0 replies; 3+ messages in thread
From: prajnoha @ 2010-04-14 13:03 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2010-04-14 13:03:07

Modified files:
	.              : WHATS_NEW 
	tools          : vgrename.c 

Log message:
	Allow VGs with active LVs to be renamed.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1518&r2=1.1519
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72

--- LVM2/WHATS_NEW	2010/04/14 13:01:38	1.1518
+++ LVM2/WHATS_NEW	2010/04/14 13:03:06	1.1519
@@ -1,5 +1,6 @@
 Version 2.02.63 -  
 ================================
+  Allow VGs with active LVs to be renamed.
   Use UUIDs instead of names while processing event handlers.
   Only pass visible LVs to tools in cmdline VG name/tag expansions without -a.
   Use typedefs for toollib process_each functions.
--- LVM2/tools/vgrename.c	2010/03/16 16:57:05	1.71
+++ LVM2/tools/vgrename.c	2010/04/14 13:03:06	1.72
@@ -15,9 +15,9 @@
 
 #include "tools.h"
 
-static struct volume_group *vg_rename_old(struct cmd_context *cmd,
-					  const char *vg_name_old,
-					  const char *vgid)
+static struct volume_group *_get_old_vg_for_rename(struct cmd_context *cmd,
+						   const char *vg_name_old,
+						   const char *vgid)
 {
 	struct volume_group *vg;
 
@@ -29,18 +29,11 @@
 		return_NULL;
 	}
 
-	if (lvs_in_vg_activated(vg)) {
-		unlock_and_release_vg(cmd, vg, vg_name_old);
-		log_error("Volume group \"%s\" still has active LVs",
-			  vg_name_old);
-		/* FIXME Remove this restriction */
-		return NULL;
-	}
 	return vg;
 }
 
-static int vg_rename_new(struct cmd_context *cmd,
-			 const char *vg_name_new)
+static int _lock_new_vg_for_rename(struct cmd_context *cmd,
+				   const char *vg_name_new)
 {
 	int rc;
 
@@ -82,7 +75,7 @@
 	dev_dir = cmd->dev_dir;
 
 	if (!validate_vg_rename_params(cmd, vg_name_old, vg_name_new))
-		return 0;
+		return_0;
 
 	log_verbose("Checking for existing volume group \"%s\"", vg_name_old);
 
@@ -119,22 +112,23 @@
 		lock_vg_old_first = 0;
 
 	if (lock_vg_old_first) {
-		vg = vg_rename_old(cmd, vg_name_old, vgid);
+		vg = _get_old_vg_for_rename(cmd, vg_name_old, vgid);
 		if (!vg)
-			return 0;
+			return_0;
 
-		if (!vg_rename_new(cmd, vg_name_new)) {
+		if (!_lock_new_vg_for_rename(cmd, vg_name_new)) {
 			unlock_and_release_vg(cmd, vg, vg_name_old);
-			return 0;
+			return_0;
 		}
 	} else {
-		if (!vg_rename_new(cmd, vg_name_new)) {
-			return 0;
-		}
+		if (!_lock_new_vg_for_rename(cmd, vg_name_new))
+			return_0;
 
-		vg = vg_rename_old(cmd, vg_name_old, vgid);
-		if (!vg)
-			return 0;
+		vg = _get_old_vg_for_rename(cmd, vg_name_old, vgid);
+		if (!vg) {
+			unlock_vg(cmd, vg_name_new);
+			return_0;
+		}
 	}
 
 	if (!archive(vg))
@@ -170,8 +164,6 @@
 		}
 	}
 
-/******* FIXME Rename any active LVs! *****/
-
 	backup(vg);
 	backup_remove(cmd, vg_name_old);
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* LVM2 ./WHATS_NEW tools/vgrename.c
@ 2009-03-23 22:29 taka
  0 siblings, 0 replies; 3+ messages in thread
From: taka @ 2009-03-23 22:29 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	taka@sourceware.org	2009-03-23 22:29:07

Modified files:
	.              : WHATS_NEW 
	tools          : vgrename.c 

Log message:
	Remove old metadata backup file after renaming vg.
	
	Author: Takahiro Yasui <tyasui@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1069&r2=1.1070
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.58&r2=1.59

--- LVM2/WHATS_NEW	2009/03/23 21:56:32	1.1069
+++ LVM2/WHATS_NEW	2009/03/23 22:29:06	1.1070
@@ -9,6 +9,7 @@
   Fix unlocks in clvmd-corosync. Broken in 2.02.45.
   Fix error message when adding metadata directory to internal list fails.
   Fix size and error message of memory allocation at backup initialization.
+  Remove old metadata backup file after renaming vg.
 
 Version 2.02.45 - 3rd March 2009
 ================================
--- LVM2/tools/vgrename.c	2009/01/26 19:01:32	1.58
+++ LVM2/tools/vgrename.c	2009/03/23 22:29:06	1.59
@@ -149,6 +149,7 @@
 /******* FIXME Rename any active LVs! *****/
 
 	backup(vg);
+	backup_remove(cmd, vg_name_old);
 
 	unlock_vg(cmd, vg_name_new);
 	unlock_vg(cmd, vg_name_old);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* LVM2 ./WHATS_NEW tools/vgrename.c
@ 2008-04-30 14:34 agk
  0 siblings, 0 replies; 3+ messages in thread
From: agk @ 2008-04-30 14:34 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-04-30 14:34:02

Modified files:
	.              : WHATS_NEW 
	tools          : vgrename.c 

Log message:
	Don't touch /dev in vgrename if activation is disabled.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.866&r2=1.867
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52

--- LVM2/WHATS_NEW	2008/04/29 16:11:26	1.866
+++ LVM2/WHATS_NEW	2008/04/30 14:34:02	1.867
@@ -1,5 +1,6 @@
 Version 2.02.37 - 
 =================================
+  Don't touch /dev in vgrename if activation is disabled.
   Check lv_count in vg_validate.
   Add --prefixes to reporting tools for field name prefix output format.
 
--- LVM2/tools/vgrename.c	2008/04/08 12:49:21	1.51
+++ LVM2/tools/vgrename.c	2008/04/30 14:34:02	1.52
@@ -122,7 +122,7 @@
 	sprintf(old_path, "%s%s", dev_dir, vg_name_old);
 	sprintf(new_path, "%s%s", dev_dir, vg_name_new);
 
-	if (dir_exists(old_path)) {
+	if (activation() && dir_exists(old_path)) {
 		log_verbose("Renaming \"%s\" to \"%s\"", old_path, new_path);
 		if (test_mode())
 			log_verbose("Test mode: Skipping rename.");


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-14 13:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-14 13:03 LVM2 ./WHATS_NEW tools/vgrename.c prajnoha
  -- strict thread matches above, loose matches on Subject: below --
2009-03-23 22:29 taka
2008-04-30 14:34 agk

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).