mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cache: enhance cache-pool validation
Capture cache-pool without cache policy name set.
This commit is contained in:
parent
077645476c
commit
c2d4330f27
@ -208,6 +208,12 @@ int check_lv_segments(struct logical_volume *lv, int complete_vg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (seg_is_cache_pool(seg)) {
|
||||||
|
if (!seg->policy_name) {
|
||||||
|
log_error("LV %s is missing cache policy name.", lv->name);
|
||||||
|
inc_error_count;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (seg_is_pool(seg)) {
|
if (seg_is_pool(seg)) {
|
||||||
if (seg->area_count != 1 ||
|
if (seg->area_count != 1 ||
|
||||||
seg_type(seg, 0) != AREA_LV) {
|
seg_type(seg, 0) != AREA_LV) {
|
||||||
|
@ -1381,7 +1381,6 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
const void *data, void *private)
|
const void *data, void *private)
|
||||||
{
|
{
|
||||||
const struct lv_segment *seg = (const struct lv_segment *) data;
|
const struct lv_segment *seg = (const struct lv_segment *) data;
|
||||||
const char *cache_policy_name;
|
|
||||||
|
|
||||||
if (seg_is_cache(seg))
|
if (seg_is_cache(seg))
|
||||||
seg = first_seg(seg->pool_lv);
|
seg = first_seg(seg->pool_lv);
|
||||||
@ -1389,16 +1388,12 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
return _field_set_value(field, GET_FIRST_RESERVED_NAME(cache_policy_undef),
|
return _field_set_value(field, GET_FIRST_RESERVED_NAME(cache_policy_undef),
|
||||||
GET_FIELD_RESERVED_VALUE(cache_policy_undef));
|
GET_FIELD_RESERVED_VALUE(cache_policy_undef));
|
||||||
|
|
||||||
if (seg->policy_name) {
|
if (!seg->policy_name) {
|
||||||
if (!(cache_policy_name = dm_pool_strdup(mem, seg->policy_name))) {
|
log_error(INTERNAL_ERROR "Unexpected NULL policy name.");
|
||||||
log_error("dm_pool_strdup failed");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return _field_set_value(field, cache_policy_name, NULL);
|
|
||||||
} else {
|
return _field_set_value(field, seg->policy_name, NULL);
|
||||||
log_error(INTERNAL_ERROR "unexpected NULL policy name");
|
|
||||||
return_0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _modules_disp(struct dm_report *rh, struct dm_pool *mem,
|
static int _modules_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||||
|
Loading…
Reference in New Issue
Block a user