]> sourceware.org Git - lvm2.git/commitdiff
metadata: fix ALLOCATABLE_PV for lvm1 format
authorPeter Rajnoha <prajnoha@redhat.com>
Fri, 11 Jul 2014 10:24:15 +0000 (12:24 +0200)
committerPeter Rajnoha <prajnoha@redhat.com>
Fri, 11 Jul 2014 10:24:15 +0000 (12:24 +0200)
This is addendum for commit 6dc7b783c80c6834aa724df49b5d47b9b5601506.

LVM1 format stores the ALLOCATABLE flag directly in PV header, not
in VG metadata. So the code needs to be fixed further to work
properly for lvm1 format so that the correct PV header is written
(the flag is set only if the PV is in some VG, unset otherwise).

lib/format1/format1.c
lib/metadata/metadata.c

index 16746e3fcada0aef5c6d1610c95b023c81ee6706..8ee2f4876f18acad13ea5bac46777565c34f1601 100644 (file)
@@ -381,6 +381,7 @@ static int _format1_pv_setup(const struct format_type *fmt,
                             struct physical_volume *pv,
                             struct volume_group *vg)
 {
+       int r;
        struct pvcreate_restorable_params rp = {.restorefile = NULL,
                                                .id = {{0}},
                                                .idp = NULL,
@@ -390,7 +391,10 @@ static int _format1_pv_setup(const struct format_type *fmt,
                                                .extent_count = 0,
                                                .extent_size = vg->extent_size};
 
-       return _format1_pv_initialise(fmt, -1, 0, 0, &rp, pv);
+       if ((r = _format1_pv_initialise(fmt, -1, 0, 0, &rp, pv)))
+               pv->status |= ALLOCATABLE_PV;
+
+       return r;
 }
 
 static int _format1_lv_setup(struct format_instance *fid, struct logical_volume *lv)
index 2d697143c7ead690b47ecdb9f55449bb290e3e78..08327503b2a54c3d27d38003891922f237a91392 100644 (file)
@@ -602,7 +602,7 @@ int vg_remove(struct volume_group *vg)
                log_verbose("Removing physical volume \"%s\" from "
                            "volume group \"%s\"", pv_dev_name(pv), vg->name);
                pv->vg_name = vg->fid->fmt->orphan_vg_name;
-               pv->status ALLOCATABLE_PV;
+               pv->status &= ~ALLOCATABLE_PV;
 
                if (!dev_get_size(pv_dev(pv), &pv->size)) {
                        log_error("%s: Couldn't get size.", pv_dev_name(pv));
This page took 0.045197 seconds and 5 git commands to generate.