]> sourceware.org Git - lvm2.git/commitdiff
Prevent PV allocation bit getting changed for format_text orphans.
authorAlasdair Kergon <agk@redhat.com>
Thu, 6 Nov 2003 20:15:13 +0000 (20:15 +0000)
committerAlasdair Kergon <agk@redhat.com>
Thu, 6 Nov 2003 20:15:13 +0000 (20:15 +0000)
lib/format1/format1.c
lib/metadata/metadata.h
tools/pvchange.c

index 18a7b197cff78de6f53deecab18aae645aad0b5a..254b787df5a57656b61f6d20a83a4c7aad8cabd0 100644 (file)
@@ -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))) {
index 5dfb41e465a6926b38e02b02d0cacf7881ac4473..3d476e78b39c7892e431b3ffcf83d15af6688b0e 100644 (file)
@@ -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,
index 980f5660325935ae6e5f66fd193f7e466defe880..c70646cca23bcdfc1560a5528ba8220e894ba4ed 100644 (file)
@@ -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",
This page took 0.043009 seconds and 5 git commands to generate.