Skip to contentSkip to conversation

master - thin: show message on error path

PATCH Zdenek Kabelac 1 participant 1 message Sep 14, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ffeeb5c1e70e554defa45ee8aa28dcaeb47c705f
Commit:        ffeeb5c1e70e554defa45ee8aa28dcaeb47c705f
Parent:        c356991fa83b15af261e8d7e33f5615397c07778
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Mon Sep 14 12:58:21 2015 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Sep 14 20:18:54 2015 +0200

thin: show message on error path

Add missing log_error and show proper reason for failure when autoextend is set to 0.

Add missing log_error when checked LV is not locally active.

---
 lib/metadata/lv_manip.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
lib/metadata/lv_manip.c +11 -2
index f43d281..46213fe 100644
@@ -4405,8 +4405,11 @@ static int _adjust_policy_params(struct cmd_context *cmd,
 		policy_amount =
 			find_config_tree_int(cmd, activation_thin_pool_autoextend_percent_CFG,
 					     lv_config_profile(lv));
-		if (!policy_amount && policy_threshold < DM_PERCENT_100)
-                        return 0;
+		if (!policy_amount && policy_threshold < DM_PERCENT_100) {
+			log_error("Can't extend thin pool %s, autoextend is set to 0%%.",
+				  display_lvname(lv));
+			return 0;
+		}
 	} else {
 		policy_threshold =
 			find_config_tree_int(cmd, activation_snapshot_autoextend_threshold_CFG, NULL) * DM_PERCENT_1;
@@ -4417,6 +4420,12 @@ static int _adjust_policy_params(struct cmd_context *cmd,
 	if (policy_threshold >= DM_PERCENT_100)
 		return 1; /* nothing to do */
 
+	if (!lv_is_active_locally(lv)) {
+		log_error("Can't read state of locally inactive LV %s.",
+			  display_lvname(lv));
+		return 0;
+	}
+
 	if (lv_is_thin_pool(lv)) {
 		if (!lv_thin_pool_percent(lv, 1, &percent))
 			return_0;