From 7041b476acf362b69bceff0cd94c8041266f7576 Mon Sep 17 00:00:00 2001 From: Dave Wysochanski Date: Wed, 7 Jul 2010 18:59:45 +0000 Subject: [PATCH] Add warning to vgextend and pvchange if metadataignore given on cmdline. Warn the user then change the value of vg_mda_copies. Signed-off-by: Dave Wysochanski --- lib/metadata/metadata.c | 7 ++++++- tools/vgextend.c | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 543ad8308..c322e1d04 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -4396,8 +4396,13 @@ int pv_change_metadataignore(struct physical_volume *pv, uint32_t mda_ignored) * 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; } diff --git a/tools/vgextend.c b/tools/vgextend.c index 6d06c19fd..9c30184d5 100644 --- a/tools/vgextend.c +++ b/tools/vgextend.c @@ -63,6 +63,15 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv) 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);