Commit 74573ac6 authored by Andrew Beekhof's avatar Andrew Beekhof
Browse files

High: CRM: Remove the CRM from Heartbeat as it is now maintained as Pacemaker

Since December '07 the CRM has been a separate project.  The existance of the
code in two places can only cause confusion, thus it is being removed by it's
sole author.
parent e6bb3df9
......@@ -257,6 +257,11 @@ lib/mgmt/pymgmt_wrap.c
tsa_plugin/ha_mgmt_client_wrap.c
# Misc
GPATH
GRTAGS
GSYMS
GTAGS
HTML
TAGS
.gres.*
*.orig
......
......@@ -59,10 +59,6 @@ if SNMP_SUBAGENT_BUILD
SNMP_SUBAGENT_DIR = snmp_subagent
endif
if MGMT_BUILD
MGMT_DIR = mgmt
endif
if CIM_PROVIDER_BUILD
CIM_PROVIDER_DIR = cim
endif
......
......@@ -1789,12 +1789,12 @@ AC_ARG_ENABLE([ipmilan],
CC_WARNINGS=""
enable_crm=no
dnl - If requested, enable ALL subsystems.
if test "${enable_all}" = "yes" ; then
echo "Enabling all optional features."
enable_ansi=yes;
enable_crm=yes;
enable_fatal_warnings=yes;
enable_lrm=yes;
enable_snmp_subagent=try;
......@@ -2504,30 +2504,18 @@ HA_RC_DIR=$HA_HBCONF_DIR/rc.d
AC_SUBST(HA_RC_DIR)
AC_DEFINE_UNQUOTED(HA_RC_DIR,"$HA_RC_DIR", heartbeat v1 script directory)
AC_ARG_ENABLE([crm],
[ --enable-crm Compile the Version 2 Cluster Resource Manager. [default=yes]],
[], [enable_crm=yes])
enable_crm=no
CRM_DIR=""
if test "x${enable_crm}" = "xyes"; then
CRM_ENABLED=1
CRM_DIR=crm
AC_DEFINE_UNQUOTED(WITH_CRM, 1, Use the new Cluster Resource Manager)
else
if test -z "${enable_crm}"; then
enable_crm="no"
fi
dnl None of the following items build without the CRM available
enable_mgmt=no
enable_cim_provider=no
fi
CRM_ENABLED=0
AC_SUBST(CRM_DIR)
AC_MSG_NOTICE([whether to enable the Cluster Resource Manager... ${enable_crm}])
AM_CONDITIONAL(CRM_BUILD, test "x${enable_crm}" = "xyes")
AC_SUBST(CRM_ENABLED)
AM_CONDITIONAL(CRM_BUILD, test "x${enable_crm}" = "xyes")
AC_MSG_NOTICE([whether to enable the Cluster Resource Manager... ${enable_crm}])
dnl None of the following items build without the CRM available
enable_mgmt=no
enable_cim_provider=no
dnl lrm configuration
AC_ARG_ENABLE([lrm],
......@@ -3069,30 +3057,6 @@ resources/Makefile \
resources/heartbeat/Xinetd \
)
if test "x${enable_crm}" = "xyes"; then
AC_CONFIG_FILES( \
crm/Makefile \
crm/cib/Makefile \
crm/crmd/Makefile \
crm/pengine/Makefile \
crm/tengine/Makefile \
crm/admin/Makefile \
crm/admin/crm_primitive.py \
crm/admin/crm_sh \
crm/admin/crm_utils.py \
crm/admin/crm_commands.py \
include/crm/Makefile \
include/crm/common/Makefile \
include/crm/pengine/Makefile \
lib/crm/Makefile \
lib/crm/common/Makefile \
lib/crm/cib/Makefile \
lib/crm/pengine/Makefile \
lib/crm/transition/Makefile \
)
fi
if test "x${enable_mgmt}" = "xyes"; then
AC_CONFIG_FILES( \
include/mgmt/Makefile \
......
Makefile
Makefile.in
*.diff
*.beam
parser-messages
MISC_ERRORS
crm.dtd
#
# Copyright (C) 2004 Andrew Beekhof
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
MAINTAINERCLEANFILES = Makefile.in
## Subdirectories
SUBDIRS = cib crmd pengine tengine admin
DIST_SUBDIRS = cib crmd pengine tengine admin
dtddir = $(HA_NOARCHDATAHBDIR)
crm_varlibdir = $(HA_VARLIBDIR)/$(HB_PKG)/crm
crm_varrundir = $(HA_VARRUNDIR)/$(HB_PKG)/crm
EXTRA_DIST = crm-1.0.dtd
dtd_SCRIPTS = crm.dtd
crm.dtd: crm-1.0.dtd
cp $(top_srcdir)/crm/crm-1.0.dtd crm.dtd
install-exec-local:
$(mkinstalldirs) $(DESTDIR)/$(crm_varlibdir)
-chown $(HA_CCMUSER) $(DESTDIR)/$(crm_varlibdir)
-chgrp $(HA_APIGROUP) $(DESTDIR)/$(crm_varlibdir)
-chmod 750 $(DESTDIR)/$(crm_varlibdir)
$(mkinstalldirs) $(DESTDIR)/$(crm_varrundir)
-chown $(HA_CCMUSER) $(DESTDIR)/$(crm_varrundir)
-chgrp $(HA_APIGROUP) $(DESTDIR)/$(crm_varrundir)
-chmod 750 $(DESTDIR)/$(crm_varrundir)
This directory contains the design documentation and eventually the code
for the Cluster Resource Manager framework for heartbeat.
We might eventually have several policy engines and other modular
components (as outlined in the crm.txt), but hopefully only one
framework they all plug into.
###################
Installation:
===============================
run ConfigureMe or bootstrap with the --enable-crm option
make ; make install
Pids, sockets and the CIB configuration will be in: $HA_VARLIBDIR/heartbeat/crm
Executables will be in /usr/lib/heartbeat/ or wherever the heartbeat
executable is normally found
Logs will be in: /var/log
A couple of developmental trace files will also turn up in /tmp.
In particular live.dot can be used with the dot program to trace the state changes.
Startup:
===============================
- Add a respawn entry for ccm to ha.cf
- Add a respawn entry for lrmd to ha.cf
- Add the appropriate "apiauth" entries to ha.cf
- Remove entries from haresources
- Remove any stonith devices from ha.cf
- Start heartbeat using the -M switch
- start the crmd ($your_bin_dir/crmd)
Testing & Configuration:
===============================
See 1node.sh and 2node.sh in the testing sub-dir for detailed startup and configuration examples.
helper.sh contains argument processing for both of these scripts.
Logging:
===============================
By default the CRMd filters out LOG_DEBUG messages and anything more verbose.
This can be altered by invoking it with multiple -V options to increase this level.
Alternativly, sending SIGUSR1 and SIGUSR2 will increase and decrease the log level.
If the log level is more verbose than LOG_INFO, debug info will also be logged to stdout.
Admin Tools:
===============================
There are two admin tools: crmadmin and cibadmin. Run both with -? or no arguments to see up-to-date help information.
The crmadmin tool is primarily for controling the cluster and running some common queries.
The cibadmin tool is for configuring the cluster (maintaining the CIB) and running more detailed and custom queries of the CIB.
Makefile
Makefile.in
.libs
crmadmin
cibadmin
ccm_tool
.deps
*.beam
parser-messages
MISC_ERRORS
crm_diff
crm_mon
iso8601
crm_resource
crm_verify
crm_attribute
crm_standby
crm_master
crm_uuid
crm_primitive.py
crm_failcount
crm_sh
crm_primitive.py
crm_commands.py
crm_utils.py
#
# Copyright (C) 2004 Andrew Beekhof
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl \
-I$(top_builddir)/linux-ha -I$(top_srcdir)/linux-ha \
-I$(top_builddir) -I$(top_srcdir)
halibdir = $(libdir)/@HB_PKG@
hasbindir = $(sbindir)
LIBRT = @LIBRT@
AM_CFLAGS = @CFLAGS@ $(CRM_DEBUG_FLAGS)
COMMONLIBS = \
$(top_builddir)/lib/clplumbing/libplumb.la \
$(top_builddir)/lib/crm/common/libcrmcommon.la \
$(top_builddir)/lib/crm/cib/libcib.la \
$(top_builddir)/lib/hbclient/libhbclient.la \
$(GLIBLIB) \
$(CURSESLIBS) \
$(LIBRT)
halib_PYTHON = crm_primitive.py crm_utils.py crm_commands.py
hasbin_PROGRAMS = crmadmin cibadmin ccm_tool crm_diff crm_mon iso8601 \
crm_master crm_standby crm_failcount crm_attribute \
crm_resource crm_verify crm_uuid
hasbin_SCRIPTS = crm_sh
## SOURCES
#noinst_HEADERS = config.h control.h crmd.h
noinst_HEADERS =
crmadmin_SOURCES = crmadmin.c
crmadmin_LDADD = $(COMMONLIBS) \
$(top_builddir)/lib/crm/pengine/libpe_status.la
crm_uuid_SOURCES = crm_uuid.c
crm_uuid_LDADD = $(GLIBLIB) $(top_builddir)/lib/clplumbing/libplumb.la
cibadmin_SOURCES = cibadmin.c
cibadmin_LDADD = $(COMMONLIBS)
ccm_tool_SOURCES = ccm_epoche.c
ccm_tool_LDADD = $(COMMONLIBS) \
$(top_builddir)/membership/ccm/libccmclient.la
crm_diff_SOURCES = xml_diff.c
crm_diff_LDADD = $(COMMONLIBS)
crm_mon_SOURCES = crm_mon.c
crm_mon_LDADD = $(COMMONLIBS) \
$(top_builddir)/lib/crm/pengine/libpe_status.la
# Arguments could be made that this should live in crm/pengine
crm_verify_SOURCES = crm_verify.c
crm_verify_LDADD = $(COMMONLIBS) \
$(top_builddir)/lib/crm/pengine/libpe_status.la \
$(top_builddir)/crm/pengine/libpengine.la
crm_master_SOURCES = crm_attribute.c
crm_master_LDADD = $(COMMONLIBS)
crm_standby_SOURCES = crm_attribute.c
crm_standby_LDADD = $(COMMONLIBS)
crm_attribute_SOURCES = crm_attribute.c
crm_attribute_LDADD = $(COMMONLIBS)
crm_failcount_SOURCES = crm_attribute.c
crm_failcount_LDADD = $(COMMONLIBS)
crm_resource_SOURCES = crm_resource.c
crm_resource_LDADD = $(COMMONLIBS) \
$(top_builddir)/lib/crm/pengine/libpe_status.la
iso8601_SOURCES = test.iso8601.c
iso8601_LDADD = $(COMMONLIBS)
clean-generic:
rm -f *.log *.debug *.xml *~
install-exec-local:
uninstall-local:
/*
* Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lha_internal.h>
#include <sys/param.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <clplumbing/cl_log.h>
#include <clplumbing/cl_signal.h>
#include <clplumbing/lsb_exitcodes.h>
#include <ocf/oc_event.h>
#include <ocf/oc_membership.h>
#include <crm/crm.h>
const char* crm_system_name = "ccm_tool";
oc_ev_t *ccm_token = NULL;
int command = 0;
#define OPTARGS "hVqep"
void oc_ev_special(const oc_ev_t *, oc_ev_class_t , int );
static void ccm_age_callback(
oc_ed_t event, void *cookie, size_t size, const void *data);
gboolean ccm_age_connect(int *ccm_fd);
void usage(const char* cmd, int exit_status);
char *lookup_host = NULL;
int
main(int argc, char ** argv)
{
int flag;
int argerr = 0;
int ccm_fd = 0;
fd_set rset;
oc_ev_t *ccm_token = NULL;
crm_log_init(crm_system_name, LOG_INFO, FALSE, FALSE, 0, NULL);
while ((flag = getopt(argc, argv, OPTARGS)) != EOF) {
switch(flag) {
case 'V':
cl_log_enable_stderr(TRUE);
alter_debug(DEBUG_INC);
break;
case 'h': /* Help message */
usage(crm_system_name, LSB_EXIT_OK);
break;
case 'p':
case 'e':
case 'q':
command = flag;
break;
default:
++argerr;
break;
}
}
if (optind > argc) {
++argerr;
}
if (argerr) {
usage(crm_system_name,LSB_EXIT_GENERIC);
}
if(ccm_age_connect(&ccm_fd)) {
int rc = 0;
int lpc = 0;
for (;;lpc++) {
FD_ZERO(&rset);
FD_SET(ccm_fd, &rset);
rc = select(ccm_fd + 1, &rset, NULL,NULL,NULL);
if(rc == -1){
perror("select failed");
if(errno == EINTR) {
crm_debug("Retry...");
continue;
}
} else if(oc_ev_handle_event(ccm_token) != 0){
crm_err("oc_ev_handle_event failed");
}
return(1);
}
}
return(1);
}
void
usage(const char* cmd, int exit_status)
{
FILE* stream;
stream = exit_status ? stderr : stdout;
fprintf(stream, "usage: %s [-V] [-p|-e|-q]\n", cmd);
fprintf(stream, "\t-p : print the members of this partition\n");
fprintf(stream, "\t-e : print the epoch this node joined the partition\n");
fprintf(stream, "\t-q : print a 1 if our partition has quorum\n");
fflush(stream);
exit(exit_status);
}
gboolean
ccm_age_connect(int *ccm_fd)
{
gboolean did_fail = FALSE;
int ret = 0;
crm_debug("Registering with CCM");
ret = oc_ev_register(&ccm_token);
if (ret != 0) {
crm_warn("CCM registration failed");
did_fail = TRUE;
}
if(did_fail == FALSE) {
crm_debug("Setting up CCM callbacks");
ret = oc_ev_set_callback(ccm_token, OC_EV_MEMB_CLASS,
ccm_age_callback, NULL);
if (ret != 0) {
crm_warn("CCM callback not set");
did_fail = TRUE;
}
}
if(did_fail == FALSE) {
oc_ev_special(ccm_token, OC_EV_MEMB_CLASS, 0/*don't care*/);
crm_debug("Activating CCM token");
ret = oc_ev_activate(ccm_token, ccm_fd);
if (ret != 0){
crm_warn("CCM Activation failed");
did_fail = TRUE;
}
}
return !did_fail;
}
static void
ccm_age_callback(oc_ed_t event, void *cookie, size_t size, const void *data)
{
int lpc;
int node_list_size;
const oc_ev_membership_t *oc = (const oc_ev_membership_t *)data;
crm_debug_3("-----------------------");
crm_debug_3("trans=%d, nodes=%d, new=%d, lost=%d n_idx=%d, "
"new_idx=%d, old_idx=%d",
oc->m_instance,
oc->m_n_member, oc->m_n_in, oc->m_n_out,
oc->m_memb_idx, oc->m_in_idx, oc->m_out_idx);
node_list_size = oc->m_n_member;
if(command == 'q') {
crm_debug("Processing \"%s\" event.",
event==OC_EV_MS_NEW_MEMBERSHIP?"NEW MEMBERSHIP":
event==OC_EV_MS_NOT_PRIMARY?"NOT PRIMARY":
event==OC_EV_MS_PRIMARY_RESTORED?"PRIMARY RESTORED":
event==OC_EV_MS_EVICTED?"EVICTED":
"NO QUORUM MEMBERSHIP");
if(ccm_have_quorum(event)) {
fprintf(stdout, "1\n");
} else {
fprintf(stdout, "0\n");
}
} else if(command == 'e') {
crm_debug("Searching %d members for our birth", oc->m_n_member);
}
for(lpc=0; lpc<node_list_size; lpc++) {
if(command == 'p') {
fprintf(stdout, "%s ",
oc->m_array[oc->m_memb_idx+lpc].node_uname);
} else if(command == 'e') {
if(oc_ev_is_my_nodeid(ccm_token, &(oc->m_array[lpc]))){
crm_debug("MATCH: nodeid=%d, uname=%s, born=%d",
oc->m_array[oc->m_memb_idx+lpc].node_id,
oc->m_array[oc->m_memb_idx+lpc].node_uname,
oc->m_array[oc->m_memb_idx+lpc].node_born_on);
fprintf(stdout, "%d\n",
oc->m_array[oc->m_memb_idx+lpc].node_born_on);
}
}
crm_debug_3("\tCURRENT: %s [nodeid=%d, born=%d]",
oc->m_array[oc->m_memb_idx+lpc].node_uname,
oc->m_array[oc->m_memb_idx+lpc].node_id,
oc->m_array[oc->m_memb_idx+lpc].node_born_on);
}
for(lpc=0; lpc < (int)oc->m_n_in; lpc++) {
crm_debug_3("\tNEW: %s [nodeid=%d, born=%d]",
oc->m_array[oc->m_in_idx+lpc].node_uname,
oc->m_array[oc->m_in_idx+lpc].node_id,
oc->m_array[oc->m_in_idx+lpc].node_born_on);
}
for(lpc=0; lpc < (int)oc->m_n_out; lpc++) {
crm_debug_3("\tLOST: %s [nodeid=%d, born=%d]",
oc->m_array[oc->m_out_idx+lpc].node_uname,
oc->m_array[oc->m_out_idx+lpc].node_id,
oc->m_array[oc->m_out_idx+lpc].node_born_on);
}
crm_debug_3("-----------------------");
oc_ev_callback_done(cookie);
if(command == 'p') {
fprintf(stdout, "\n");
}
fflush(stdout);
exit(0);
}
/*
* Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <lha_internal.h>
#include <sys/param.h>
#include <crm/crm.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <hb_api.h>
#include <clplumbing/uids.h>
#include <clplumbing/Gmain_timeout.h>
#include <crm/msg_xml.h>
#include <crm/common/xml.h>
#include <crm/common/ctrl.h>
#include <crm/common/ipc.h>
#include <crm/cib.h>