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

Set vg_mda_copies when pvchange --metadataignore is given.

When a user explicitly sets a new mda ignore value for a PV, we
should update vg_mda_copies accordingly.  When the VG is written
out, the user would not want the new ignore state to get lost as
a result of the vg_mda_copies value and logic in the vg_write
path.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2010-06-28 20:38:06 +00:00
parent 074c1880ff
commit d575dfe440

View File

@ -147,6 +147,17 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
if (!pv_mda_set_ignored(pv, mda_ignore)) {
goto out;
}
/*
* Update vg_mda_copies based on the mdas in this PV.
* This is most likely what the user would expect - if they
* specify a specific PV to be ignored/un-ignored, they will
* most likely not want LVM to turn around and change the
* ignore / un-ignore value when it writes the VG to disk.
* This does not guarantee this PV's ignore bits will be
* preserved in future operations.
*/
if (!is_orphan(pv) && vg_mda_copies(vg))
vg_set_mda_copies(vg, vg_mda_used_count(vg));
} else {
/* --uuid: Change PV ID randomly */
if (!id_create(&pv->id)) {