mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
report: add lv_convert_lv_uuid field
This commit is contained in:
parent
0a01c5aa36
commit
a54b4bba35
@ -443,7 +443,8 @@ int lv_kernel_major(const struct logical_volume *lv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
static char *_do_lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv,
|
||||
int uuid)
|
||||
{
|
||||
struct lv_segment *seg;
|
||||
|
||||
@ -452,12 +453,26 @@ char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
|
||||
/* Temporary mirror is always area_num == 0 */
|
||||
if (seg_type(seg, 0) == AREA_LV &&
|
||||
is_temporary_mirror_layer(seg_lv(seg, 0)))
|
||||
return dm_pool_strdup(mem, seg_lv(seg, 0)->name);
|
||||
is_temporary_mirror_layer(seg_lv(seg, 0))) {
|
||||
if (uuid)
|
||||
return lv_uuid_dup(mem, seg_lv(seg, 0));
|
||||
else
|
||||
return lv_name_dup(mem, seg_lv(seg, 0));
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
return _do_lv_convert_lv_dup(mem, lv, 0);
|
||||
}
|
||||
|
||||
char *lv_convert_lv_uuid_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
return _do_lv_convert_lv_dup(mem, lv, 1);
|
||||
}
|
||||
|
||||
static char *_do_lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv,
|
||||
int uuid)
|
||||
{
|
||||
|
@ -70,6 +70,7 @@ uint64_t lv_origin_size(const struct logical_volume *lv);
|
||||
char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_move_pv_uuid_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
char *lv_convert_lv_uuid_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
int lv_kernel_major(const struct logical_volume *lv);
|
||||
int lv_kernel_minor(const struct logical_volume *lv);
|
||||
char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
|
@ -80,6 +80,7 @@ FIELD(LVS, lv, NUM, "MaxSync", lvid, 7, raidmaxrecoveryrate, raid_max_recovery_r
|
||||
FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0)
|
||||
FIELD(LVS, lv, STR, "Move UUID", lvid, 38, movepvuuid, move_pv_uuid, "For pvmove, the UUID of Source PV of temporary LV created by pvmove.", 0)
|
||||
FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0)
|
||||
FIELD(LVS, lv, STR, "Convert", lvid, 38, convertlvuuid, convert_lv_uuid, "For lvconvert, UUID of temporary LV created by lvconvert.", 0)
|
||||
FIELD(LVS, lv, STR, "Log", lvid, 3, loglv, mirror_log, "For mirrors, the LV holding the synchronisation log.", 0)
|
||||
FIELD(LVS, lv, STR, "Log UUID", lvid, 38, loglvuuid, mirror_log_uuid, "For mirrors, the UUID of the LV holding the synchronisation log.", 0)
|
||||
FIELD(LVS, lv, STR, "Data", lvid, 4, datalv, data_lv, "For thin and cache pools, the LV holding the associated data.", 0)
|
||||
|
@ -328,6 +328,8 @@ GET_LV_STR_PROPERTY_FN(move_pv_uuid, lv_move_pv_uuid_dup(lv->vg->vgmem, lv))
|
||||
#define _move_pv_uuid_set prop_not_implemented_set
|
||||
GET_LV_STR_PROPERTY_FN(convert_lv, lv_convert_lv_dup(lv->vg->vgmem, lv))
|
||||
#define _convert_lv_set prop_not_implemented_set
|
||||
GET_LV_STR_PROPERTY_FN(convert_lv_uuid, lv_convert_lv_uuid_dup(lv->vg->vgmem, lv))
|
||||
#define _convert_lv_uuid_set prop_not_implemented_set
|
||||
GET_LV_STR_PROPERTY_FN(lv_tags, lv_tags_dup(lv))
|
||||
#define _lv_tags_set prop_not_implemented_set
|
||||
GET_LV_STR_PROPERTY_FN(mirror_log, lv_mirror_log_dup(lv->vg->vgmem, lv))
|
||||
|
@ -1940,17 +1940,37 @@ static int _movepvuuid_disp(struct dm_report *rh, struct dm_pool *mem __attribut
|
||||
return _do_movepv_disp(rh, mem, field, data, private, 1);
|
||||
}
|
||||
|
||||
static int _do_convertlv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private __attribute__((unused)),
|
||||
int uuid)
|
||||
{
|
||||
const struct logical_volume *lv = (const struct logical_volume *) data;
|
||||
const char *repstr;
|
||||
|
||||
if (uuid)
|
||||
repstr = lv_convert_lv_uuid_dup(mem, lv);
|
||||
else
|
||||
repstr = lv_convert_lv_dup(mem, lv);
|
||||
|
||||
if (repstr)
|
||||
return dm_report_field_string(rh, field, &repstr);
|
||||
|
||||
return _field_set_value(field, "", NULL);
|
||||
}
|
||||
|
||||
static int _convertlv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private __attribute__((unused)))
|
||||
{
|
||||
const struct logical_volume *lv = (const struct logical_volume *) data;
|
||||
const char *name;
|
||||
return _do_convertlv_disp(rh, mem, field, data, private, 0);
|
||||
}
|
||||
|
||||
if ((name = lv_convert_lv_dup(mem, lv)))
|
||||
return dm_report_field_string(rh, field, &name);
|
||||
|
||||
return _field_set_value(field, "", NULL);
|
||||
static int _convertlvuuid_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_convertlv_disp(rh, mem, field, data, private, 1);
|
||||
}
|
||||
|
||||
static int _size32_disp(struct dm_report *rh __attribute__((unused)), struct dm_pool *mem,
|
||||
|
Loading…
Reference in New Issue
Block a user