[pve-devel] [PATCH cluster 3/3] pmxcfs: add ping IPCC request to server

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Dec 20 12:00:39 CET 2017


We sometimes need to restart the pmxcfs (e.g., cluster create or
join), and know that IPCC will be unavailable for some time.

Add a simple IPCC request type which just returns "1", this can be
used to poll on a restart until the IPCC got ready again, without
using a call which itself uses complexer elements (e.g., memdb,
corosync).

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 data/PVE/Cluster.pm | 5 +++++
 data/src/server.c   | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index ff9234b..9391832 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -455,6 +455,11 @@ my $ipcc_get_cluster_log = sub {
     return &$ipcc_send_rec(8, $bindata);
 };
 
+# returns 1 if IPCC connection with pmxcfs is up and OK, else undef
+sub ipcc_ping {
+    return PVE::IPCC::ipcc_send_rec(11);
+}
+
 my $ccache = {};
 
 sub cfs_update {
diff --git a/data/src/server.c b/data/src/server.c
index 0d366b1..eb28674 100644
--- a/data/src/server.c
+++ b/data/src/server.c
@@ -312,6 +312,14 @@ static int32_t s1_msg_process_fn(
 			cfs_rrd_dump(outbuf);
 			result = 0;
 		}
+	} else if (req_pt->id == 11) {
+		// "ping", for checking if IPCC is up and OK
+		if (req_pt->size != sizeof(struct qb_ipc_request_header)) {
+			result = -EINVAL;
+		} else {
+			g_string_printf(outbuf, "1");
+			result = 0;
+		}
 	}
 
 	cfs_debug("process result %d", result);
-- 
2.11.0





More information about the pve-devel mailing list