[pve-devel] [PATCH ha-manager v3 1/6] fix some log formatting

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Feb 19 18:41:02 CET 2016


First remove trailing whitespace from log messages on state changes
This needs to touch some regression test, but with no change in
semantics.

Second add a missing paranthese on the "fixup service location"
message. This needs no regression test log.expect changes.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/HA/Manager.pm                      | 8 ++++----
 src/test/test-basic1/log.expect            | 6 +++---
 src/test/test-basic5/log.expect            | 2 +-
 src/test/test-resource-failure1/log.expect | 4 ++--
 src/test/test-resource-failure2/log.expect | 4 ++--
 src/test/test-resource-failure4/log.expect | 6 +++---
 src/test/test-resource-failure5/log.expect | 8 ++++----
 src/test/test-restart-lrm/log.expect       | 4 ++--
 src/test/test-service-command1/log.expect  | 4 ++--
 src/test/test-shutdown1/log.expect         | 2 +-
 src/test/test-shutdown2/log.expect         | 2 +-
 src/test/test-shutdown3/log.expect         | 2 +-
 src/test/test-shutdown4/log.expect         | 2 +-
 13 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm
index cab2b0a..a482ef2 100644
--- a/src/PVE/HA/Manager.pm
+++ b/src/PVE/HA/Manager.pm
@@ -207,10 +207,10 @@ my $change_service_state = sub {
     $self->recompute_online_node_usage();
 
     $sd->{uid} = compute_new_uuid($new_state);
-    
 
-    $text_state = " ($text_state)" if $text_state;
-    $haenv->log('info', "service '$sid': state changed from '${old_state}' to '${new_state}' $text_state");
+    $text_state = "  ($text_state)" if $text_state;
+    $haenv->log('info', "service '$sid': state changed from '${old_state}'" .
+		" to '${new_state}'$text_state");
 };
 
 # after a node was fenced this recovers the service to a new node
@@ -495,7 +495,7 @@ sub next_state_stopped {
     if ($sd->{node} ne $cd->{node}) {
 	# this can happen if we fence a node with active migrations
 	# hack: modify $sd (normally this should be considered read-only)
-	$haenv->log('info', "fixup service '$sid' location ($sd->{node} => $cd->{node}");
+	$haenv->log('info', "fixup service '$sid' location ($sd->{node} => $cd->{node})");
 	$sd->{node} = $cd->{node}; 
     }
 
diff --git a/src/test/test-basic1/log.expect b/src/test/test-basic1/log.expect
index 5cd30f0..68df71b 100644
--- a/src/test/test-basic1/log.expect
+++ b/src/test/test-basic1/log.expect
@@ -16,7 +16,7 @@ info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'vm:101' on node 'node1'
 info     20    node1/crm: adding new service 'vm:102' on node 'node2'
 info     20    node1/crm: adding new service 'vm:103' on node 'node3'
-info     20    node1/crm: service 'vm:102': state changed from 'started' to 'request_stop' 
+info     20    node1/crm: service 'vm:102': state changed from 'started' to 'request_stop'
 info     21    node1/lrm: got lock 'ha_agent_node1_lock'
 info     21    node1/lrm: status change wait_for_agent_lock => active
 info     21    node1/lrm: starting service vm:101
@@ -29,12 +29,12 @@ info     25    node3/lrm: got lock 'ha_agent_node3_lock'
 info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service vm:103
 info     25    node3/lrm: service status vm:103 started
-info     40    node1/crm: service 'vm:102': state changed from 'request_stop' to 'stopped' 
+info     40    node1/crm: service 'vm:102': state changed from 'request_stop' to 'stopped'
 info    120      cmdlist: execute network node3 off
 info    120    node1/crm: node 'node3': state changed from 'online' => 'unknown'
 info    124    node3/crm: status change slave => wait_for_quorum
 info    125    node3/lrm: status change active => lost_agent_lock
-info    160    node1/crm: service 'vm:103': state changed from 'started' to 'fence' 
+info    160    node1/crm: service 'vm:103': state changed from 'started' to 'fence'
 info    160    node1/crm: node 'node3': state changed from 'unknown' => 'fence'
 info    166     watchdog: execute power node3 off
 info    165    node3/crm: killed by poweroff
diff --git a/src/test/test-basic5/log.expect b/src/test/test-basic5/log.expect
index e640e13..54b579c 100644
--- a/src/test/test-basic5/log.expect
+++ b/src/test/test-basic5/log.expect
@@ -41,7 +41,7 @@ info    162     hardware: server 'node1' stopped by poweroff (watchdog)
 info    222    node3/crm: got lock 'ha_manager_lock'
 info    222    node3/crm: status change slave => master
 info    222    node3/crm: node 'node1': state changed from 'online' => 'unknown'
-info    282    node3/crm: service 'vm:101': state changed from 'started' to 'fence' 
+info    282    node3/crm: service 'vm:101': state changed from 'started' to 'fence'
 info    282    node3/crm: node 'node1': state changed from 'unknown' => 'fence'
 info    282    node3/crm: got lock 'ha_agent_node1_lock'
 info    282    node3/crm: fencing: acknowleged - got agent lock for node 'node1'
diff --git a/src/test/test-resource-failure1/log.expect b/src/test/test-resource-failure1/log.expect
index 97d9fdb..c3170fc 100644
--- a/src/test/test-resource-failure1/log.expect
+++ b/src/test/test-resource-failure1/log.expect
@@ -14,12 +14,12 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'fa:110' on node 'node2'
-info     20    node1/crm: service 'fa:110': state changed from 'started' to 'request_stop' 
+info     20    node1/crm: service 'fa:110': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     23    node2/lrm: got lock 'ha_agent_node2_lock'
 info     23    node2/lrm: status change wait_for_agent_lock => active
 info     24    node3/crm: status change wait_for_quorum => slave
-info     40    node1/crm: service 'fa:110': state changed from 'request_stop' to 'stopped' 
+info     40    node1/crm: service 'fa:110': state changed from 'request_stop' to 'stopped'
 info    120      cmdlist: execute service fa:110 enabled
 info    120    node1/crm: service 'fa:110': state changed from 'stopped' to 'started'  (node = node2)
 info    123    node2/lrm: starting service fa:110
diff --git a/src/test/test-resource-failure2/log.expect b/src/test/test-resource-failure2/log.expect
index 3c827f8..604ad95 100644
--- a/src/test/test-resource-failure2/log.expect
+++ b/src/test/test-resource-failure2/log.expect
@@ -14,12 +14,12 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'fa:130' on node 'node2'
-info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop' 
+info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     23    node2/lrm: got lock 'ha_agent_node2_lock'
 info     23    node2/lrm: status change wait_for_agent_lock => active
 info     24    node3/crm: status change wait_for_quorum => slave
-info     40    node1/crm: service 'fa:130': state changed from 'request_stop' to 'stopped' 
+info     40    node1/crm: service 'fa:130': state changed from 'request_stop' to 'stopped'
 info    120      cmdlist: execute service fa:130 enabled
 info    120    node1/crm: service 'fa:130': state changed from 'stopped' to 'started'  (node = node2)
 info    123    node2/lrm: starting service fa:130
diff --git a/src/test/test-resource-failure4/log.expect b/src/test/test-resource-failure4/log.expect
index 3e8eef9..77c2367 100644
--- a/src/test/test-resource-failure4/log.expect
+++ b/src/test/test-resource-failure4/log.expect
@@ -21,12 +21,12 @@ info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service fa:1001
 info     25    node3/lrm: service status fa:1001 started
 info    120      cmdlist: execute service fa:1001 disabled
-info    120    node1/crm: service 'fa:1001': state changed from 'started' to 'request_stop' 
+info    120    node1/crm: service 'fa:1001': state changed from 'started' to 'request_stop'
 info    125    node3/lrm: stopping service fa:1001
 info    125    node3/lrm: unable to stop stop service fa:1001 (still running)
 err     140    node1/crm: service 'fa:1001' stop failed (exit code 1)
-info    140    node1/crm: service 'fa:1001': state changed from 'request_stop' to 'error' 
-info    140    node1/crm: service 'fa:1001': state changed from 'error' to 'stopped' 
+info    140    node1/crm: service 'fa:1001': state changed from 'request_stop' to 'error'
+info    140    node1/crm: service 'fa:1001': state changed from 'error' to 'stopped'
 info    145    node3/lrm: stopping service fa:1001
 info    145    node3/lrm: unable to stop stop service fa:1001 (still running)
 info    165    node3/lrm: stopping service fa:1001
diff --git a/src/test/test-resource-failure5/log.expect b/src/test/test-resource-failure5/log.expect
index f17421a..b6e7807 100644
--- a/src/test/test-resource-failure5/log.expect
+++ b/src/test/test-resource-failure5/log.expect
@@ -14,12 +14,12 @@ info     20    node1/crm: node 'node1': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node2': state changed from 'unknown' => 'online'
 info     20    node1/crm: node 'node3': state changed from 'unknown' => 'online'
 info     20    node1/crm: adding new service 'fa:130' on node 'node2'
-info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop' 
+info     20    node1/crm: service 'fa:130': state changed from 'started' to 'request_stop'
 info     22    node2/crm: status change wait_for_quorum => slave
 info     23    node2/lrm: got lock 'ha_agent_node2_lock'
 info     23    node2/lrm: status change wait_for_agent_lock => active
 info     24    node3/crm: status change wait_for_quorum => slave
-info     40    node1/crm: service 'fa:130': state changed from 'request_stop' to 'stopped' 
+info     40    node1/crm: service 'fa:130': state changed from 'request_stop' to 'stopped'
 info    120      cmdlist: execute service fa:130 enabled
 info    120    node1/crm: service 'fa:130': state changed from 'stopped' to 'started'  (node = node2)
 info    123    node2/lrm: starting service fa:130
@@ -29,10 +29,10 @@ info    143    node2/lrm: starting service fa:130
 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' 
+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
 warn    183    node2/lrm: service fa:130 is not running and in an error state
 warn    203    node2/lrm: service fa:130 is not running and in an error state
 info    220      cmdlist: execute service fa:130 disabled
-info    220    node1/crm: service 'fa:130': state changed from 'error' to 'stopped' 
+info    220    node1/crm: service 'fa:130': state changed from 'error' to 'stopped'
 info    820     hardware: exit simulation - done
diff --git a/src/test/test-restart-lrm/log.expect b/src/test/test-restart-lrm/log.expect
index 7e0a71e..198aef9 100644
--- a/src/test/test-restart-lrm/log.expect
+++ b/src/test/test-restart-lrm/log.expect
@@ -22,10 +22,10 @@ info     25    node3/lrm: starting service vm:103
 info     25    node3/lrm: service status vm:103 started
 info    120      cmdlist: execute restart-lrm node3
 info    120    node3/lrm: restart LRM, freeze all services
-info    120    node1/crm: service 'vm:103': state changed from 'started' to 'freeze' 
+info    120    node1/crm: service 'vm:103': state changed from 'started' to 'freeze'
 info    126    node3/lrm: exit (loop end)
 info    126    node3/lrm: status change startup => wait_for_agent_lock
-info    160    node1/crm: service 'vm:103': state changed from 'freeze' to 'started' 
+info    160    node1/crm: service 'vm:103': state changed from 'freeze' to 'started'
 info    165    node3/lrm: got lock 'ha_agent_node3_lock'
 info    165    node3/lrm: status change wait_for_agent_lock => active
 info    720     hardware: exit simulation - done
diff --git a/src/test/test-service-command1/log.expect b/src/test/test-service-command1/log.expect
index 8e2d1f1..7e74e8a 100644
--- a/src/test/test-service-command1/log.expect
+++ b/src/test/test-service-command1/log.expect
@@ -21,10 +21,10 @@ info     25    node3/lrm: status change wait_for_agent_lock => active
 info     25    node3/lrm: starting service vm:103
 info     25    node3/lrm: service status vm:103 started
 info    120      cmdlist: execute service vm:103 disabled
-info    120    node1/crm: service 'vm:103': state changed from 'started' to 'request_stop' 
+info    120    node1/crm: service 'vm:103': state changed from 'started' to 'request_stop'
 info    125    node3/lrm: stopping service vm:103
 info    125    node3/lrm: service status vm:103 stopped
-info    140    node1/crm: service 'vm:103': state changed from 'request_stop' to 'stopped' 
+info    140    node1/crm: service 'vm:103': state changed from 'request_stop' to 'stopped'
 info    220      cmdlist: execute service vm:103 enabled
 info    220    node1/crm: service 'vm:103': state changed from 'stopped' to 'started'  (node = node3)
 info    225    node3/lrm: starting service vm:103
diff --git a/src/test/test-shutdown1/log.expect b/src/test/test-shutdown1/log.expect
index 95937cb..9dbdb84 100644
--- a/src/test/test-shutdown1/log.expect
+++ b/src/test/test-shutdown1/log.expect
@@ -29,7 +29,7 @@ info    126     shutdown: execute crm node3 stop
 info    145    node3/crm: exit (loop end)
 info    145     shutdown: execute power node3 off
 info    160    node1/crm: node 'node3': state changed from 'online' => 'unknown'
-info    200    node1/crm: service 'vm:103': state changed from 'started' to 'fence' 
+info    200    node1/crm: service 'vm:103': state changed from 'started' to 'fence'
 info    200    node1/crm: node 'node3': state changed from 'unknown' => 'fence'
 info    200    node1/crm: got lock 'ha_agent_node3_lock'
 info    200    node1/crm: fencing: acknowleged - got agent lock for node 'node3'
diff --git a/src/test/test-shutdown2/log.expect b/src/test/test-shutdown2/log.expect
index fb959f9..c3fbb07 100644
--- a/src/test/test-shutdown2/log.expect
+++ b/src/test/test-shutdown2/log.expect
@@ -29,7 +29,7 @@ info    126     shutdown: execute crm node3 stop
 info    145    node3/crm: exit (loop end)
 info    145     shutdown: execute power node3 off
 info    160    node1/crm: node 'node3': state changed from 'online' => 'unknown'
-info    200    node1/crm: service 'vm:103': state changed from 'started' to 'fence' 
+info    200    node1/crm: service 'vm:103': state changed from 'started' to 'fence'
 info    200    node1/crm: node 'node3': state changed from 'unknown' => 'fence'
 info    200    node1/crm: got lock 'ha_agent_node3_lock'
 info    200    node1/crm: fencing: acknowleged - got agent lock for node 'node3'
diff --git a/src/test/test-shutdown3/log.expect b/src/test/test-shutdown3/log.expect
index 4efa3e7..16d8c4e 100644
--- a/src/test/test-shutdown3/log.expect
+++ b/src/test/test-shutdown3/log.expect
@@ -29,7 +29,7 @@ info    126     shutdown: execute crm node3 stop
 info    145    node3/crm: exit (loop end)
 info    145     shutdown: execute power node3 off
 info    160    node1/crm: node 'node3': state changed from 'online' => 'unknown'
-info    200    node1/crm: service 'ct:103': state changed from 'started' to 'fence' 
+info    200    node1/crm: service 'ct:103': state changed from 'started' to 'fence'
 info    200    node1/crm: node 'node3': state changed from 'unknown' => 'fence'
 info    200    node1/crm: got lock 'ha_agent_node3_lock'
 info    200    node1/crm: fencing: acknowleged - got agent lock for node 'node3'
diff --git a/src/test/test-shutdown4/log.expect b/src/test/test-shutdown4/log.expect
index aa8cfcc..843104b 100644
--- a/src/test/test-shutdown4/log.expect
+++ b/src/test/test-shutdown4/log.expect
@@ -32,7 +32,7 @@ info    141     shutdown: execute power node1 off
 info    141    node2/crm: got lock 'ha_manager_lock'
 info    141    node2/crm: status change slave => master
 info    141    node2/crm: node 'node1': state changed from 'online' => 'unknown'
-info    220    node2/crm: service 'vm:100': state changed from 'started' to 'fence' 
+info    220    node2/crm: service 'vm:100': state changed from 'started' to 'fence'
 info    220    node2/crm: node 'node1': state changed from 'unknown' => 'fence'
 info    220    node2/crm: got lock 'ha_agent_node1_lock'
 info    220    node2/crm: fencing: acknowleged - got agent lock for node 'node1'
-- 
2.1.4





More information about the pve-devel mailing list