1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00

Allow only orphan PVs to be resized even with two metadata areas.

This commit is contained in:
Peter Rajnoha 2011-02-25 14:08:54 +00:00
parent 8a7a401cae
commit ed08b81e18
3 changed files with 18 additions and 1 deletions

View File

@ -2,7 +2,7 @@ Version 2.02.85 -
===================================
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.

View File

@ -2161,6 +2161,17 @@ static int _text_pv_resize(const struct format_type *fmt,
/* 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);

View File

@ -3543,6 +3543,12 @@ int pv_write(struct cmd_context *cmd __attribute__((unused)),
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);