master - metadata: fix ALLOCATABLE_PV for lvm1 format
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5c3d8940136f39a017ab434651789647161350b1 Commit: 5c3d8940136f39a017ab434651789647161350b1 Parent: fd5912762b4815deb7a58fc4c5971801888e0ed3 Author: Peter Rajnoha <[email protected]> AuthorDate: Fri Jul 11 12:24:15 2014 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Fri Jul 11 12:24:15 2014 +0200
metadata: fix ALLOCATABLE_PV for lvm1 format
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 | 6 +++++- lib/metadata/metadata.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
lib/format1/format1.c +5 -1
@@ -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)
lib/metadata/metadata.c +1 -1
@@ -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));