From 396eb6f0d2c7afd0fd3461f83bff80ff9d232237 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 11 Nov 2019 16:50:37 +0100 Subject: [PATCH] followup, adapt stop request log messages; include SID it's always good to say that we request it, not that people think the task should have been already started.. Also include the service ID (SID), so people know what we want(ed) to stop at all. Signed-off-by: Thomas Lamprecht --- src/PVE/HA/Manager.pm | 6 +++++- src/test/test-stop-command1/log.expect | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/PVE/HA/Manager.pm b/src/PVE/HA/Manager.pm index 617e369..f847cb3 100644 --- a/src/PVE/HA/Manager.pm +++ b/src/PVE/HA/Manager.pm @@ -663,7 +663,11 @@ sub next_state_started { } } elsif ($cmd eq 'stop') { my $timeout = shift @{$sd->{cmd}}; - $haenv->log('info', "$cmd service with timeout '$timeout'"); + if ($timeout == 0) { + $haenv->log('info', "request immediate service hard-stop for service '$sid'"); + } else { + $haenv->log('info', "request graceful stop with timeout '$timeout' for service '$sid'"); + } &$change_service_state($self, $sid, 'request_stop', timeout => $timeout); $haenv->update_service_config($sid, {'state' => 'stopped'}); } else { diff --git a/src/test/test-stop-command1/log.expect b/src/test/test-stop-command1/log.expect index 05f9712..a79204c 100644 --- a/src/test/test-stop-command1/log.expect +++ b/src/test/test-stop-command1/log.expect @@ -35,7 +35,7 @@ info 25 node3/lrm: starting service vm:103 info 25 node3/lrm: service status vm:103 started info 120 cmdlist: execute service vm:101 stop 0 info 120 node1/crm: got crm command: stop vm:101 0 -info 120 node1/crm: stop service with timeout '0' +info 120 node1/crm: request immediate service hard-stop for service 'vm:101' info 120 node1/crm: service 'vm:101': state changed from 'started' to 'request_stop' (timeout = 0) info 121 node1/lrm: stopping service vm:101 (timeout=0) info 121 node1/lrm: service status vm:101 stopped @@ -45,21 +45,21 @@ info 220 node1/crm: got crm command: stop vm:101 1 info 220 node1/crm: ignore service 'vm:101' stop request - service already stopped info 320 cmdlist: execute service vm:102 stop 37 info 320 node1/crm: got crm command: stop vm:102 37 -info 320 node1/crm: stop service with timeout '37' +info 320 node1/crm: request graceful stop with timeout '37' for service 'vm:102' info 320 node1/crm: service 'vm:102': state changed from 'started' to 'request_stop' (timeout = 37) info 323 node2/lrm: stopping service vm:102 (timeout=37) info 323 node2/lrm: service status vm:102 stopped info 340 node1/crm: service 'vm:102': state changed from 'request_stop' to 'stopped' info 420 cmdlist: execute service vm:103 stop 60 info 420 node1/crm: got crm command: stop vm:103 60 -info 420 node1/crm: stop service with timeout '60' +info 420 node1/crm: request graceful stop with timeout '60' for service 'vm:103' info 420 node1/crm: service 'vm:103': state changed from 'started' to 'request_stop' (timeout = 60) info 425 node3/lrm: stopping service vm:103 (timeout=60) info 425 node3/lrm: service status vm:103 stopped info 440 node1/crm: service 'vm:103': state changed from 'request_stop' to 'stopped' info 520 cmdlist: execute service fa:1001 stop 0 info 520 node1/crm: got crm command: stop fa:1001 0 -info 520 node1/crm: stop service with timeout '0' +info 520 node1/crm: request immediate service hard-stop for service 'fa:1001' info 520 node1/crm: service 'fa:1001': state changed from 'started' to 'request_stop' (timeout = 0) info 525 node3/lrm: stopping service fa:1001 (timeout=0) info 525 node3/lrm: unable to stop stop service fa:1001 (still running) -- 2.39.2