1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

metadata: fix ALLOCATABLE_PV for lvm1 format

This is addendum for commit 6dc7b783c8.

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).
This commit is contained in:
Peter Rajnoha 2014-07-11 12:24:15 +02:00
parent fd5912762b
commit 5c3d894013
2 changed files with 6 additions and 2 deletions

View 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)

View 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));