mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
report: show active state of LV
For non clustered VG - show "active"/"" For clustered VG its more complex: "local exclusive" "remote exclusive" "locally" "remotely"
This commit is contained in:
parent
8b18ab76d2
commit
8d004b5127
@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
Add "active" LV reporting field to show activation state.
|
||||
Add "monitor" segment reporting field to show dmevent monitoring status.
|
||||
Document lvextend --use-policies option in man.
|
||||
Fix creation and removal of clustered snapshot.
|
||||
|
@ -703,3 +703,22 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
return dm_pool_strdup(mem, lv->hostname ? : "");
|
||||
}
|
||||
|
||||
char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
if (!lv_is_active(lv))
|
||||
s = ""; /* not active */
|
||||
else if (!vg_is_clustered(lv->vg))
|
||||
s = "active";
|
||||
else if (lv_is_active_exclusive(lv))
|
||||
/* exclusive cluster activation */
|
||||
s = lv_is_active_exclusive_locally(lv) ?
|
||||
"local exclusive" : "remote exclusive";
|
||||
else /* locally active */
|
||||
s = lv_is_active_but_not_locally(lv) ?
|
||||
"remotely" : "locally";
|
||||
|
||||
return dm_pool_strdup(mem, s);
|
||||
}
|
||||
|
@ -85,4 +85,5 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
int lv_set_creation(struct logical_volume *lv,
|
||||
const char *hostname, uint64_t timestamp);
|
||||
const char *lv_layer(const struct logical_volume *lv);
|
||||
char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv);
|
||||
#endif /* _LVM_LV_H */
|
||||
|
@ -82,6 +82,7 @@ FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, m
|
||||
FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
|
||||
FIELD(LVS, lv, NUM, "Mismatches", lvid, 10, mismatch_count, mismatches, "For RAID, number of mismatches found or repaired.", 0)
|
||||
FIELD(LVS, lv, STR, "SyncAction", lvid, 10, sync_action, syncaction, "For RAID, the current synchronization action being performed.", 0)
|
||||
FIELD(LVS, lv, STR, "Active", lvid, 6, lvactive, lv_active, "Active state of the LV.", 0)
|
||||
FIELD(LVS, lv, NUM, "WBehind", lvid, 7, write_behind, writebehind, "For RAID1, the number of outstanding writes allowed to writemostly devices.", 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, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0)
|
||||
|
@ -247,6 +247,8 @@ GET_LV_STR_PROPERTY_FN(lv_time, lv_time_dup(lv->vg->vgmem, lv))
|
||||
#define _lv_time_set _not_implemented_set
|
||||
GET_LV_STR_PROPERTY_FN(lv_host, lv_host_dup(lv->vg->vgmem, lv))
|
||||
#define _lv_host_set _not_implemented_set
|
||||
GET_LV_STR_PROPERTY_FN(lv_active, lv_active_dup(lv->vg->vgmem, lv))
|
||||
#define _lv_active_set _not_implemented_set
|
||||
|
||||
/* VG */
|
||||
GET_VG_STR_PROPERTY_FN(vg_fmt, vg_fmt_dup(vg))
|
||||
|
@ -1151,6 +1151,20 @@ static int _lvhost_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _lvactive_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private)
|
||||
{
|
||||
char *repstr;
|
||||
|
||||
if (!(repstr = lv_active_dup(mem, (const struct logical_volume *) data)))
|
||||
return_0;
|
||||
|
||||
dm_report_field_set_value(field, repstr, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Report object types */
|
||||
|
||||
/* necessary for displaying something for PVs not belonging to VG */
|
||||
|
Loading…
Reference in New Issue
Block a user