Version 2.02.99 -
===================================
+ Add "monitor" segment reporting field to show dmevent monitoring status.
Document lvextend --use-policies option in man.
Fix creation and removal of clustered snapshot.
Fix clvmd caching of metadata when suspending inactive volumes.
return dm_pool_strdup(mem, get_pool_discards_name(seg->discards));
}
+#ifdef DMEVENTD
+# include "libdevmapper-event.h"
+#endif
+char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg)
+{
+ const char *s = "";
+
+#ifdef DMEVENTD
+ struct lvinfo info;
+ int pending = 0, monitored;
+ struct lv_segment *segm = (struct lv_segment *) seg;
+
+ if (lv_is_cow(seg->lv) && !lv_is_merging_cow(seg->lv))
+ segm = first_seg(seg->lv->snapshot->lv);
+ else if (seg->log_lv)
+ segm = first_seg(seg->log_lv);
+
+ // log_debug("Query LV:%s mon:%s segm:%s tgtm:%p segmon:%d statusm:%d", seg->lv->name, segm->lv->name, segm->segtype->name, segm->segtype->ops->target_monitored, seg_monitored(segm), (int)(segm->status & PVMOVE));
+ if (!segm->segtype->ops->target_monitored)
+ /* Nothing to do, monitoring not supported */;
+ else if (!seg_monitored(segm) || (segm->status & PVMOVE))
+ s = "not monitored";
+ else if (lv_info(seg->lv->vg->cmd, seg->lv, 1, &info, 0, 0) && info.exists) {
+ monitored = segm->segtype->ops->
+ target_monitored((struct lv_segment*)segm, &pending);
+ if (pending)
+ s = "pending";
+ else
+ s = (monitored) ? "monitored" : "not monitored";
+ } // else log_debug("Not active");
+#endif
+ return dm_pool_strdup(mem, s);
+}
+
uint64_t lvseg_chunksize(const struct lv_segment *seg)
{
uint64_t size;
uint64_t lvseg_chunksize(const struct lv_segment *seg);
char *lvseg_segtype_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_discards_dup(struct dm_pool *mem, const struct lv_segment *seg);
+char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_tags_dup(const struct lv_segment *seg);
char *lvseg_devices(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_seg_pe_ranges(struct dm_pool *mem, const struct lv_segment *seg);
FIELD(SEGS, seg, STR, "Seg Tags", tags, 8, tags, seg_tags, "Tags, if any.", 0)
FIELD(SEGS, seg, STR, "PE Ranges", list, 9, peranges, seg_pe_ranges, "Ranges of Physical Extents of underlying devices in command line format.", 0)
FIELD(SEGS, seg, STR, "Devices", list, 7, devices, devices, "Underlying devices used with starting extent numbers.", 0)
+FIELD(SEGS, seg, STR, "Monitor", list, 7, segmonitor, monitor, "Dmeventd monitoring status of the segment.", 0)
FIELD(PVSEGS, pvseg, NUM, "Start", pe, 5, uint32, pvseg_start, "Physical Extent number of start of segment.", 0)
FIELD(PVSEGS, pvseg, NUM, "SSize", len, 5, uint32, pvseg_size, "Number of extents in segment.", 0)
#define _seg_pe_ranges_set _not_implemented_set
GET_LVSEG_STR_PROPERTY_FN(devices, lvseg_devices(lvseg->lv->vg->vgmem, lvseg))
#define _devices_set _not_implemented_set
+GET_LVSEG_STR_PROPERTY_FN(monitor, lvseg_monitor_dup(lvseg->lv->vg->vgmem, lvseg))
+#define _monitor_set _not_implemented_set
/* PVSEG */
return _size64_disp(rh, mem, field, &size, private);
}
+static int _segmonitor_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ char *str;
+
+ if (!(str = lvseg_monitor_dup(mem, (const struct lv_segment *)data)))
+ return_0;
+
+ dm_report_field_set_value(field, str, NULL);
+
+ return 1;
+}
+
static int _segstart_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)