Skip to contentSkip to conversation

LVM2 lib/metadata/metadata.c tools/vgextend.c

PATCH [email protected] 1 participant 1 message Jul 7, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2010-07-07 18:59:46

Modified files:
lib/metadata : metadata.c
tools : vgextend.c

Log message:
Add warning to vgextend and pvchange if metadataignore given on cmdline.

Warn the user then change the value of vg_mda_copies.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.384&r2=1.385
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56

lib/metadata/metadata.c +6 -1
@@ -4396,8 +4396,13 @@
 	 * This does not guarantee this PV's ignore bits will be
 	 * preserved in future operations.
 	 */
-	if (!is_orphan(pv) && vg_mda_copies(pv->vg))
+	if (!is_orphan(pv) &&
+	    vg_mda_copies(pv->vg) != VGMETADATACOPIES_UNMANAGED) {
+		log_warn("WARNING: Changing preferred number of copies of VG %s "
+			 "metadata from %"PRIu32" to %"PRIu32, pv_vg_name(pv),
+			 vg_mda_copies(pv->vg), vg_mda_used_count(pv->vg));
 		vg_set_mda_copies(pv->vg, vg_mda_used_count(pv->vg));
+	}
 
 	return 1;
 }
tools/vgextend.c +9 -0
@@ -63,6 +63,15 @@
 	if (!vg_extend(vg, argc, argv, &pp))
 		goto_bad;
 
+	if (arg_count(cmd, metadataignore_ARG) &&
+	    (vg_mda_copies(vg) != VGMETADATACOPIES_UNMANAGED) &&
+	    (vg_mda_copies(vg) != vg_mda_used_count(vg))) {
+		log_warn("WARNING: Changing preferred number of copies of VG %s "
+			 "metadata from %"PRIu32" to %"PRIu32, vg_name,
+			 vg_mda_copies(vg), vg_mda_used_count(vg));
+		vg_set_mda_copies(vg, vg_mda_used_count(vg));
+	}
+
 	/* ret > 0 */
 	log_verbose("Volume group \"%s\" will be extended by %d new "
 		    "physical volumes", vg_name, argc);