From 6078f63801335a9a08285a669e133b65c3ef59f0 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 6 Nov 2003 20:15:13 +0000 Subject: [PATCH] Prevent PV allocation bit getting changed for format_text orphans. --- lib/format1/format1.c | 2 +- lib/metadata/metadata.h | 1 + tools/pvchange.c | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/format1/format1.c b/lib/format1/format1.c index 18a7b197c..254b787df 100644 --- a/lib/format1/format1.c +++ b/lib/format1/format1.c @@ -530,7 +530,7 @@ struct format_type *init_format(struct cmd_context *cmd) fmt->ops = &_format1_ops; fmt->name = FMT_LVM1_NAME; fmt->alias = NULL; - fmt->features = FMT_RESTRICTED_LVIDS; + fmt->features = FMT_RESTRICTED_LVIDS | FMT_ORPHAN_ALLOCATABLE; fmt->private = NULL; if (!(fmt->labeller = lvm1_labeller_create(fmt))) { diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index 5dfb41e46..3d476e78b 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -54,6 +54,7 @@ #define FMT_TAGS 0x00000004 /* Tagging? */ #define FMT_UNLIMITED_VOLS 0x00000008 /* Unlimited PVs/LVs? */ #define FMT_RESTRICTED_LVIDS 0x00000010 /* LVID <= 255 */ +#define FMT_ORPHAN_ALLOCATABLE 0x00000020 /* Orphan PV allocatable? */ typedef enum { ALLOC_DEFAULT, diff --git a/tools/pvchange.c b/tools/pvchange.c index 980f56603..c70646cca 100644 --- a/tools/pvchange.c +++ b/tools/pvchange.c @@ -89,6 +89,14 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv, } + if (!*pv->vg_name && + !(pv->fmt->features & FMT_ORPHAN_ALLOCATABLE)) { + log_error("Allocatability not supported by orphan " + "%s format PV %s", pv->fmt->name, pv_name); + unlock_vg(cmd, ORPHAN); + return 0; + } + /* change allocatability for a PV */ if (allocatable && (pv->status & ALLOCATABLE_PV)) { log_error("Physical volume \"%s\" is already allocatable", -- 2.43.5