public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH cluster 2/2] fix #6434: pmxcfs: add context to *_initialize errors
Date: Thu,  5 Jun 2025 16:17:20 +0200	[thread overview]
Message-ID: <20250605141720.734781-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20250605141720.734781-1-f.gruenbichler@proxmox.com>

in case initializing fails with CS_ERR_LIBRARY, the connection to corosync
failed - add that context to make the error message a bit less cryptic.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/pmxcfs/confdb.c |  9 ++++++++-
 src/pmxcfs/dfsm.c   | 11 ++++++++++-
 src/pmxcfs/quorum.c |  9 ++++++++-
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/pmxcfs/confdb.c b/src/pmxcfs/confdb.c
index e226fed..3479e52 100644
--- a/src/pmxcfs/confdb.c
+++ b/src/pmxcfs/confdb.c
@@ -221,7 +221,14 @@ static int service_cmap_initialize(cfs_service_t *service, gpointer context) {
 
         result = cmap_initialize(&handle);
         if (result != CS_OK) {
-            cfs_critical("cmap_initialize failed: %s", cs_strerror(result));
+            if (result == CS_ERR_LIBRARY) {
+                cfs_critical(
+                    "cmap_initialize failed: %s (failed to connect to corosync)",
+                    cs_strerror(result)
+                );
+            } else {
+                cfs_critical("cmap_initialize failed: %s", cs_strerror(result));
+            }
             private->handle = 0;
             return -1;
         }
diff --git a/src/pmxcfs/dfsm.c b/src/pmxcfs/dfsm.c
index 9228ddc..c6dfb68 100644
--- a/src/pmxcfs/dfsm.c
+++ b/src/pmxcfs/dfsm.c
@@ -1351,7 +1351,16 @@ cs_error_t dfsm_initialize(dfsm_t *dfsm, int *fd) {
 
     if (dfsm->cpg_handle == 0) {
         if ((result = cpg_initialize(&dfsm->cpg_handle, dfsm->cpg_callbacks)) != CS_OK) {
-            cfs_dom_critical(dfsm->log_domain, "cpg_initialize failed: %s", cs_strerror(result));
+            if (result == CS_ERR_LIBRARY) {
+                cfs_dom_critical(
+                    dfsm->log_domain, "cpg_initialize failed: %s (failed to connect to corosync)",
+                    cs_strerror(result)
+                );
+            } else {
+                cfs_dom_critical(
+                    dfsm->log_domain, "cpg_initialize failed: %s", cs_strerror(result)
+                );
+            }
             goto err_no_finalize;
         }
 
diff --git a/src/pmxcfs/quorum.c b/src/pmxcfs/quorum.c
index 07b2a39..e2ec0a3 100644
--- a/src/pmxcfs/quorum.c
+++ b/src/pmxcfs/quorum.c
@@ -107,7 +107,14 @@ static int service_quorum_initialize(cfs_service_t *service, gpointer context) {
 
         result = quorum_initialize(&handle, &quorum_callbacks, &quorum_type);
         if (result != CS_OK) {
-            cfs_critical("quorum_initialize failed: %s", cs_strerror(result));
+            if (result == CS_ERR_LIBRARY) {
+                cfs_critical(
+                    "quorum_initialize failed: %s (failed to connect to corosync)",
+                    cs_strerror(result)
+                );
+            } else {
+                cfs_critical("quorum_initialize failed: %s", cs_strerror(result));
+            }
             goto err_reset_handle;
         }
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  reply	other threads:[~2025-06-05 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 14:17 [pve-devel] [PATCH cluster 1/2] pmxcfs: pretty print corosync error codes Fabian Grünbichler
2025-06-05 14:17 ` Fabian Grünbichler [this message]
2025-06-25 14:50 ` [pve-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250605141720.734781-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal