From 5306943c5ce3800509437ec323222039fbe768f7 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Dec 12 2020 01:37:32 +0000 Subject: Build: pacemakerd: properly conditionalize corosync calls Previously, pacemakerd in its entirety was not built unless corosync support was enabled, a throwback to when CMAN and Corosync 1 were supported. Now, pacemakerd is built unconditionally, and just its corosync-related calls are guarded by corosync support. This has no effect currently since corosync 2+ is the only supported cluster layer, but it offers some future-proofing. patch_name: 013-pacemakerd.patch present_in_specfile: true location_in_specfile: 13 squash_commits: true --- diff --git a/daemons/pacemakerd/Makefile.am b/daemons/pacemakerd/Makefile.am index b01d8ef..4cc8a7c 100644 --- a/daemons/pacemakerd/Makefile.am +++ b/daemons/pacemakerd/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004-2019 the Pacemaker project contributors +# Copyright 2004-2020 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -9,8 +9,6 @@ include $(top_srcdir)/mk/common.mk -if BUILD_CS_SUPPORT - initdir = $(INITDIR) init_SCRIPTS = pacemaker sbin_PROGRAMS = pacemakerd @@ -30,8 +28,9 @@ pacemakerd_LDFLAGS = $(LDFLAGS_HARDENED_EXE) pacemakerd_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la $(top_builddir)/lib/common/libcrmcommon.la pacemakerd_LDADD += $(CLUSTERLIBS) -pacemakerd_SOURCES = pacemakerd.c pcmkd_corosync.c - +pacemakerd_SOURCES = pacemakerd.c +if BUILD_CS_SUPPORT +pacemakerd_SOURCES += pcmkd_corosync.c endif CLEANFILES = $(man8_MANS) diff --git a/daemons/pacemakerd/pacemakerd.c b/daemons/pacemakerd/pacemakerd.c index fb35dfc..652d6ca 100644 --- a/daemons/pacemakerd/pacemakerd.c +++ b/daemons/pacemakerd/pacemakerd.c @@ -1084,9 +1084,11 @@ main(int argc, char **argv) crm_ipc_close(old_instance); crm_ipc_destroy(old_instance); +#ifdef SUPPORT_COROSYNC if (mcp_read_config() == FALSE) { crm_exit(CRM_EX_UNAVAILABLE); } +#endif // OCF shell functions and cluster-glue need facility under different name { @@ -1143,10 +1145,12 @@ main(int argc, char **argv) crm_exit(CRM_EX_OSERR); } +#ifdef SUPPORT_COROSYNC /* Allows us to block shutdown */ if (!cluster_connect_cfg()) { crm_exit(CRM_EX_PROTOCOL); } +#endif if(pcmk_locate_sbd() > 0) { setenv("PCMK_watchdog", "true", 1); @@ -1178,6 +1182,8 @@ main(int argc, char **argv) } g_main_loop_unref(mainloop); +#ifdef SUPPORT_COROSYNC cluster_disconnect_cfg(); +#endif crm_exit(CRM_EX_OK); }