mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
report: add lv_pool_lv_uuid field
This commit is contained in:
parent
0e3042f488
commit
cb8f29d147
@ -303,18 +303,34 @@ char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *lv_pool_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
static char *_do_lv_pool_lv_dup(struct dm_pool *mem, const struct logical_volume *lv,
|
||||
int uuid)
|
||||
{
|
||||
struct lv_segment *seg;
|
||||
|
||||
dm_list_iterate_items(seg, &lv->segments)
|
||||
dm_list_iterate_items(seg, &lv->segments) {
|
||||
if (seg->pool_lv &&
|
||||
(seg_is_thin_volume(seg) || seg_is_cache(seg)))
|
||||
return dm_pool_strdup(mem, seg->pool_lv->name);
|
||||
(seg_is_thin_volume(seg) || seg_is_cache(seg))) {
|
||||
if (uuid)
|
||||
return lv_uuid_dup(mem, seg->pool_lv);
|
||||
else
|
||||
return lv_name_dup(mem, seg->pool_lv);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *lv_pool_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
return _do_lv_pool_lv_dup(mem, lv, 0);
|
||||
}
|
||||
|
||||
char *lv_pool_lv_uuid_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
return _do_lv_pool_lv_dup(mem, lv, 1);
|
||||
}
|
||||
|
||||
char *lv_data_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
struct lv_segment *seg = (lv_is_thin_pool(lv) || lv_is_cache_pool(lv)) ?
|
||||
|
@ -75,6 +75,8 @@ char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_data_lv_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_metadata_lv_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_pool_lv_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_pool_lv_uuid_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
|
||||
char *lv_modules_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_name_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_fullname_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
|
@ -82,6 +82,7 @@ FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, mirror_log, "For mirrors, the LV hold
|
||||
FIELD(LVS, lv, STR, "Data", lvid, 4, datalv, data_lv, "For thin and cache pools, the LV holding the associated data.", 0)
|
||||
FIELD(LVS, lv, STR, "Meta", lvid, 4, metadatalv, metadata_lv, "For thin and cache pools, the LV holding the associated metadata.", 0)
|
||||
FIELD(LVS, lv, STR, "Pool", lvid, 4, poollv, pool_lv, "For thin volumes, the thin pool LV for this volume.", 0)
|
||||
FIELD(LVS, lv, STR, "Pool UUID", lvid, 38, poollvuuid, pool_lv_uuid, "For thin volumes, the UUID of the thin pool LV for this volume.", 0)
|
||||
FIELD(LVS, lv, STR_LIST, "LV Tags", tags, 7, tags, lv_tags, "Tags, if any.", 0)
|
||||
FIELD(LVS, lv, STR, "LProfile", lvid, 8, lvprofile, lv_profile, "Configuration profile attached to this LV.", 0)
|
||||
FIELD(LVS, lv, STR, "Lock Args", lvid, 9, lvlockargs, lv_lockargs, "Lock args of the LV used by lvmlockd.", 0)
|
||||
|
@ -336,6 +336,8 @@ GET_LV_STR_PROPERTY_FN(metadata_lv, lv_metadata_lv_dup(lv->vg->vgmem, lv))
|
||||
#define _metadata_lv_set prop_not_implemented_set
|
||||
GET_LV_STR_PROPERTY_FN(pool_lv, lv_pool_lv_dup(lv->vg->vgmem, lv))
|
||||
#define _pool_lv_set prop_not_implemented_set
|
||||
GET_LV_STR_PROPERTY_FN(pool_lv_uuid, lv_pool_lv_uuid_dup(lv->vg->vgmem, lv))
|
||||
#define _pool_lv_uuid_set prop_not_implemented_set
|
||||
GET_LV_NUM_PROPERTY_FN(data_percent, _data_percent(lv))
|
||||
#define _data_percent_set prop_not_implemented_set
|
||||
GET_LV_NUM_PROPERTY_FN(metadata_percent, _metadata_percent(lv))
|
||||
|
@ -1650,20 +1650,39 @@ static int _metadatalv_disp(struct dm_report *rh, struct dm_pool *mem __attribut
|
||||
return _field_set_value(field, "", NULL);
|
||||
}
|
||||
|
||||
static int _poollv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
static int _do_poollv_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private __attribute__((unused)))
|
||||
const void *data, void *private,
|
||||
int uuid)
|
||||
{
|
||||
const struct logical_volume *lv = (const struct logical_volume *) data;
|
||||
struct lv_segment *seg = (lv_is_thin_volume(lv) || lv_is_cache(lv)) ?
|
||||
first_seg(lv) : NULL;
|
||||
|
||||
if (seg)
|
||||
if (seg) {
|
||||
if (uuid)
|
||||
return _uuid_disp(rh, mem, field, &seg->pool_lv->lvid.id[1], private);
|
||||
else
|
||||
return _lvname_disp(rh, mem, field, seg->pool_lv, private);
|
||||
}
|
||||
|
||||
return _field_set_value(field, "", NULL);
|
||||
}
|
||||
|
||||
static int _poollv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private __attribute__((unused)))
|
||||
{
|
||||
return _do_poollv_disp(rh, mem, field, data, private, 0);
|
||||
}
|
||||
|
||||
static int _poollvuuid_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private __attribute__((unused)))
|
||||
{
|
||||
return _do_poollv_disp(rh, mem, field, data, private, 1);
|
||||
}
|
||||
|
||||
static int _lvpath_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private __attribute__((unused)))
|
||||
|
Loading…
Reference in New Issue
Block a user