1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

report: seg_monitor undefined

Add 'undefined' value for segment which do not support monitoring.
Fixes crash for commands like 'pvs -o+seg_monitor'.
This commit is contained in:
Zdenek Kabelac 2015-01-20 14:36:21 +01:00
parent ae8b9baa04
commit d80d832ae9
4 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.115 -
=====================================
Report segment types without monitoring support as undefined.
Support lvchange --errorwhenfull for thin pools.
Improve the processing and reporting of duplicate PVs.
Report lv_health_status and health attribute also for thin pool.

View File

@ -157,6 +157,7 @@ char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg)
// 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 ((dmeventd_monitor_mode() != 1) ||
!segm->segtype->ops ||
!segm->segtype->ops->target_monitored)
/* Nothing to do, monitoring not supported */;
else if (lv_is_cow_covering_origin(seg->lv))

View File

@ -776,9 +776,14 @@ static int _segmonitor_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
{
const struct lv_segment *seg = (const struct lv_segment *)data;
char *str;
if (!(str = lvseg_monitor_dup(mem, (const struct lv_segment *)data)))
if (!seg->segtype->ops || !seg->segtype->ops->target_monitored)
return _field_set_value(field, GET_FIRST_RESERVED_NAME(seg_monitor_undef),
GET_FIELD_RESERVED_VALUE(seg_monitor_undef));
if (!(str = lvseg_monitor_dup(mem, seg)))
return_0;
return _field_set_value(field, str, NULL);

View File

@ -88,6 +88,7 @@ FIELD_RESERVED_VALUE(lv_read_ahead, lv_read_ahead_auto, "", &GET_TYPE_RESERVED_V
/* Reserved values for SEG fields */
FIELD_RESERVED_VALUE(cache_policy, cache_policy_undef, "", "", "", "undefined")
FIELD_RESERVED_VALUE(seg_monitor, seg_monitor_undef, "", "", "", "undefined")
FIELD_RESERVED_VALUE(lv_health_status, health_undef, "", "", "", "undefined")
/* TODO the following 2 need STR_LIST support for reserved values
FIELD_RESERVED_VALUE(cache_settings, cache_settings_default, "", "default", "default")