Skip to contentSkip to conversation

LVM2 man/vgsplit.8 tools/vgsplit.c test/t-vgsp ...

PATCH [email protected] 1 participant 1 message Jan 11, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2008-01-11 21:43:16

Modified files:
man : vgsplit.8
tools : vgsplit.c
Added files:
test : t-vgsplit-operation.sh

Log message:
Allow vgsplit into existing vg.
Add vgsplit tests to validate operation for new and existing vg destinations.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/vgsplit.8.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgsplit-operation.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.42&r2=1.43

man/vgsplit.8 +10 -8
@@ -10,20 +10,22 @@
 [\-M/\-\-metadatatype 1/2]
 [\-t/\-\-test] 
 [\-v/\-\-verbose] 
-ExistingVolumeGroupName NewVolumeGroupName
+SourceVolumeGroupName DestinationVolumeGroupName
 PhysicalVolumePath [PhysicalVolumePath...]
 .SH DESCRIPTION
 .B vgsplit 
-creates 
-.I NewVolumeGroupName
-and moves
+moves
 .IR PhysicalVolumePath (s)
 from
-.I ExistingVolumeGroupName
-into it.
+.I SourceVolumeGroupName
+into
+.I DestinationVolumeGroupName\fP.
+If
+.I DestinationVolumeGroupName
+does not exist, it will be created.
 Logical Volumes cannot be split between Volume Groups.
-Each existing Logical Volumes must be entirely on the Physical Volumes forming
-either the old or the new Volume Group.
+Each existing Logical Volume must be entirely on the Physical Volumes forming
+either the source or the destination Volume Group.
 .SH OPTIONS
 See \fBlvm\fP for common options.
 .SH SEE ALSO

/cvs/lvm2/LVM2/test/t-vgsplit-operation.sh,v --> standard output revision 1.1

- renamed from test/t-vgsplit-operation.sh +54 -0

54 lines not on this page · raw message

tools/vgsplit.c +17 -17
@@ -251,24 +251,24 @@
 	if ((vg_to = vg_lock_and_read(cmd, vg_name_to, NULL,
 				      LCK_VG_WRITE | LCK_NONBLOCK,
 				      0, 0))) {
-		/* FIXME Remove this restriction */
-		log_error("Volume group \"%s\" already exists", vg_name_to);
-		unlock_vg(cmd, vg_name_from);
-		return ECMD_FAILED;
-	}
-
-	/* Set metadata format of original VG */
-	/* FIXME: need some common logic */
-	cmd->fmt = vg_from->fid->fmt;
-
-	/* Create new VG structure */
-	if (!(vg_to = vg_create(cmd, vg_name_to, vg_from->extent_size,
-				vg_from->max_pv, vg_from->max_lv,
-				vg_from->alloc, 0, NULL)))
-		goto error;
+		log_warn("Volume group \"%s\" already exists", vg_name_to);
+		/* FIXME: check compatibility with existing vg, esp attribs */
+	} else {
+
+		/* Set metadata format of original VG */
+		/* FIXME: need some common logic */
+		cmd->fmt = vg_from->fid->fmt;
+
+		/* Create new VG structure */
+		/* FIXME: allow user input same params as to vgcreate tool */
+		if (!(vg_to = vg_create(cmd, vg_name_to, vg_from->extent_size,
+					vg_from->max_pv, vg_from->max_lv,
+					vg_from->alloc, 0, NULL)))
+			goto error;
 
-	if (vg_from->status & CLUSTERED)
-		vg_to->status |= CLUSTERED;
+		if (vg_from->status & CLUSTERED)
+			vg_to->status |= CLUSTERED;
+	}
 
 	/* Archive vg_from before changing it */
 	if (!archive(vg_from))