mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
pvs: display VG name [unknown] for used PV without metadata
Rather than displaying a blank field for VG name.
This commit is contained in:
parent
4013e21ba8
commit
250b915364
@ -3376,6 +3376,16 @@ static struct volume_group _dummy_vg = {
|
|||||||
.tags = DM_LIST_HEAD_INIT(_dummy_vg.tags),
|
.tags = DM_LIST_HEAD_INIT(_dummy_vg.tags),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct volume_group _unknown_vg = {
|
||||||
|
.fid = &_dummy_fid,
|
||||||
|
.name = "[unknown]",
|
||||||
|
.system_id = (char *) "",
|
||||||
|
.lvm1_system_id = (char *) "",
|
||||||
|
.pvs = DM_LIST_HEAD_INIT(_unknown_vg.pvs),
|
||||||
|
.lvs = DM_LIST_HEAD_INIT(_unknown_vg.lvs),
|
||||||
|
.tags = DM_LIST_HEAD_INIT(_unknown_vg.tags),
|
||||||
|
};
|
||||||
|
|
||||||
static void *_obj_get_vg(void *obj)
|
static void *_obj_get_vg(void *obj)
|
||||||
{
|
{
|
||||||
struct volume_group *vg = ((struct lvm_report_object *)obj)->vg;
|
struct volume_group *vg = ((struct lvm_report_object *)obj)->vg;
|
||||||
@ -3582,12 +3592,17 @@ int report_object(void *handle, int selection_only, const struct volume_group *v
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Never report orphan VGs. */
|
/* Never report orphan VGs. */
|
||||||
if (vg && is_orphan_vg(vg->name))
|
if (vg && is_orphan_vg(vg->name)) {
|
||||||
obj.vg = NULL;
|
obj.vg = &_dummy_vg;
|
||||||
|
if (pv)
|
||||||
|
_dummy_fid.fmt = pv->fmt;
|
||||||
|
}
|
||||||
|
|
||||||
/* The two format fields might as well match. */
|
if (vg && is_orphan_vg(vg->name) && is_used_pv(pv)) {
|
||||||
if (!obj.vg && pv)
|
obj.vg = &_unknown_vg;
|
||||||
_dummy_fid.fmt = pv->fmt;
|
if (pv)
|
||||||
|
_dummy_fid.fmt = pv->fmt;
|
||||||
|
}
|
||||||
|
|
||||||
return sh ? dm_report_object_is_selected(sh->selection_rh, &obj, 0, &sh->selected)
|
return sh ? dm_report_object_is_selected(sh->selection_rh, &obj, 0, &sh->selected)
|
||||||
: dm_report_object(handle, &obj);
|
: dm_report_object(handle, &obj);
|
||||||
|
Loading…
Reference in New Issue
Block a user