mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
thin: report needs_check and fail state
Fix reporting of Fail thin-pool target status as attr[8] letter 'F'. Report 'needs_check' status from thin-pool target via attr field [4] (letter 'c'/'C'), and also via CheckNeeded field. TODO: think about better name here? TODO: lots of prop_not_implemented_set
This commit is contained in:
parent
0358ca3aad
commit
f31d596c0d
@ -1,5 +1,6 @@
|
||||
Version 2.02.143 -
|
||||
=====================================
|
||||
Support reporting CheckNeeded and Fail state for thin-pool and thin LV.
|
||||
For failing thin-pool and thin volume correctly report percentage as INVALID.
|
||||
Report -1, not 'unkown' for lv_{snapshot_invalid,merge_failed} with --binary.
|
||||
Add configure --enable-dbus-service for an LVM D-Bus service.
|
||||
|
@ -130,7 +130,9 @@ static int _get_segment_status_from_target_params(const char *target_name,
|
||||
* linear/striped, old snapshots and raids have proper
|
||||
* segment selected for status!
|
||||
*/
|
||||
if (strcmp(target_name, "cache") && strcmp(target_name, "thin-pool"))
|
||||
if (strcmp(target_name, "cache") &&
|
||||
strcmp(target_name, "thin-pool") &&
|
||||
strcmp(target_name, "thin"))
|
||||
return 1;
|
||||
|
||||
if (!(segtype = get_segtype_from_string(seg_status->seg->lv->vg->cmd, target_name)))
|
||||
|
@ -1129,6 +1129,12 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_
|
||||
}
|
||||
}
|
||||
|
||||
/* 'c' when thin-pool active with needs_check flag
|
||||
* 'C' for suspend */
|
||||
if (lv_is_thin_pool(lv) &&
|
||||
lvdm->seg_status.thin_pool->needs_check)
|
||||
repstr[4] = lvdm->info.suspended ? 'C' : 'c';
|
||||
|
||||
/*
|
||||
* 'R' indicates read-only activation of a device that
|
||||
* does not have metadata flagging it as read-only.
|
||||
@ -1190,6 +1196,12 @@ char *lv_attr_dup_with_info_and_seg_status(struct dm_pool *mem, const struct lv_
|
||||
repstr[8] = 'D';
|
||||
else if (lvdm->seg_status.thin_pool->read_only)
|
||||
repstr[8] = 'M';
|
||||
} else if (lv_is_thin_volume(lv) &&
|
||||
(lvdm->seg_status.type != SEG_STATUS_NONE)) {
|
||||
if (lvdm->seg_status.type == SEG_STATUS_UNKNOWN)
|
||||
repstr[8] = 'X'; /* Unknown */
|
||||
else if (lvdm->seg_status.thin->fail)
|
||||
repstr[8] = 'F';
|
||||
}
|
||||
|
||||
if (lv->status & LV_ACTIVATION_SKIP)
|
||||
|
@ -115,6 +115,7 @@ FIELD(LVSSTATUS, lv, NUM, "CacheWriteMisses", lvid, 16, cache_write_misses, cach
|
||||
FIELD(LVSSTATUS, lv, STR_LIST, "KCache Settings", lvid, 18, kernel_cache_settings, kernel_cache_settings, "Cache settings/parameters as set in kernel, including default values (cached segments only).", 0)
|
||||
FIELD(LVSSTATUS, lv, STR, "Health", lvid, 15, lvhealthstatus, lv_health_status, "LV health status.", 0)
|
||||
FIELD(LVSSTATUS, lv, STR, "KDiscards", lvid, 8, kdiscards, kernel_discards, "For thin pools, how discards are handled in kernel.", 0)
|
||||
FIELD(LVSSTATUS, lv, BIN, "CheckNeeded", lvid, 15, lvcheckneeded, lv_check_needed, "For thin pools, whether metadata check is needed.", 0)
|
||||
|
||||
FIELD(LABEL, label, STR, "Fmt", type, 3, pvfmt, pv_fmt, "Type of metadata.", 0)
|
||||
FIELD(LABEL, label, STR, "PV UUID", type, 38, pvuuid, pv_uuid, "Unique identifier.", 0)
|
||||
|
@ -251,6 +251,8 @@ GET_PV_NUM_PROPERTY_FN(pv_ba_size, SECTOR_SIZE * pv->ba_size)
|
||||
#define _lv_health_status_get prop_not_implemented_get
|
||||
#define _lv_skip_activation_set prop_not_implemented_set
|
||||
#define _lv_skip_activation_get prop_not_implemented_get
|
||||
#define _lv_check_needed_set prop_not_implemented_set
|
||||
#define _lv_check_needed_get prop_not_implemented_get
|
||||
|
||||
#define _cache_total_blocks_set prop_not_implemented_set
|
||||
#define _cache_total_blocks_get prop_not_implemented_get
|
||||
|
@ -3311,6 +3311,19 @@ static int _lvhealthstatus_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
return _string_disp(rh, mem, field, &health, private);
|
||||
}
|
||||
|
||||
static int _lvcheckneeded_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private)
|
||||
{
|
||||
const struct lv_with_info_and_seg_status *lvdm = (const struct lv_with_info_and_seg_status *) data;
|
||||
|
||||
if (lv_is_thin_pool(lvdm->lv))
|
||||
return _binary_disp(rh, mem, field, lvdm->seg_status.thin_pool->needs_check,
|
||||
GET_FIRST_RESERVED_NAME(lv_check_needed_y), private);
|
||||
|
||||
return _binary_undef_disp(rh, mem, field, private);
|
||||
}
|
||||
|
||||
static int _lvskipactivation_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
struct dm_report_field *field,
|
||||
const void *data, void *private)
|
||||
|
@ -81,6 +81,7 @@ FIELD_RESERVED_BINARY_VALUE(lv_inactive_table, lv_inactive_table, "", "inactive
|
||||
FIELD_RESERVED_BINARY_VALUE(lv_device_open, lv_device_open, "", "open")
|
||||
FIELD_RESERVED_BINARY_VALUE(lv_skip_activation, lv_skip_activation, "", "skip activation", "skip")
|
||||
FIELD_RESERVED_BINARY_VALUE(zero, zero, "", "zero")
|
||||
FIELD_RESERVED_BINARY_VALUE(lv_check_needed, lv_check_needed, "", "check needed", "needed")
|
||||
FIELD_RESERVED_VALUE(NAMED, lv_permissions, lv_permissions_rw, "", "writeable", "writeable", "rw", "read-write")
|
||||
FIELD_RESERVED_VALUE(NAMED, lv_permissions, lv_permissions_r, "", "read-only", "read-only", "r", "ro")
|
||||
FIELD_RESERVED_VALUE(NAMED, lv_permissions, lv_permissions_r_override, "", "read-only-override", "read-only-override", "ro-override", "r-override", "R")
|
||||
|
Loading…
x
Reference in New Issue
Block a user