master - cache: enhance cache-pool validation
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c2d4330f27277717bc3b684b702189079b257b77 Commit: c2d4330f27277717bc3b684b702189079b257b77 Parent: 077645476cdfd7de0a16c283712b6c01938015d7 Author: Zdenek Kabelac <[email protected]> AuthorDate: Tue Jul 14 09:58:37 2015 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Wed Jul 15 13:10:22 2015 +0200
cache: enhance cache-pool validation
Capture cache-pool without cache policy name set.
--- lib/metadata/merge.c | 6 ++++++ lib/report/report.c | 15 +++++---------- 2 files changed, 11 insertions(+), 10 deletions(-)
lib/metadata/merge.c +6 -0
@@ -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->area_count !=1 ||seg_type (seg,0 ) !=AREA_LV ) {
lib/report/report.c +5 -10
@@ -1381,7 +1381,6 @@ static int _cache_policy_disp(struct dm_report *rh, struct dm_pool *mem, const void *data, void *private) { const struct lv_segment *seg = (const struct lv_segment *) data; -const char *cache_policy_name;if (seg_is_cache (seg)) 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),GET_FIELD_RESERVED_VALUE (cache_policy_undef)); -if (seg->policy_name) { -if (!(cache_policy_name =dm_pool_strdup (mem, seg->policy_name))) { -log_error ("dm_pool_strdup failed" ); -return 0 ; - } -return _field_set_value (field, cache_policy_name,NULL ); - }else { -log_error (INTERNAL_ERROR "unexpected NULL policy name" ); - return_0; +if (!seg->policy_name) { +log_error (INTERNAL_ERROR "Unexpected NULL policy name." ); +return 0 ; } + +return _field_set_value (field, seg->policy_name,NULL ); } static int _modules_disp(struct dm_report *rh, struct dm_pool *mem,