From 6028300366b1ba4e484406a15d77e634cd628db8 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Thu, 1 Jun 2023 08:24:05 +0000 Subject: [PATCH] cpacfstatsd: don't fail if no crypto counters are supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not fail to start the daemon if no crypto counters are supported, as there is still a use case for the daemon to run, as the user can then use the 'cpacfstats' tool to evaluate that no counter stats are available. Previously, the user had to check the syslogs for the reason why the daemon was not running and the cpacfstats command failed. Before this change: $ cpacfstats cpacfstats: Can't access domain socket file '/run/cpacfstatsd_socket', errno=2 [No such file or directory] cpacfstats: Maybe cpacfstatsd daemon is not running ??? cpacfstats: Can't connect to daemon After this change: $ cpacfstats des counter: unsupported aes counter: unsupported sha counter: unsupported rng counter: unsupported ecc counter: unsupported pai_user : unsupported pai_kernel : unsupported Also, it's no good practice to let systemd services fail, because otherwise the system state will be shown as 'degraded': $ systemctl status * a46lp59 State: degraded Jobs: 0 queued Failed: 1 units $ systemctl list-units --failed UNIT LOAD ACTIVE SUB DESCRIPTION * cpacfstatsd.service loaded failed failed CPACF statistics collection daemon process for Linux on System z Reviewed-by: Holger Dengler Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- cpacfstats/perf_crypto.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cpacfstats/perf_crypto.c b/cpacfstats/perf_crypto.c index 727be005..6c1c63e8 100644 --- a/cpacfstats/perf_crypto.c +++ b/cpacfstats/perf_crypto.c @@ -496,10 +496,8 @@ int perf_init(void) num -= 2; } - if (num == 0) { + if (num == 0) eprint("No crypto counters supported!\n"); - return -1; - } if (perf_load_counter_data()) return -1;