[pve-devel] [PATCH ha-manager v4 2/3] exec_resource_agent: process error state early

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Feb 23 16:15:26 CET 2016


We want to give the error state priority over EWRONG_NODE as a
service may be in the error state because of EWRONG_NODE

Change the error message a bit as we now can not distinguish
running and stopped services.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

changes since v3:
* remove a parameter which let us omit the log message,
  not needed anymore

 src/PVE/HA/LRM.pm                          | 18 +++++++++---------
 src/test/test-resource-failure5/log.expect |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/PVE/HA/LRM.pm b/src/PVE/HA/LRM.pm
index f0e7977..0505d88 100644
--- a/src/PVE/HA/LRM.pm
+++ b/src/PVE/HA/LRM.pm
@@ -648,6 +648,15 @@ sub exec_resource_agent {
 	return EUNKNOWN_SERVICE;
     }
 
+    # process error state early
+    if ($cmd eq 'error') {
+
+	$haenv->log('err', "service $sid is in an error state and needs manual " .
+		    "intervention. Look up 'ERROR RECOVERY' in the documentation.");
+
+	return SUCCESS; # error always succeeds
+    }
+
     if ($service_config->{node} ne $nodename) {
 	$haenv->log('err', "service '$sid' not on this node");
 	return EWRONG_NODE;
@@ -718,15 +727,6 @@ sub exec_resource_agent {
 
 	return SUCCESS;
 
-    } elsif ($cmd eq 'error') {
-
-	if ($running) {
-	    $haenv->log("err", "service $sid is in an error state while running");
-	} else {
-	    $haenv->log("warning", "service $sid is not running and in an error state");
-	}
-	return SUCCESS; # error always succeeds
-
     }
 
     $haenv->log("err", "implement me (cmd '$cmd')");
diff --git a/src/test/test-resource-failure5/log.expect b/src/test/test-resource-failure5/log.expect
index 283ca8c..eb87f9f 100644
--- a/src/test/test-resource-failure5/log.expect
+++ b/src/test/test-resource-failure5/log.expect
@@ -30,7 +30,7 @@ warn    143    node2/lrm: unable to start service fa:130
 err     143    node2/lrm: unable to start service fa:130 on local node after 1 retries
 err     160    node1/crm: recovery policy for service fa:130 failed, entering error state!
 info    160    node1/crm: service 'fa:130': state changed from 'started' to 'error'
-warn    163    node2/lrm: service fa:130 is not running and in an error state
+err     163    node2/lrm: service fa:130 is in an error state and needs manual intervention. Look up 'ERROR RECOVERY' in the documentation.
 info    220      cmdlist: execute service fa:130 disabled
 info    220    node1/crm: service 'fa:130': state changed from 'error' to 'stopped'
 info    820     hardware: exit simulation - done
-- 
2.1.4





More information about the pve-devel mailing list