Skip to contentSkip to conversation

LVM2 ./WHATS_NEW tools/vgsplit.c

PATCH [email protected] 1 participant 1 message Jun 28, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2007-06-28 17:59:34

Modified files:
. : WHATS_NEW
tools : vgsplit.c

Log message:
Fix vgsplit if splitting all PVs from VG.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.642&r2=1.643
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgsplit.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.27 - 
 ================================
+  Fix vgsplit if splitting all PVs from VG.
   Fix lvmdiskscan volume reporting when run in the lvm shell
   Fix missing lvm_shell symbol in lvm2cmd library. (2.02.23)
   Add vg_status function and clean up vg->status in tools directory.
tools/vgsplit.c +6 -4
@@ -320,7 +320,7 @@
 		goto error;
 
 	/* Split metadata areas and check if both vgs have at least one area */
-	if (!(vg_split_mdas(cmd, vg_from, vg_to))) {
+	if (!(vg_split_mdas(cmd, vg_from, vg_to)) && vg_from->pv_count) {
 		log_error("Cannot split: Nowhere to store metadata for new Volume Group");
 		goto error;
 	}
@@ -344,10 +344,12 @@
 	backup(vg_to);
 
 	/* Write out updated old VG */
-	if (!vg_write(vg_from) || !vg_commit(vg_from))
-		goto error;
+	if (vg_from->pv_count) {
+		if (!vg_write(vg_from) || !vg_commit(vg_from))
+			goto error;
 
-	backup(vg_from);
+		backup(vg_from);
+	}
 
 	/* Remove EXPORTED flag from new VG */
 	consistent = 1;