mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
report: add lv_move_pv_uuid field
This commit is contained in:
parent
f01b7afa19
commit
0a01c5aa36
@ -458,11 +458,12 @@ char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
static char *_do_lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv,
|
||||||
|
int uuid)
|
||||||
{
|
{
|
||||||
struct logical_volume *mimage0_lv;
|
struct logical_volume *mimage0_lv;
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
const struct device *dev;
|
struct pv_segment *pvseg;
|
||||||
|
|
||||||
dm_list_iterate_items(seg, &lv->segments) {
|
dm_list_iterate_items(seg, &lv->segments) {
|
||||||
if (seg->status & PVMOVE) {
|
if (seg->status & PVMOVE) {
|
||||||
@ -473,17 +474,30 @@ char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
|||||||
"Bad pvmove structure");
|
"Bad pvmove structure");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
dev = seg_dev(first_seg(mimage0_lv), 0);
|
pvseg = seg_pvseg(first_seg(mimage0_lv), 0);
|
||||||
} else /* Segment pvmove */
|
} else /* Segment pvmove */
|
||||||
dev = seg_dev(seg, 0);
|
pvseg = seg_pvseg(seg, 0);
|
||||||
|
|
||||||
return dm_pool_strdup(mem, dev_name(dev));
|
if (uuid)
|
||||||
|
return pv_uuid_dup(mem, pvseg->pv);
|
||||||
|
else
|
||||||
|
return pv_name_dup(mem, pvseg->pv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||||
|
{
|
||||||
|
return _do_lv_move_pv_dup(mem, lv, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *lv_move_pv_uuid_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||||
|
{
|
||||||
|
return _do_lv_move_pv_dup(mem, lv, 1);
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t lv_origin_size(const struct logical_volume *lv)
|
uint64_t lv_origin_size(const struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
|
@ -68,6 +68,7 @@ char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
|||||||
char *lv_dmpath_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
char *lv_dmpath_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||||
uint64_t lv_origin_size(const struct logical_volume *lv);
|
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_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_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||||
int lv_kernel_major(const struct logical_volume *lv);
|
int lv_kernel_major(const struct logical_volume *lv);
|
||||||
int lv_kernel_minor(const struct logical_volume *lv);
|
int lv_kernel_minor(const struct logical_volume *lv);
|
||||||
|
@ -78,6 +78,7 @@ FIELD(LVS, lv, NUM, "WBehind", lvid, 7, raidwritebehind, raid_write_behind, "For
|
|||||||
FIELD(LVS, lv, NUM, "MinSync", lvid, 7, raidminrecoveryrate, raid_min_recovery_rate, "For RAID1, the minimum recovery I/O load in kiB/sec/disk.", 0)
|
FIELD(LVS, lv, NUM, "MinSync", lvid, 7, raidminrecoveryrate, raid_min_recovery_rate, "For RAID1, the minimum recovery I/O load in kiB/sec/disk.", 0)
|
||||||
FIELD(LVS, lv, NUM, "MaxSync", lvid, 7, raidmaxrecoveryrate, raid_max_recovery_rate, "For RAID1, the maximum recovery I/O load in kiB/sec/disk.", 0)
|
FIELD(LVS, lv, NUM, "MaxSync", lvid, 7, raidmaxrecoveryrate, raid_max_recovery_rate, "For RAID1, the maximum recovery I/O load in kiB/sec/disk.", 0)
|
||||||
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", 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, 7, convertlv, convert_lv, "For lvconvert, Name 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", 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, "Log UUID", lvid, 38, loglvuuid, mirror_log_uuid, "For mirrors, the UUID of the LV holding the synchronisation log.", 0)
|
||||||
|
@ -324,6 +324,8 @@ GET_LV_STR_PROPERTY_FN(raid_sync_action, _raidsyncaction(lv))
|
|||||||
#define _raid_sync_action_set prop_not_implemented_set
|
#define _raid_sync_action_set prop_not_implemented_set
|
||||||
GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv))
|
GET_LV_STR_PROPERTY_FN(move_pv, lv_move_pv_dup(lv->vg->vgmem, lv))
|
||||||
#define _move_pv_set prop_not_implemented_set
|
#define _move_pv_set prop_not_implemented_set
|
||||||
|
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))
|
GET_LV_STR_PROPERTY_FN(convert_lv, lv_convert_lv_dup(lv->vg->vgmem, lv))
|
||||||
#define _convert_lv_set prop_not_implemented_set
|
#define _convert_lv_set prop_not_implemented_set
|
||||||
GET_LV_STR_PROPERTY_FN(lv_tags, lv_tags_dup(lv))
|
GET_LV_STR_PROPERTY_FN(lv_tags, lv_tags_dup(lv))
|
||||||
|
@ -1907,17 +1907,37 @@ static int _lvdescendants_disp(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
return _field_set_string_list(rh, field, descendants.result, private, 0);
|
return _field_set_string_list(rh, field, descendants.result, private, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _do_movepv_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_move_pv_uuid_dup(mem, lv);
|
||||||
|
else
|
||||||
|
repstr = lv_move_pv_dup(mem, lv);
|
||||||
|
|
||||||
|
if (repstr)
|
||||||
|
return dm_report_field_string(rh, field, &repstr);
|
||||||
|
|
||||||
|
return _field_set_value(field, "", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static int _movepv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
static int _movepv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||||
struct dm_report_field *field,
|
struct dm_report_field *field,
|
||||||
const void *data, void *private __attribute__((unused)))
|
const void *data, void *private __attribute__((unused)))
|
||||||
{
|
{
|
||||||
const struct logical_volume *lv = (const struct logical_volume *) data;
|
return _do_movepv_disp(rh, mem, field, data, private, 0);
|
||||||
const char *name;
|
}
|
||||||
|
|
||||||
if ((name = lv_move_pv_dup(mem, lv)))
|
static int _movepvuuid_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||||
return dm_report_field_string(rh, field, &name);
|
struct dm_report_field *field,
|
||||||
|
const void *data, void *private __attribute__((unused)))
|
||||||
return _field_set_value(field, "", NULL);
|
{
|
||||||
|
return _do_movepv_disp(rh, mem, field, data, private, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _convertlv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
static int _convertlv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||||
|
Loading…
Reference in New Issue
Block a user