===================================
Fix metadata balance code to work with recent changes in metadata handling.
Add old_uuid field to physical_volume and fix pvchange -u for recent changes.
- Allow pvresize on a PV with two metadata areas.
+ Allow pvresize on a PV with two metadata areas (for PVs not in a VG).
Change pvcreate to use new metadata handling interface.
Restructure existing pv_setup and pv_write fn, add pv_initialise fn.
Add internal interface to support adding and removing metadata areas.
/* If there's an mda at the end, move it to a new position. */
if ((mda = fid_get_mda_indexed(fid, pvid, ID_LEN, 1)) &&
(mdac = mda->metadata_locn)) {
+ /*
+ * FIXME: Remove this restriction - we need to
+ * allow writing PV labels on non-orphan VGs
+ * for this to work correctly.
+ */
+ if (vg) {
+ log_error("Resizing a PV with two metadata areas "
+ "that is part of a VG is not supported.");
+ return 0;
+ }
+
/* FIXME: Maybe MDA0 size would be better? */
mda_size = mdac->area.size >> SECTOR_SHIFT;
mda_ignored = mda_is_ignored(mda);
return 0;
}
+ /*
+ * FIXME: Try to remove this restriction. This requires checking
+ * that the PV and the VG are in a consistent state. We need
+ * to provide some revert mechanism since PV label together
+ * with VG metadata write is not atomic.
+ */
if (!is_orphan_vg(pv->vg_name) || pv->pe_alloc_count) {
log_error("Assertion failed: can't _pv_write non-orphan PV "
"(in VG %s)", pv->vg_name);