mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Fix detection of exported LVM1 volume groups.
This commit is contained in:
parent
0cd797ec46
commit
eaabdc26ce
@ -255,21 +255,21 @@ static int _read_extents(struct disk_list *data)
|
|||||||
/*
|
/*
|
||||||
* If exported, remove "PV_EXP" from end of VG name
|
* If exported, remove "PV_EXP" from end of VG name
|
||||||
*/
|
*/
|
||||||
static void _munge_exported_vg(struct disk_list *data)
|
void munge_exported_vg(struct pv_disk *pvd, struct vg_disk *vgd)
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
size_t s;
|
size_t s;
|
||||||
|
|
||||||
/* Return if PV not in a VG or VG not exported */
|
/* Return if PV not in a VG or VG not exported */
|
||||||
if ((!*data->pvd.vg_name) || !(data->vgd.vg_status & VG_EXPORTED))
|
if ((!*pvd->vg_name) || (vgd && !(vgd->vg_status & VG_EXPORTED)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
l = strlen(data->pvd.vg_name);
|
l = strlen(pvd->vg_name);
|
||||||
s = sizeof(EXPORTED_TAG);
|
s = sizeof(EXPORTED_TAG);
|
||||||
if (!strncmp(data->pvd.vg_name + l - s + 1, EXPORTED_TAG, s))
|
if (!strncmp(pvd->vg_name + l - s + 1, EXPORTED_TAG, s))
|
||||||
data->pvd.vg_name[l - s + 1] = '\0';
|
pvd->vg_name[l - s + 1] = '\0';
|
||||||
|
|
||||||
data->pvd.pv_status |= VG_EXPORTED;
|
pvd->pv_status |= VG_EXPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct disk_list *__read_disk(const struct format_type *fmt,
|
static struct disk_list *__read_disk(const struct format_type *fmt,
|
||||||
@ -295,6 +295,9 @@ static struct disk_list *__read_disk(const struct format_type *fmt,
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If VG is exported, set VG name back to the real name */
|
||||||
|
munge_exported_vg(&dl->pvd, &dl->vgd);
|
||||||
|
|
||||||
if (!(info = lvmcache_add(fmt->labeller, dl->pvd.pv_uuid, dev,
|
if (!(info = lvmcache_add(fmt->labeller, dl->pvd.pv_uuid, dev,
|
||||||
dl->pvd.vg_name, NULL)))
|
dl->pvd.vg_name, NULL)))
|
||||||
stack;
|
stack;
|
||||||
@ -321,9 +324,6 @@ static struct disk_list *__read_disk(const struct format_type *fmt,
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If VG is exported, set VG name back to the real name */
|
|
||||||
_munge_exported_vg(dl);
|
|
||||||
|
|
||||||
/* Update VG cache with what we found */
|
/* Update VG cache with what we found */
|
||||||
/* vgcache_add(dl->pvd.vg_name, dl->vgd.vg_uuid, dev, fmt); */
|
/* vgcache_add(dl->pvd.vg_name, dl->vgd.vg_uuid, dev, fmt); */
|
||||||
|
|
||||||
|
@ -224,6 +224,7 @@ int export_uuids(struct disk_list *dl, struct volume_group *vg);
|
|||||||
void export_numbers(struct list *pvds, struct volume_group *vg);
|
void export_numbers(struct list *pvds, struct volume_group *vg);
|
||||||
|
|
||||||
void export_pv_act(struct list *pvds);
|
void export_pv_act(struct list *pvds);
|
||||||
|
void munge_exported_vg(struct pv_disk *pvd, struct vg_disk *vgd);
|
||||||
|
|
||||||
/* blech */
|
/* blech */
|
||||||
int get_free_vg_number(struct format_instance *fid, struct dev_filter *filter,
|
int get_free_vg_number(struct format_instance *fid, struct dev_filter *filter,
|
||||||
|
@ -51,6 +51,7 @@ static int _read(struct labeller *l, struct device *dev, char *buf,
|
|||||||
struct pv_disk *pvd = (struct pv_disk *) buf;
|
struct pv_disk *pvd = (struct pv_disk *) buf;
|
||||||
struct lvmcache_info *info;
|
struct lvmcache_info *info;
|
||||||
|
|
||||||
|
munge_exported_vg(pvd, NULL);
|
||||||
if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL)))
|
if (!(info = lvmcache_add(l, pvd->pv_uuid, dev, pvd->vg_name, NULL)))
|
||||||
return 0;
|
return 0;
|
||||||
*label = info->label;
|
*label = info->label;
|
||||||
|
Loading…
Reference in New Issue
Block a user