diff --git a/configure.ac b/configure.ac index e2b693f33b..c1783ddff4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,1434 +1,1458 @@ dnl dnl autoconf for Pacemaker dnl dnl License: GNU General Public License (GPL) dnl =============================================== dnl Bootstrap dnl =============================================== AC_PREREQ(2.53) dnl Suggested structure: dnl information on the package dnl checks for programs dnl checks for libraries dnl checks for header files dnl checks for types dnl checks for structures dnl checks for compiler characteristics dnl checks for library functions dnl checks for system services AC_INIT(pacemaker, 1.0.4, pacemaker@oss.clusterlabs.org) CRM_DTD_VERSION="1.0" PKG_FEATURES="" HB_PKG=heartbeat AC_CONFIG_AUX_DIR(.) AC_CANONICAL_HOST dnl Where #defines go (e.g. `AC_CHECK_HEADERS' below) dnl dnl Internal header: include/config.h dnl - Contains ALL defines dnl - include/config.h.in is generated automatically by autoheader dnl - NOT to be included in any header files except lha_internal.h dnl (which is also not to be included in any other header files) dnl dnl External header: include/crm_config.h dnl - Contains a subset of defines checked here dnl - Manually edit include/crm_config.h.in to have configure include dnl new defines dnl - Should not include HAVE_* defines dnl - Safe to include anywhere AM_CONFIG_HEADER(include/config.h include/crm_config.h) ALL_LINGUAS="en fr" AC_ARG_WITH(version, [ --with-version=version Override package version (if you're a packager needing to pretend) ], [ PACKAGE_VERSION="$withval" ]) AC_ARG_WITH(pkg-name, [ --with-pkg-name=name Override package name (if you're a packager needing to pretend) ], [ PACKAGE_NAME="$withval" ]) AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) AC_DEFINE_UNQUOTED(PACEMAKER_VERSION, "$PACKAGE_VERSION", Current pacemaker version) CC_IN_CONFIGURE=yes export CC_IN_CONFIGURE LDD=ldd dnl ======================================================================== dnl Compiler characteristics dnl ======================================================================== AC_PROG_CC dnl Can force other with environment variable "CC". AM_PROG_CC_C_O AC_PROG_CC_STDC AC_LIBTOOL_DLOPEN dnl Enable dlopen support... AC_LIBLTDL_CONVENIENCE dnl make libltdl a convenience lib AC_PROG_LIBTOOL AC_C_STRINGIZE AC_TYPE_SIZE_T AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) AC_STRUCT_TIMEZONE dnl =============================================== dnl Helpers dnl =============================================== cc_supports_flag() { local CFLAGS="$@" AC_MSG_CHECKING(whether $CC supports "$@") AC_COMPILE_IFELSE([int main(){return 0;}] ,[RC=0; AC_MSG_RESULT(yes)],[RC=1; AC_MSG_RESULT(no)]) return $RC } extract_header_define() { AC_MSG_CHECKING(for $2 in $1) Cfile=/tmp/extract_define.$2.${$} printf "#include \n" > ${Cfile}.c printf "#include <%s>\n" $1 >> ${Cfile}.c printf "int main(int argc, char **argv) { printf(\"%%s\", %s); return 0; }\n" $2 >> ${Cfile}.c $CC $CFLAGS ${Cfile}.c -o ${Cfile} value=`${Cfile}` AC_MSG_RESULT($value) printf $value rm -f ${Cfile}.c ${Cfile} } dnl =============================================== dnl Configure Options dnl =============================================== dnl Some systems, like Solaris require a custom package name AC_ARG_WITH(pkgname, [ --with-pkgname=name name for pkg (typically for Solaris) ], [ PKGNAME="$withval" ], [ PKGNAME="LXHAhb" ], ) AC_SUBST(PKGNAME) AC_ARG_ENABLE([ansi], [ --enable-ansi force GCC to compile to ANSI/ANSI standard for older compilers. [default=yes]]) AC_ARG_ENABLE([fatal-warnings], [ --enable-fatal-warnings very pedantic and fatal warnings for gcc [default=yes]]) AC_ARG_ENABLE([pretty], [ --enable-pretty Pretty-print compiler output unless there is an error [default=no]]) AC_ARG_ENABLE([quiet], [ --enable-quiet Supress make output unless there is an error [default=no]]) AC_ARG_ENABLE([thread-safe], [ --enable-thread-safe Enable some client libraries to be thread safe. [default=no]]) AC_ARG_ENABLE([bundled-ltdl], [ --enable-bundled-ltdl Configure, build and install the standalone ltdl library bundled with ${PACKAGE} [default=no]]) LTDL_LIBS="" AC_ARG_WITH(ais, [ --with-ais Support the OpenAIS messaging and membership layer ], [ SUPPORT_AIS=$withval ], [ SUPPORT_AIS=try ], ) AC_ARG_WITH(heartbeat, [ --with-heartbeat Support the Heartbeat messaging and membership layer ], [ SUPPORT_HEARTBEAT=$withval ], [ SUPPORT_HEARTBEAT=try ], ) AC_ARG_WITH(snmp, [ --with-snmp Support the SNMP protocol ], [ SUPPORT_SNMP=$withval ], [ SUPPORT_SNMP=try ], ) AC_ARG_WITH(esmtp, [ --with-esmtp Support the sending mail notifications with the esmtp library ], [ SUPPORT_ESMTP=$withval ], [ SUPPORT_ESMTP=try ], ) AISPREFIX="" AC_ARG_WITH(ais-prefix, [ --with-ais-prefix=DIR Prefix used when OpenAIS was installed [$prefix]], [ AISPREFIX=$withval ], [ AISPREFIX=$prefix ]) LCRSODIR="" AC_ARG_WITH(lcrso-dir, [ --with-lcrso-dir=DIR OpenAIS lcrso files. ], [ LCRSODIR="$withval" ]) INITDIR="" AC_ARG_WITH(initdir, [ --with-initdir=DIR directory for init (rc) scripts [${INITDIR}]], [ INITDIR="$withval" ]) dnl =============================================== dnl General Processing dnl =============================================== AC_SUBST(HB_PKG) INIT_EXT="" echo Our Host OS: $host_os/$host AC_MSG_NOTICE(Sanitizing prefix: ${prefix}) case $prefix in NONE) prefix=/usr;; esac AC_MSG_NOTICE(Sanitizing exec_prefix: ${exec_prefix}) case $exec_prefix in dnl For consistency with Heartbeat, map NONE->$prefix NONE) exec_prefix=$prefix;; prefix) exec_prefix=$prefix;; esac AC_MSG_NOTICE(Sanitizing ais_prefix: ${AISPREFIX}) case $AISPREFIX in dnl For consistency with Heartbeat, map NONE->$prefix NONE) AISPREFIX=$prefix;; prefix) AISPREFIX=$prefix;; esac AC_MSG_NOTICE(Sanitizing INITDIR: ${INITDIR}) case $INITDIR in prefix) INITDIR=$prefix;; "") AC_MSG_CHECKING(which init (rc) directory to use) for initdir in /etc/init.d /etc/rc.d/init.d /sbin/init.d \ /usr/local/etc/rc.d /etc/rc.d do if test -d $initdir then INITDIR=$initdir break fi done AC_MSG_RESULT($INITDIR);; esac AC_SUBST(INITDIR) AC_MSG_NOTICE(Sanitizing libdir: ${libdir}) case $libdir in dnl For consistency with Heartbeat, map NONE->$prefix *prefix*|NONE) AC_MSG_CHECKING(which lib directory to use) for aDir in lib64 lib do trydir="${exec_prefix}/${aDir}" if test -d ${trydir} then libdir=${trydir} break fi done AC_MSG_RESULT($libdir); ;; esac dnl Expand autoconf variables so that we dont end up with '${prefix}' dnl in #defines and python scripts dnl NOTE: Autoconf deliberately leaves them unexpanded to allow dnl make exec_prefix=/foo install dnl No longer being able to do this seems like no great loss to me... eval prefix="`eval echo ${prefix}`" eval exec_prefix="`eval echo ${exec_prefix}`" eval bindir="`eval echo ${bindir}`" eval sbindir="`eval echo ${sbindir}`" eval libexecdir="`eval echo ${libexecdir}`" eval datadir="`eval echo ${datadir}`" eval sysconfdir="`eval echo ${sysconfdir}`" eval sharedstatedir="`eval echo ${sharedstatedir}`" eval localstatedir="`eval echo ${localstatedir}`" eval libdir="`eval echo ${libdir}`" eval includedir="`eval echo ${includedir}`" eval oldincludedir="`eval echo ${oldincludedir}`" eval infodir="`eval echo ${infodir}`" eval mandir="`eval echo ${mandir}`" dnl Home-grown variables eval INITDIR="${INITDIR}" eval docdir="`eval echo ${docdir}`" for j in prefix exec_prefix bindir sbindir libexecdir datadir sysconfdir \ sharedstatedir localstatedir libdir includedir oldincludedir infodir \ mandir INITDIR docdir do dirname=`eval echo '${'${j}'}'` if test ! -d "$dirname" then AC_MSG_WARN([$j directory ($dirname) does not exist!]) fi done dnl This OS-based decision-making is poor autotools practice; dnl feature-based mechanisms are strongly preferred. dnl dnl So keep this section to a bare minimum; regard as a "necessary evil". case "$host_os" in *bsd*) LIBS="-L/usr/local/lib" CPPFLAGS="$CPPFLAGS -I/usr/local/include" INIT_EXT=".sh" ;; *solaris*) ;; *linux*) AC_DEFINE_UNQUOTED(ON_LINUX, 1, Compiling for Linux platform) ;; darwin*) AC_DEFINE_UNQUOTED(ON_DARWIN, 1, Compiling for Darwin platform) LIBS="$LIBS -L${prefix}/lib" CFLAGS="$CFLAGS -I${prefix}/include" ;; esac dnl Eventually remove this CFLAGS="$CFLAGS -I${prefix}/include/heartbeat" AC_SUBST(INIT_EXT) AC_DEFINE_UNQUOTED(HA_LOG_FACILITY, LOG_DAEMON, Default logging facility) AC_MSG_NOTICE(Host CPU: $host_cpu) case "$host_cpu" in ppc64|powerpc64) case $CFLAGS in *powerpc64*) ;; *) if test "$GCC" = yes; then CFLAGS="$CFLAGS -m64" fi ;; esac esac AC_MSG_CHECKING(which format is needed to print uint64_t) case "$host_cpu" in s390x)U64T="%lu";; *64*) U64T="%lu";; *) U64T="%llu";; esac AC_MSG_RESULT($U64T) AC_DEFINE_UNQUOTED(U64T, "$U64T", Correct printf format for logging uint64_t) AC_CHECK_HEADERS(hb_config.h) AC_CHECK_HEADERS(glue_config.h) GLUE_HEADER=none if test "$ac_cv_header_hb_config_h" = "yes"; then GLUE_HEADER=hb_config.h elif test "$ac_cv_header_glue_config_h" = "yes"; then GLUE_HEADER=glue_config.h else AC_MSG_FAILURE(Core development headers were not found) fi dnl Variables needed for substitution CRM_DTD_DIRECTORY="${datadir}/pacemaker" AC_DEFINE_UNQUOTED(CRM_DTD_DIRECTORY,"$CRM_DTD_DIRECTORY", Location for the Pacemaker Relax-NG Schema) AC_SUBST(CRM_DTD_DIRECTORY) AC_DEFINE_UNQUOTED(CRM_DTD_VERSION,"$CRM_DTD_VERSION", Current version of the Pacemaker Relax-NG Schema) AC_SUBST(CRM_DTD_VERSION) CRM_DAEMON_USER=`extract_header_define $GLUE_HEADER HA_CCMUSER` AC_DEFINE_UNQUOTED(CRM_DAEMON_USER,"$CRM_DAEMON_USER", User to run Pacemaker daemons as) AC_SUBST(CRM_DAEMON_USER) CRM_DAEMON_GROUP=`extract_header_define $GLUE_HEADER HA_APIGROUP` AC_DEFINE_UNQUOTED(CRM_DAEMON_GROUP,"$CRM_DAEMON_GROUP", Group to run Pacemaker daemons as) AC_SUBST(CRM_DAEMON_GROUP) CRM_STATE_DIR=${localstatedir}/run/crm AC_DEFINE_UNQUOTED(CRM_STATE_DIR,"$CRM_STATE_DIR", Where to keep state files and sockets) AC_SUBST(CRM_STATE_DIR) PE_STATE_DIR="${localstatedir}/lib/pengine" AC_DEFINE_UNQUOTED(PE_STATE_DIR,"$PE_STATE_DIR", Where to keep PEngine outputs) AC_SUBST(PE_STATE_DIR) dnl Eventually move out of the heartbeat dir tree and create compatability code CRM_CONFIG_DIR="${localstatedir}/lib/heartbeat/crm" AC_DEFINE_UNQUOTED(CRM_CONFIG_DIR,"$CRM_CONFIG_DIR", Where to keep CIB configuration files) AC_SUBST(CRM_CONFIG_DIR) dnl Eventually move out of the heartbeat dir tree and create symlinks when needed CRM_DAEMON_DIR=`extract_header_define $GLUE_HEADER HA_LIBHBDIR` AC_DEFINE_UNQUOTED(CRM_DAEMON_DIR,"$CRM_DAEMON_DIR", Location for Pacemaker daemons) AC_SUBST(CRM_DAEMON_DIR) dnl Needed so that the AIS plugin can clear out the directory as Heartbeat does HA_STATE_DIR=`extract_header_define $GLUE_HEADER HA_VARRUNDIR` AC_DEFINE_UNQUOTED(HA_STATE_DIR,"$HA_STATE_DIR", Where Heartbeat keeps state files and sockets) AC_SUBST(HA_STATE_DIR) dnl Needed for the location of hostcache in CTS.py HA_VARLIBHBDIR=`extract_header_define $GLUE_HEADER HA_VARLIBHBDIR` AC_SUBST(HA_VARLIBHBDIR) AC_DEFINE_UNQUOTED(UUID_FILE,"$localstatedir/lib/heartbeat/hb_uuid", Location of Heartbeat's UUID file) OCF_ROOT_DIR=`extract_header_define $GLUE_HEADER OCF_ROOT_DIR` if test "X$OCF_ROOT_DIR" = X; then AC_MSG_ERROR(Could not locate OCF directory) fi AC_SUBST(OCF_ROOT_DIR) OCF_RA_DIR=`extract_header_define $GLUE_HEADER OCF_RA_DIR` AC_DEFINE_UNQUOTED(OCF_RA_DIR,"$OCF_RA_DIR", Location for OCF RAs) AC_SUBST(OCF_RA_DIR) dnl Extract this value from glue_config.h once we no longer support anything else STONITH_PLUGIN_DIR="$libdir/stonith/plugins/stonith/" AC_DEFINE_UNQUOTED(STONITH_PLUGIN_DIR,"$STONITH_PLUGIN_DIR", Location for Stonith plugins) AC_SUBST(STONITH_PLUGIN_DIR) AC_PATH_PROGS(HG, hg false) AC_MSG_CHECKING(build version) BUILD_VERSION=unknown if test -f $srcdir/.hg_archival.txt; then BUILD_VERSION=`cat $srcdir/.hg_archival.txt | awk '/node:/ { print $2 }'` elif test -x $HG -a -d .hg; then BUILD_VERSION=`$HG id -itb` if test $? != 0; then BUILD_VERSION=unknown fi fi AC_DEFINE_UNQUOTED(BUILD_VERSION, "$BUILD_VERSION", Build version) AC_MSG_RESULT($BUILD_VERSION) AC_SUBST(BUILD_VERSION) dnl =============================================== dnl Program Paths dnl =============================================== PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin" export PATH dnl Replacing AC_PROG_LIBTOOL with AC_CHECK_PROG because LIBTOOL dnl was NOT being expanded all the time thus causing things to fail. AC_CHECK_PROGS(LIBTOOL, glibtool libtool libtool15 libtool13) AM_PATH_PYTHON AC_CHECK_PROGS(MAKE, gmake make) AC_PATH_PROGS(HTML2TXT, lynx w3m) AC_PATH_PROGS(HELP2MAN, help2man) AC_PATH_PROGS(POD2MAN, pod2man, pod2man) AC_PATH_PROGS(SSH, ssh, /usr/bin/ssh) AC_PATH_PROGS(SCP, scp, /usr/bin/scp) AC_PATH_PROGS(HG, hg, /bin/false) AC_PATH_PROGS(TAR, tar) AC_PATH_PROGS(MD5, md5) AC_PATH_PROGS(TEST, test) AC_PATH_PROGS(PKGCONFIG, pkg-config) AC_PATH_PROGS(XML2CONFIG, xml2-config) AC_PATH_PROGS(VALGRIND_BIN, valgrind, /usr/bin/valgrind) AC_DEFINE_UNQUOTED(VALGRIND_BIN, "$VALGRIND_BIN", Valgrind command) if test x"${LIBTOOL}" = x""; then AC_MSG_ERROR(You need (g)libtool installed in order to build ${PACKAGE}) fi if test x"${MAKE}" = x""; then AC_MSG_ERROR(You need (g)make installed in order to build ${PACKAGE}) fi AM_CONDITIONAL(BUILD_HELP, test x"${HELP2MAN}" != x"") if test x"${HELP2MAN}" != x""; then PKG_FEATURES="$PKG_FEATURES manpages" fi dnl =============================================== dnl Libraries dnl =============================================== AC_CHECK_LIB(socket, socket) dnl -lsocket AC_CHECK_LIB(c, dlopen) dnl if dlopen is in libc... AC_CHECK_LIB(dl, dlopen) dnl -ldl (for Linux) AC_CHECK_LIB(rt, sched_getscheduler) dnl -lrt (for Tru64) AC_CHECK_LIB(gnugetopt, getopt_long) dnl -lgnugetopt ( if available ) AC_CHECK_LIB(pam, pam_start) dnl -lpam (if available) AC_CHECK_LIB(uuid, uuid_parse) dnl e2fsprogs AC_CHECK_LIB(uuid, uuid_create) dnl ossp if test x"${PKGCONFIG}" = x""; then AC_MSG_ERROR(You need pkgconfig installed in order to build ${PACKAGE}) fi dnl dnl On many systems libcrypto is needed when linking against libsnmp. dnl Check to see if it exists, and if so use it. dnl AC_CHECK_LIB(crypto, CRYPTO_free, CRYPTOLIB="-lcrypto",) AC_SUBST(CRYPTOLIB) if test "x${enable_thread_safe}" = "xyes"; then GPKGNAME="gthread-2.0" else GPKGNAME="glib-2.0" fi if $PKGCONFIG --exists $GPKGNAME then GLIBCONFIG="$PKGCONFIG $GPKGNAME" else set -x echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH $PKGCONFIG --exists $GPKGNAME; echo $? $PKGCONFIG --cflags $GPKGNAME; echo $? $PKGCONFIG $GPKGNAME; echo $? set +x AC_MSG_ERROR(You need glib2-devel installed in order to build ${PACKAGE}) fi AC_MSG_RESULT(using $GLIBCONFIG) # # Where is dlopen? # if test "$ac_cv_lib_c_dlopen" = yes; then LIBADD_DL="" elif test "$ac_cv_lib_dl_dlopen" = yes; then LIBADD_DL=-ldl else LIBADD_DL=${lt_cv_dlopen_libs} fi dnl dnl Check for location of gettext dnl dnl On at least Solaris 2.x, where it is in libc, specifying lintl causes dnl grief. Ensure minimal result, not the sum of all possibilities. dnl And do libc first. dnl Known examples: dnl c: Linux, Solaris 2.6+ dnl intl: BSD, AIX AC_CHECK_LIB(c, gettext) if test x$ac_cv_lib_c_gettext != xyes; then AC_CHECK_LIB(intl, gettext) fi if test x$ac_cv_lib_c_gettext != xyes -a x$ac_cv_lib_intl_gettext != xyes; then AC_MSG_ERROR(You need gettext installed in order to build ${PACKAGE}) fi if test "X$GLIBCONFIG" != X; then AC_MSG_CHECKING(for special glib includes: ) GLIBHEAD=`$GLIBCONFIG --cflags` AC_MSG_RESULT($GLIBHEAD) CPPFLAGS="$CPPFLAGS $GLIBHEAD" AC_MSG_CHECKING(for glib library flags) GLIBLIB=`$GLIBCONFIG --libs` AC_MSG_RESULT($GLIBLIB) LIBS="$LIBS $GLIBLIB" fi dnl ======================================================================== dnl Headers dnl ======================================================================== AC_HEADER_STDC AC_CHECK_HEADERS(arpa/inet.h) AC_CHECK_HEADERS(asm/types.h) AC_CHECK_HEADERS(assert.h) AC_CHECK_HEADERS(auth-client.h) AC_CHECK_HEADERS(ctype.h) AC_CHECK_HEADERS(dirent.h) AC_CHECK_HEADERS(errno.h) AC_CHECK_HEADERS(fcntl.h) AC_CHECK_HEADERS(getopt.h) AC_CHECK_HEADERS(glib.h) AC_CHECK_HEADERS(grp.h) AC_CHECK_HEADERS(limits.h) AC_CHECK_HEADERS(linux/errqueue.h) AC_CHECK_HEADERS(malloc.h) AC_CHECK_HEADERS(netdb.h) AC_CHECK_HEADERS(netinet/in.h) AC_CHECK_HEADERS(netinet/ip.h) AC_CHECK_HEADERS(pam/pam_appl.h) AC_CHECK_HEADERS(pthread.h) AC_CHECK_HEADERS(pwd.h) AC_CHECK_HEADERS(security/pam_appl.h) AC_CHECK_HEADERS(sgtty.h) AC_CHECK_HEADERS(signal.h) AC_CHECK_HEADERS(stdarg.h) AC_CHECK_HEADERS(stddef.h) AC_CHECK_HEADERS(stdio.h) AC_CHECK_HEADERS(stdlib.h) AC_CHECK_HEADERS(string.h) AC_CHECK_HEADERS(strings.h) AC_CHECK_HEADERS(sys/dir.h) AC_CHECK_HEADERS(sys/ioctl.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/poll.h) AC_CHECK_HEADERS(sys/resource.h) AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(sys/socket.h) AC_CHECK_HEADERS(sys/sockio.h) AC_CHECK_HEADERS(sys/stat.h) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/timeb.h) AC_CHECK_HEADERS(sys/types.h) AC_CHECK_HEADERS(sys/uio.h) AC_CHECK_HEADERS(sys/un.h) AC_CHECK_HEADERS(sys/utsname.h) AC_CHECK_HEADERS(sys/wait.h) AC_CHECK_HEADERS(time.h) AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(winsock.h) dnl These headers need prerequisits before the tests will pass dnl AC_CHECK_HEADERS(net/if.h) dnl AC_CHECK_HEADERS(netinet/icmp6.h) dnl AC_CHECK_HEADERS(netinet/ip6.h) dnl AC_CHECK_HEADERS(netinet/ip_icmp.h) AC_MSG_CHECKING(for special libxml2 includes) if test "x$XML2CONFIG" = "x"; then AC_MSG_ERROR(libxml2 config not found) else XML2HEAD="`$XML2CONFIG --cflags`" AC_MSG_RESULT($XML2HEAD) AC_CHECK_LIB(xml2, xmlReadMemory) AC_CHECK_LIB(xslt, xsltApplyStylesheet) fi CPPFLAGS="$CPPFLAGS $XML2HEAD" AC_CHECK_HEADERS(libxml/xpath.h) AC_CHECK_HEADERS(libxslt/xslt.h) if test "$ac_cv_header_libxml_xpath_h" != "yes"; then AC_MSG_ERROR(The libxml developement headers were not found) fi if test "$ac_cv_header_libxslt_xslt_h" != "yes"; then AC_MSG_ERROR(The libxslt developement headers were not found) fi dnl ======================================================================== dnl Structures dnl ======================================================================== AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[[#include ]]) dnl ======================================================================== dnl Functions dnl ======================================================================== AC_CHECK_FUNCS(g_log_set_default_handler) AC_CHECK_FUNCS(getopt, AC_DEFINE(HAVE_DECL_GETOPT, 1, [Have getopt function])) dnl ======================================================================== dnl ltdl dnl ======================================================================== AC_CHECK_LIB(ltdl, lt_dlopen, [LTDL_foo=1]) if test "x${enable_bundled_ltdl}" = "xyes"; then if test $ac_cv_lib_ltdl_lt_dlopen = yes; then AC_MSG_NOTICE([Disabling usage of installed ltdl]) fi ac_cv_lib_ltdl_lt_dlopen=no fi LIBLTDL_DIR="" if test $ac_cv_lib_ltdl_lt_dlopen != yes ; then AC_MSG_NOTICE([Installing local ltdl]) LIBLTDL_DIR=libltdl ( cd $srcdir ; $TAR -xvf libltdl.tar ) if test "$?" -ne 0; then AC_MSG_ERROR([$TAR of libltdl.tar in $srcdir failed]) fi AC_CONFIG_SUBDIRS(libltdl) else LIBS="$LIBS -lltdl" AC_MSG_NOTICE([Using installed ltdl]) INCLTDL="" LIBLTDL="" fi AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) AC_SUBST(LIBLTDL_DIR) dnl ======================================================================== dnl bzip2 dnl ======================================================================== AC_CHECK_HEADERS(bzlib.h) AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress) if test x$ac_cv_lib_bz2_BZ2_bzBuffToBuffCompress != xyes ; then AC_MSG_ERROR(BZ2 libraries not found) fi if test x$ac_cv_header_bzlib_h != xyes; then AC_MSG_ERROR(BZ2 Development headers not found) fi dnl ======================================================================== dnl ncurses dnl ======================================================================== dnl dnl A few OSes (e.g. Linux) deliver a default "ncurses" alongside "curses". dnl Many non-Linux deliver "curses"; sites may add "ncurses". dnl dnl However, the source-code recommendation for both is to #include "curses.h" dnl (i.e. "ncurses" still wants the include to be simple, no-'n', "curses.h"). dnl dnl ncurse takes precedence. dnl AC_CHECK_HEADERS(curses.h) AC_CHECK_HEADERS(curses/curses.h) AC_CHECK_HEADERS(ncurses.h) AC_CHECK_HEADERS(ncurses/ncurses.h) dnl Although n-library is preferred, only look for it if the n-header was found. CURSESLIBS='' if test "$ac_cv_header_ncurses_h" = "yes"; then AC_CHECK_LIB(ncurses, printw, [CURSESLIBS='-lncurses'; AC_DEFINE(HAVE_LIBNCURSES,1, have ncurses library)] ) fi if test "$ac_cv_header_ncurses_ncurses_h" = "yes"; then AC_CHECK_LIB(ncurses, printw, [CURSESLIBS='-lncurses'; AC_DEFINE(HAVE_LIBNCURSES,1, have ncurses library)] ) fi dnl Only look for non-n-library if there was no n-library. if test X"$CURSESLIBS" = X"" -a "$ac_cv_header_curses_h" = "yes"; then AC_CHECK_LIB(curses, printw, [CURSESLIBS='-lcurses'; AC_DEFINE(HAVE_LIBCURSES,1, have curses library)] ) fi dnl Only look for non-n-library if there was no n-library. if test X"$CURSESLIBS" = X"" -a "$ac_cv_header_curses_curses_h" = "yes"; then AC_CHECK_LIB(curses, printw, [CURSESLIBS='-lcurses'; AC_DEFINE(HAVE_LIBCURSES,1, have curses library)] ) fi if test "x$CURSESLIBS" != "x"; then PKG_FEATURES="$PKG_FEATURES ncurses" fi dnl Check for printw() prototype compatibility if test X"$CURSESLIBS" != X"" && cc_supports_flag -Wcast-qual && cc_supports_flag -Werror; then AC_MSG_CHECKING(whether printw() requires argument of "const char *") ac_save_LIBS=$LIBS LIBS="$CURSESLIBS $LIBS" ac_save_CFLAGS=$CFLAGS CFLAGS="-Wcast-qual -Werror" AC_LINK_IFELSE( [AC_LANG_PROGRAM( [ #if defined(HAVE_CURSES_H) # include #elif defined(HAVE_NCURSES_H) # include #endif ], [printw((const char *)"Test");] )], [ac_cv_compatible_printw=yes], [ac_cv_compatible_printw=no] ) LIBS=$ac_save_LIBS CFLAGS=$ac_save_CFLAGS AC_MSG_RESULT([$ac_cv_compatible_printw]) if test "$ac_cv_compatible_printw" = no; then AC_MSG_WARN([The printw() function of your ncurses or curses library is old, we will disable usage of the library. If you want to use this library anyway, please update to newer version of the library, ncurses 5.4 or later is recommended. You can get the library from http://www.gnu.org/software/ncurses/.]) AC_MSG_NOTICE([Disabling curses]) AC_DEFINE(HAVE_INCOMPATIBLE_PRINTW, 1, [Do we have incompatible printw() in curses library?]) fi fi AC_SUBST(CURSESLIBS) dnl ======================================================================== dnl Cluster infrastructure - Heartbeat dnl ======================================================================== dnl On Debian, AC_CHECK_LIBS fail if a library has any unresolved symbols dnl So check for all the depenancies (so they're added to LIBS) before checking for -lplumb AC_CHECK_LIB(pils, PILLoadPlugin) AC_CHECK_LIB(plumb, G_main_add_IPC_Channel) if test x"$ac_cv_lib_plumb_G_main_add_IPC_Channel" != x"yes"; then AC_MSG_FAILURE(Core Heartbeat utility libraries not found: $ac_cv_lib_plumb_G_main_add_IPC_Channel) fi dnl Compatability checks AC_CHECK_FUNCS(msgfromIPC_timeout) AC_CHECK_MEMBERS([struct lrm_ops.fail_rsc],,,[[#include ]]) dnl ======================================================================== dnl Cluster stack - Heartbeat dnl ======================================================================== case $SUPPORT_HEARTBEAT in 1|yes|true) AC_CHECK_LIB(hbclient, ll_cluster_new, [SUPPORT_HEARTBEAT=1], [AC_MSG_FAILURE(Unable to support Heartbeat: client libraries not found)]);; try) AC_CHECK_LIB(hbclient, ll_cluster_new, [SUPPORT_HEARTBEAT=1], [SUPPORT_HEARTBEAT=0]);; *) SUPPORT_HEARTBEAT=0;; esac AM_CONDITIONAL(BUILD_HEARTBEAT_SUPPORT, test $SUPPORT_HEARTBEAT = 1) AC_DEFINE_UNQUOTED(SUPPORT_HEARTBEAT, $SUPPORT_HEARTBEAT, Support the Heartbeat messaging and membership layer) dnl ======================================================================== dnl Cluster stack - OpenAIS dnl ======================================================================== AISLIB="" dnl Normalize the values case $SUPPORT_AIS in 1|yes|true) missingisfatal=1;; try) missingisfatal=0;; *) SUPPORT_AIS=no;; esac AC_MSG_CHECKING(for native AIS) AISMSGLIB="" AIS_VERSION="none" COROSYNC_PKG="$PKGCONFIG libcoroipcc" if test $SUPPORT_AIS = no; then AC_MSG_RESULT(no... not requested.) else AC_MSG_RESULT($SUPPORT_AIS, with '$AISPREFIX') AC_CHECK_HEADERS(openais/saAis.h) AC_CHECK_HEADERS(corosync/coroipcc.h) $COROSYNC_PKG --exists if test $? = 0; then AIS_VERSION="corosync" elif test "$ac_cv_header_openais_saAis_h" = "yes"; then AIS_VERSION="whitetank" else aisreason="Whitetank headers not found" fi fi if test $AIS_VERSION != "none"; then AC_MSG_CHECKING(for OpenAIS branch) AC_MSG_RESULT($AIS_VERSION) fi if test $AIS_VERSION = "corosync"; then if test "$ac_cv_header_corosync_coroipcc_h" != "yes"; then AIS_VERSION="none" aisreason="Corosync headers not found" fi saveLIBS="$LIBS" LIBS="$LIBS `$COROSYNC_PKG --libs-only-L`" AC_CHECK_LIB(coroipcc, coroipcc_msg_send_reply_receive, []) LIBS="$saveLIBS" if test $ac_cv_lib_coroipcc_coroipcc_msg_send_reply_receive != yes; then AC_MSG_RESULT(Cannot locate AIS messaging library) aisreason="requred Corosync libraries not found" AIS_VERSION="none" fi fi dnl continue? if test $AIS_VERSION = "whitetank"; then dnl Find it in lib, lib64, or wherever it wants to live... AC_MSG_CHECKING(location of OpenAIS libraries) dnl CoroSync location alib=`ls ${AISPREFIX}/*/libcpg.so | head -n 1` if test -z "$alib"; then dnl Whitetank location alib=`ls ${AISPREFIX}/*/*/libcpg.so | head -n 1` fi AISLIB=`dirname $alib` AC_MSG_RESULT($AISLIB) if test "x$AISLIB" = "x"; then AC_MSG_WARN(Use --with-ais-prefix to specify the prefix OpenAIS was installed with) aisreason="library directory not found" AIS_VERSION="none" elif test ! -d "$AISLIB"; then AC_MSG_WARN(Use --with-ais-prefix to specify the prefix OpenAIS was installed with) aisreason="specified library directory does not exist" AIS_VERSION="none" fi fi dnl continue? if test $AIS_VERSION = "whitetank"; then AC_MSG_CHECKING(location of OpenAIS plugins) if test -z "$LCRSODIR"; then LCRSODIR="$libexecdir/lcrso" alib=`ls ${AISPREFIX}/*/lcrso/objdb.lcrso | head -n 1` LCRSODIR=`dirname $alib` fi AC_MSG_RESULT($LCRSODIR) if test "x$LCRSODIR" = "x"; then AC_MSG_RESULT(Invalid. Please specify the correct location with --with-lcrso-dir) aisreason="plugin directory not found" AIS_VERSION="none" elif test ! -d "$LCRSODIR"; then AC_MSG_RESULT(Invalid. Please specify the correct location with --with-lcrso-dir) aisreason="specified plugin directory does not exist" AIS_VERSION="none" fi fi dnl continue? if test $AIS_VERSION = "whitetank"; then dnl Don't add the messaging library to LIBS since most daemons don't need/use it saveLIBS="$LIBS" LIBS="$LIBS -L${AISLIB} -R${AISLIB}" AC_CHECK_LIB(SaMsg, saSendReceiveReply, []) AC_CHECK_LIB(SaMsg, openais_msg_send_reply_receive, []) if test $ac_cv_lib_SaMsg_openais_msg_send_reply_receive = yes; then : OpenAIS elif test $ac_cv_lib_SaMsg_saSendReceiveReply = yes; then : OpenAIS AC_DEFINE_UNQUOTED(TRADITIONAL_AIS_IPC, 1, "Use the 'old' AIS IPC interface") else AC_MSG_RESULT(Cannot locate AIS messaging library) aisreason="requred libraries not found" AIS_VERSION="none" fi LIBS="$saveLIBS" fi SUPPORT_AIS=1 case $AIS_VERSION in corosync) AC_DEFINE_UNQUOTED(AIS_COROSYNC, 1, "AIS target is the corosync series") LCRSODIR=`$PKGCONFIG corosync --variable=lcrsodir` CFLAGS="$CFLAGS `$COROSYNC_PKG --cflags`" AISMSGLIB=`$COROSYNC_PKG --libs` ;; whitetank) AC_DEFINE_UNQUOTED(AIS_WHITETANK, 1, "AIS target is the whitetank series") CFLAGS="$CFLAGS -I$AISPREFIX/include/openais" AISMSGLIB="-L${AISLIB} -R${AISLIB} -lSaMsg" ;; none) SUPPORT_AIS=0 if test "x$aisreason" != x; then if test $missingisfatal = 0; then AC_MSG_WARN(Unable to support OpenAIS: $aisreason) else AC_MSG_FAILURE(Unable to support OpenAIS: $aisreason) fi fi ;; *) AC_MSG_FAILURE(Unknown OpenAIS branch: $AIS_VERSION);; esac AC_DEFINE_UNQUOTED(SUPPORT_AIS, $SUPPORT_AIS, Support the OpenAIS messaging and membership layer) AM_CONDITIONAL(BUILD_AIS_SUPPORT, test $SUPPORT_AIS = 1) dnl dnl Cluster stack - Sanity dnl STACKS="" CLUSTERLIBS="" if test $SUPPORT_HEARTBEAT = 1; then STACKS="$STACKS heartbeat" CLUSTERLIBS="$CLUSTERLIBS -lhbclient -lccmclient" fi if test $SUPPORT_AIS = 1; then STACKS="$STACKS $AIS_VERSION" CLUSTERLIBS="$CLUSTERLIBS ${AISMSGLIB}" else AISPREFIX="" LCRSODIR="$libdir" fi PKG_FEATURES="$PKG_FEATURES$STACKS" AC_MSG_CHECKING(for supported stacks) if test x"$STACKS" = x; then AC_MSG_FAILURE(You must choose at least one cluster stack to support) fi AC_MSG_RESULT($STACKS) AC_SUBST(CLUSTERLIBS) AC_SUBST(LCRSODIR) dnl ======================================================================== dnl SNMP dnl ======================================================================== case $SUPPORT_SNMP in 1|yes|true) missingisfatal=1;; try) missingisfatal=0;; *) SUPPORT_SNMP=no;; esac SNMPLIB="" AC_MSG_CHECKING(for snmp support) if test $SUPPORT_SNMP = no; then AC_MSG_RESULT(no... not requested.) SUPPORT_SNMP=0 else SNMPCONFIG="" AC_MSG_RESULT($SUPPORT_SNMP) AC_CHECK_HEADERS(net-snmp/net-snmp-config.h) if test "x${ac_cv_header_net_snmp_net_snmp_config_h}" != "xyes"; then SUPPORT_SNMP="no" fi if test $SUPPORT_SNMP != no; then AC_PATH_PROGS(SNMPCONFIG, net-snmp-config) if test "X${SNMPCONFIG}" = "X"; then AC_MSG_RESULT(You need the net_snmp development package to continue.) SUPPORT_SNMP=no fi fi if test $SUPPORT_SNMP != no; then AC_MSG_CHECKING(for special snmp libraries) SNMPLIBS=`$SNMPCONFIG --agent-libs` AC_MSG_RESULT($SNMPLIBS) fi if test $SUPPORT_SNMP != no; then savedLibs=$LIBS LIBS="$LIBS $SNMPLIBS" AC_CHECK_FUNCS(netsnmp_transport_open_client) if test $ac_cv_func_netsnmp_transport_open_client != yes; then SUPPORT_SNMP=no fi LIBS=$savedLibs fi if test $SUPPORT_SNMP = no; then SUPPORT_SNMP=0 if test $missingisfatal = 0; then AC_MSG_WARN(Unable to support SNMP) else AC_MSG_FAILURE(Unable to support SNMP) fi else SUPPORT_SNMP=1 fi fi if test $SUPPORT_SNMP = 1; then PKG_FEATURES="$PKG_FEATURES snmp" fi AC_SUBST(SNMPLIBS) AM_CONDITIONAL(ENABLE_SNMP, test "$SUPPORT_SNMP" = "1") AC_DEFINE_UNQUOTED(ENABLE_SNMP, $SUPPORT_SNMP, Build in support for sending SNMP traps) dnl ======================================================================== dnl ESMTP dnl ======================================================================== case $SUPPORT_ESMTP in 1|yes|true) missingisfatal=1;; try) missingisfatal=0;; *) SUPPORT_ESMTP=no;; esac ESMTPLIB="" AC_MSG_CHECKING(for esmtp support) if test $SUPPORT_ESMTP = no; then AC_MSG_RESULT(no... not requested.) SUPPORT_ESMTP=0 else ESMTPCONFIG="" AC_MSG_RESULT($SUPPORT_ESMTP) AC_CHECK_HEADERS(libesmtp.h) if test "x${ac_cv_header_libesmtp_h}" != "xyes"; then ENABLE_ESMTP="no" fi if test $SUPPORT_ESMTP != no; then AC_PATH_PROGS(ESMTPCONFIG, libesmtp-config) if test "X${ESMTPCONFIG}" = "X"; then AC_MSG_RESULT(You need the libesmtp development package to continue.) SUPPORT_ESMTP=no fi fi if test $SUPPORT_ESMTP != no; then AC_MSG_CHECKING(for special esmtp libraries) ESMTPLIBS=`$ESMTPCONFIG --libs | tr '\n' ' '` AC_MSG_RESULT($ESMTPLIBS) fi if test $SUPPORT_ESMTP = no; then SUPPORT_ESMTP=0 if test $missingisfatal = 0; then AC_MSG_WARN(Unable to support ESMTP) else AC_MSG_FAILURE(Unable to support ESMTP) fi else SUPPORT_ESMTP=1 fi fi if test $SUPPORT_ESMTP = 1; then PKG_FEATURES="$PKG_FEATURES libesmtp" fi AC_SUBST(ESMTPLIBS) AM_CONDITIONAL(ENABLE_ESMTP, test "$SUPPORT_ESMTP" = "1") AC_DEFINE_UNQUOTED(ENABLE_ESMTP, $SUPPORT_ESMTP, Build in support for sending mail notifications with ESMTP) dnl ======================================================================== dnl GnuTLS dnl ======================================================================== AC_CHECK_HEADERS(gnutls/gnutls.h) AC_CHECK_HEADERS(security/pam_appl.h pam/pam_appl.h) dnl GNUTLS library: Attempt to determine by 'libgnutls-config' program. dnl If no 'libgnutls-config', try traditional autoconf means. AC_PATH_PROGS(LIBGNUTLS_CONFIG, libgnutls-config) if test -n "$LIBGNUTLS_CONFIG"; then AC_MSG_CHECKING(for gnutls header flags) GNUTLSHEAD="`$LIBGNUTLS_CONFIG --cflags`"; AC_MSG_RESULT($GNUTLSHEAD) AC_MSG_CHECKING(for gnutls library flags) GNUTLSLIBS="`$LIBGNUTLS_CONFIG --libs`"; AC_MSG_RESULT($GNUTLSLIBS) else AC_CHECK_LIB(gnutls, gnutls_init) fi AC_SUBST(GNUTLSHEAD) AC_SUBST(GNUTLSLIBS) dnl ======================================================================== dnl checks for library functions to replace them dnl dnl NoSuchFunctionName: dnl is a dummy function which no system supplies. It is here to make dnl the system compile semi-correctly on OpenBSD which doesn't know dnl how to create an empty archive dnl dnl scandir: Only on BSD. dnl System-V systems may have it, but hidden and/or deprecated. dnl A replacement function is supplied for it. dnl dnl setenv: is some bsdish function that should also be avoided (use dnl putenv instead) dnl On the other hand, putenv doesn't provide the right API for the dnl code and has memory leaks designed in (sigh...) Fortunately this dnl A replacement function is supplied for it. dnl dnl strerror: returns a string that corresponds to an errno. dnl A replacement function is supplied for it. dnl dnl unsetenv: is some bsdish function that should also be avoided (No dnl replacement) dnl A replacement function is supplied for it. dnl dnl strnlen: is a gnu function similar to strlen, but safer. dnl We wrote a tolearably-fast replacement function for it. dnl dnl strndup: is a gnu function similar to strdup, but safer. dnl We wrote a tolearably-fast replacement function for it. dnl dnl daemon: is a GNU function. The daemon() function is for programs wishing to dnl detach themselves from the controlling terminal and run in the dnl background as system daemon dnl A replacement function is supplied for it. AC_REPLACE_FUNCS(alphasort inet_pton NoSuchFunctionName scandir setenv strerror unsetenv strnlen strndup daemon strlcpy strlcat) dnl ======================================================================== dnl Compiler flags dnl ======================================================================== dnl Make sure that CFLAGS is not exported. If the user did dnl not have CFLAGS in their environment then this should have dnl no effect. However if CFLAGS was exported from the user's dnl environment, then the new CFLAGS will also be exported dnl to sub processes. CC_ERRORS="" CC_EXTRAS="" if export | fgrep " CFLAGS=" > /dev/null; then export -n CFLAGS || true # We don't want to bomb out if this fails fi if test "$GCC" != yes; then CFLAGS="$CFLAGS -g" enable_fatal_warnings=no else CFLAGS="$CFLAGS -ggdb3 -O0" # We had to eliminate -Wnested-externs because of libtool changes EXTRA_FLAGS="-fgnu89-inline -fstack-protector-all -Wall -Waggregate-return -Wbad-function-cast -Wcast-qual -Wcast-align -Wdeclaration-after-statement -Wendif-labels -Wfloat-equal -Wformat=2 -Wformat-security -Wformat-nonliteral -Winline -Wmissing-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wnested-externs -Wno-long-long -Wno-strict-aliasing -Wpointer-arith -Wstrict-prototypes -Wunsigned-char -Wwrite-strings" # Additional warnings it might be nice to enable one day # -Wshadow # -Wunreachable-code for j in $EXTRA_FLAGS do if cc_supports_flag $j then CC_EXTRAS="$CC_EXTRAS $j" fi done dnl In lib/ais/Makefile.am there's a gcc option available as of v4.x GCC_MAJOR=`gcc -v 2>&1 | awk 'END{print $3}' | sed 's/[.].*//'` AM_CONDITIONAL(GCC_4, test "${GCC_MAJOR}" = 4) dnl System specific options case "$host_os" in *linux*|*bsd*) if test "${enable_fatal_warnings}" = "unknown"; then enable_fatal_warnings=yes fi ;; esac if test "x${enable_fatal_warnings}" != xno && cc_supports_flag -Werror ; then enable_fatal_warnings=yes else enable_fatal_warnings=no fi if test "x${enable_ansi}" != xno && cc_supports_flag -std=iso9899:199409 ; then AC_MSG_NOTICE(Enabling ANSI Compatibility) CC_EXTRAS="$CC_EXTRAS -ansi -D_GNU_SOURCE -DANSI_ONLY" fi AC_MSG_NOTICE(Activated additional gcc flags: ${CC_EXTRAS}) fi CFLAGS="$CFLAGS $CC_EXTRAS" NON_FATAL_CFLAGS="$CFLAGS" AC_SUBST(NON_FATAL_CFLAGS) dnl dnl We reset CFLAGS to include our warnings *after* all function dnl checking goes on, so that our warning flags don't keep the dnl AC_*FUNCS() calls above from working. In particular, -Werror will dnl *always* cause us troubles if we set it before here. dnl dnl if test "x${enable_fatal_warnings}" = xyes ; then AC_MSG_NOTICE(Enabling Fatal Warnings) CFLAGS="$CFLAGS -Werror" fi AC_SUBST(CFLAGS) dnl This is useful for use in Makefiles that need to remove one specific flag CFLAGS_COPY="$CFLAGS" AC_SUBST(CFLAGS_COPY) AC_SUBST(LIBADD_DL) dnl extra flags for dynamic linking libraries AC_SUBST(LIBADD_INTL) dnl extra flags for GNU gettext stuff... AC_SUBST(LOCALE) dnl Options for cleaning up the compiler output PRETTY_CC="" QUIET_LIBTOOL_OPTS="" QUIET_MAKE_OPTS="" if test x"${enable_pretty}" = "xyes"; then enable_quiet="yes" echo "install_sh: ${install_sh}" PRETTY_CC="`pwd`/tools/ccdv" dnl It would be nice if this was rebuilt when needed too... mkdir `pwd`/tools/ 2>/dev/null ${CC} $CFLAGS -o `pwd`/tools/ccdv ${srcdir}/tools/ccdv.c CC="\$(PRETTY_CC) ${CC}" fi if test "x${enable_quiet}" = "xyes"; then QUIET_LIBTOOL_OPTS="--quiet" QUIET_MAKE_OPTS="--quiet" fi AC_MSG_RESULT(Supress make details: ${enable_quiet}) AC_MSG_RESULT(Pretty print compiler output: ${enable_pretty}) dnl Put the above variables to use LIBTOOL="${LIBTOOL} --tag=CC \$(QUIET_LIBTOOL_OPTS)" MAKE="${MAKE} \$(QUIET_MAKE_OPTS)" AC_SUBST(CC) AC_SUBST(MAKE) AC_SUBST(LIBTOOL) AC_SUBST(PRETTY_CC) AC_SUBST(QUIET_MAKE_OPTS) AC_SUBST(QUIET_LIBTOOL_OPTS) +dnl Check if servicelog development package is installed +SERVICELOG=servicelog-1 +if + $PKGCONFIG --exists $SERVICELOG +then + SERVICELOG_EXISTS="yes" + AC_MSG_RESULT($SERVICELOG found) +else + SERVICELOG_EXISTS="no" +fi +AM_CONDITIONAL(BUILD_SERVICELOG, test $SERVICELOG_EXISTS = "yes") + +dnl Check if OpenIMPI packages and servicelog are installed +OPENIPMI=OpenIPMI OpenIPMIposix +if + $PKGCONFIG --exists $OPENIPMI $SERVICELOG +then + OPENIPMI_SERICELOG_EXISTS="yes" + AC_MSG_RESULT($OPENIPMI $SERVICELOG found) +else + OPENIPMI_SERVICELOG_EXISTS="no" +fi +AM_CONDITIONAL(BUILD_OPENIPMI_SERICELOG, test $OPENIPMI_SERICELOG_EXISTS = "yes") + dnl The Makefiles and shell scripts we output AC_CONFIG_FILES(Makefile \ README \ cts/Makefile \ cts/CTSvars.py \ cts/LSBDummy \ cib/Makefile \ crmd/Makefile \ pengine/Makefile \ debian/Makefile \ doc/Makefile \ doc/cibadmin.8 \ doc/crm_resource.8 \ include/Makefile \ include/crm/Makefile \ include/crm/common/Makefile \ include/crm/pengine/Makefile \ include/fencing/Makefile \ replace/Makefile \ lib/Makefile \ lib/ais/Makefile \ lib/common/Makefile \ lib/cib/Makefile \ lib/pengine/Makefile \ lib/transition/Makefile \ lib/fencing/Makefile \ lib/plugins/Makefile \ lib/plugins/lrm/Makefile \ fencing/Makefile \ fencing/stonithd/Makefile \ fencing/test/Makefile \ fencing/test/STONITHDBasicSanityCheck \ extra/Makefile \ extra/resources/Makefile \ tools/Makefile \ tools/haresources2cib.py \ tools/hb2openais.sh \ tools/crm_primitive.py \ tools/crm \ tools/shell/Makefile \ tools/shell/templates/Makefile \ tools/shell/regression/Makefile \ tools/shell/regression/regression.sh \ tools/shell/regression/lrmregtest-lsb \ tools/shell/regression/testcases/Makefile \ xml/Makefile \ xml/pacemaker.rng \ xml/resources.rng \ xml/constraints.rng \ xml/rule.rng \ xml/nvset.rng \ ) dnl Now process the entire list of files added by previous dnl calls to AC_CONFIG_FILES() AC_OUTPUT() dnl ***************** dnl Configure summary dnl ***************** AC_MSG_RESULT([]) AC_MSG_RESULT([$PACKAGE configuration:]) AC_MSG_RESULT([ Version = ${VERSION} (Build: $BUILD_VERSION)]) AC_MSG_RESULT([ Features =${PKG_FEATURES}]) AC_MSG_RESULT([]) AC_MSG_RESULT([ Prefix = ${prefix}]) AC_MSG_RESULT([ Executables = ${sbindir}]) AC_MSG_RESULT([ Man pages = ${mandir}]) AC_MSG_RESULT([ Libraries = ${libdir}]) AC_MSG_RESULT([ Header files = ${includedir}]) AC_MSG_RESULT([ Arch-independent files = ${datadir}]) AC_MSG_RESULT([ State information = ${localstatedir}]) AC_MSG_RESULT([ System configuration = ${sysconfdir}]) AC_MSG_RESULT([ AIS Plugins = ${LCRSODIR}]) AC_MSG_RESULT([]) AC_MSG_RESULT([ Use system LTDL = ${ac_cv_lib_ltdl_lt_dlopen}]) AC_MSG_RESULT([]) AC_MSG_RESULT([ HA group name = ${CRM_DAEMON_GROUP}]) AC_MSG_RESULT([ HA user name = ${CRM_DAEMON_USER}]) AC_MSG_RESULT([]) AC_MSG_RESULT([ CFLAGS = ${CFLAGS}]) AC_MSG_RESULT([ Libraries = ${LIBS}]) AC_MSG_RESULT([ Stack Libraries = ${CLUSTERLIBS}]) diff --git a/extra/resources/Makefile.am b/extra/resources/Makefile.am index 0f54e89890..9de37cbc09 100644 --- a/extra/resources/Makefile.am +++ b/extra/resources/Makefile.am @@ -1,31 +1,32 @@ # Makefile.am for OCF RAs # # Author: Andrew Beekhof # Copyright (C) 2008 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 EXTRA_DIST = $(ocf_SCRIPTS) ocfdir = @OCF_RA_DIR@/pacemaker ocf_SCRIPTS = ClusterMon \ Dummy \ Stateful \ SysInfo \ pingd \ - controld + controld \ + SystemHealth diff --git a/extra/resources/SystemHealth b/extra/resources/SystemHealth new file mode 100644 index 0000000000..94386db82c --- /dev/null +++ b/extra/resources/SystemHealth @@ -0,0 +1,236 @@ +#!/bin/sh +# +# SystemHealth OCF RA. +# +# Copyright (c) 2009 International Business Machines (IBM), Mark Hamzy +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. +# + +####################################################################### +# Initialization: + +. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs + +####################################################################### + +meta_data() { + cat < + + +0.1 + + +This is a SystemHealth Resource Agent. It is used to monitor +the health of a system via IPMI. + +SystemHealth resource agent + + + + + + + + + + + + + +END +} + +####################################################################### + +SystemHealth_usage() { + cat < /dev/null 2>&1 + RC=$? + + if [ $RC != 0 ]; then + ocf_log err "servicelog_notify not found!" + return $RC + fi + + which ipmiservicelogd > /dev/null 2>&1 + RC=$? + + if [ $RC != 0 ]; then + ocf_log err "ipmiservicelogd not found!" + return $RC + fi +} + +SystemHealth_start() { + SystemHealth_monitor + RC=$? + + if [ $RC = $OCF_ERR_GENERIC ]; then + return $OCF_ERR_GENERIC + elif [ $RC = $OCF_SUCCESS ]; then + ocf_log warn "starting an already started SystemHealth" + return $OCF_SUCCESS + fi + + service ipmi start > /dev/null 2>&1 + RC=$? + + if [ $RC != 0 ]; then + ocf_log err "Could not start service IPMI!" + return $OCF_ERR_GENERIC + fi + + ipmiservicelogd smi 0 > /dev/null 2>&1 & + RC=$? + + if [ $RC != 0 ]; then + ocf_log err "Could not start ipmiservicelogd!" + return $OCF_ERR_GENERIC + fi + + servicelog_notify --add --type=EVENT --command="$OCF_RESKEY_program" --method=num_arg --match='type=4' > /dev/null 2>&1 + RC=$? + + if [ $RC != 0 ]; then + ocf_log err "servicelog_notify register handler failed!" + return $OCF_ERR_GENERIC + fi + + return $OCF_SUCCESS +} + +SystemHealth_stop() { + SystemHealth_monitor + RC=$? + + if [ $RC = $OCF_ERR_GENERIC ]; then + return $OCF_ERR_GENERIC + elif [ $RC = $OCF_SUCCESS ]; then + killall ipmiservicelogd + RC1=$? + + if [ $RC1 != 0 ]; then + ocf_log err "Could not stop ipmiservicelogd!" + fi + + servicelog_notify --remove --command="$OCF_RESKEY_program" > /dev/null 2>&1 + RC2=$? + + if [ $RC2 != 0 ]; then + ocf_log err "servicelog_notify remove handler failed!" + fi + + if [ $RC1 = 0 -a $RC2 = 0 ]; then + return $OCF_SUCCESS + else + return $OCF_ERR_GENERIC + fi + elif [ $RC = $OCF_NOT_RUNNING ]; then + ocf_log warn "stopping an already stopped SystemHealth" + return $OCF_SUCCESS + else + ocf_log err "SystemHealth_stop: should not be here!" + return $OCF_ERR_GENERIC + fi +} + +SystemHealth_monitor() { + # Monitor _MUST!_ differentiate correctly between running + # (SUCCESS), failed (ERROR) or _cleanly_ stopped (NOT RUNNING). + # That is THREE states, not just yes/no. + + SystemHealth_check_tools + RC=$? + + if [ $RC != 0 ]; then + return $OCF_ERR_GENERIC + fi + + if [ ! -f /var/run/ipmiservicelogd.pid0 ]; then + ocf_log debug "ipmiservicelogd is not running!" + return $OCF_NOT_RUNNING + fi + + ps -p `cat /var/run/ipmiservicelogd.pid0` > /dev/null 2>&1 + RC=$? + + if [ $RC != 0 ]; then + ocf_log debug "ipmiservicelogd's pid `cat /var/run/ipmiservicelogd.pid0` is not running!" + + rm /var/run/ipmiservicelogd.pid0 + + return $OCF_ERR_GENERIC + fi + + servicelog_notify --list --command="$OCF_RESKEY_program" > /dev/null 2>&1 + RC=$? + + if [ $RC = 0 ]; then + return $OCF_SUCCESS + else + return $OCF_NOT_RUNNING + fi +} + +SystemHealth_validate() { + + SystemHealth_check_tools + RC=$? + + if [ $RC != 0 ]; then + return $OCF_ERR_ARGS + fi + + return $OCF_SUCCESS +} + +: ${OCF_RESKEY_program=/usr/sbin/notifyServicelogEvent} + +case $__OCF_ACTION in +meta-data) meta_data + exit $OCF_SUCCESS + ;; +start) SystemHealth_start;; +stop) SystemHealth_stop;; +monitor) SystemHealth_monitor;; +reload) ocf_log err "Reloading..." + SystemHealth_start + ;; +validate-all) SystemHealth_validate;; +usage|help) SystemHealth_usage + exit $OCF_SUCCESS + ;; +*) SystemHealth_usage + exit $OCF_ERR_UNIMPLEMENTED + ;; +esac +rc=$? +ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" +exit $rc diff --git a/pengine/regression.sh b/pengine/regression.sh index ffed40d26d..914fb25e28 100755 --- a/pengine/regression.sh +++ b/pengine/regression.sh @@ -1,299 +1,316 @@ #!/bin/bash # 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.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 # if [ -x /usr/bin/valgrind ]; then export G_SLICE=always-malloc VALGRIND_CMD="valgrind -q --show-reachable=no --leak-check=full --trace-children=no --time-stamp=yes --num-callers=20 --suppressions=./ptest.supp" fi . regression.core.sh create_mode="true" echo Generating test outputs for these tests... # do_test echo Done. echo "" echo Performing the following tests... create_mode="false" echo "" do_test simple1 "Offline " do_test simple2 "Start " do_test simple3 "Start 2 " do_test simple4 "Start Failed" do_test simple6 "Stop Start " do_test simple7 "Shutdown " #do_test simple8 "Stonith " #do_test simple9 "Lower version" #do_test simple10 "Higher version" do_test simple11 "Priority (ne)" do_test simple12 "Priority (eq)" do_test simple8 "Stickiness" echo "" do_test params-0 "Params: No change" do_test params-1 "Params: Changed" do_test params-2 "Params: Resource definition" do_test params-4 "Params: Reload" do_test novell-251689 "Resource definition change + target_role=stopped" echo "" do_test orphan-0 "Orphan ignore" do_test orphan-1 "Orphan stop" echo "" do_test target-0 "Target Role : baseline" do_test target-1 "Target Role : test" echo "" do_test date-1 "Dates" -d "2005-020" do_test date-2 "Date Spec - Pass" -d "2005-020T12:30" do_test date-3 "Date Spec - Fail" -d "2005-020T11:30" do_test probe-0 "Probe (anon clone)" do_test probe-1 "Pending Probe" do_test probe-2 "Correctly re-probe cloned groups" do_test standby "Standby" do_test comments "Comments" echo "" do_test rsc_dep1 "Must not " do_test rsc_dep3 "Must " do_test rsc_dep5 "Must not 3 " do_test rsc_dep7 "Must 3 " do_test rsc_dep10 "Must (but cant)" do_test rsc_dep2 "Must (running) " do_test rsc_dep8 "Must (running : alt) " do_test rsc_dep4 "Must (running + move)" do_test asymmetric "Asymmetric - require explicit location constraints" echo "" do_test order1 "Order start 1 " do_test order2 "Order start 2 " do_test order3 "Order stop " do_test order4 "Order (multiple) " do_test order5 "Order (move) " do_test order6 "Order (move w/ restart) " do_test order7 "Order (manditory) " do_test order-optional "Order (score=0) " do_test order-required "Order (score=INFINITY) " echo "" do_test coloc-loop "Colocation - loop" do_test coloc-many-one "Colocation - many-to-one" do_test coloc-list "Colocation - many-to-one with list" do_test coloc-group "Colocation - groups" do_test coloc-slave-anti "Anti-colocation with slave shouldn't prevent master colocation" do_test coloc-attr "Colocation based on node attributes" #echo "" #do_test agent1 "version: lt (empty)" #do_test agent2 "version: eq " #do_test agent3 "version: gt " echo "" do_test attrs1 "string: eq (and) " do_test attrs2 "string: lt / gt (and)" do_test attrs3 "string: ne (or) " do_test attrs4 "string: exists " do_test attrs5 "string: not_exists " do_test attrs6 "is_dc: true " do_test attrs7 "is_dc: false " do_test attrs8 "score_attribute " echo "" do_test mon-rsc-1 "Schedule Monitor - start" do_test mon-rsc-2 "Schedule Monitor - move " do_test mon-rsc-3 "Schedule Monitor - pending start " do_test mon-rsc-4 "Schedule Monitor - move/pending start" echo "" do_test rec-rsc-0 "Resource Recover - no start " do_test rec-rsc-1 "Resource Recover - start " do_test rec-rsc-2 "Resource Recover - monitor " do_test rec-rsc-3 "Resource Recover - stop - ignore" do_test rec-rsc-4 "Resource Recover - stop - block " do_test rec-rsc-5 "Resource Recover - stop - fence " do_test rec-rsc-6 "Resource Recover - multiple - restart" do_test rec-rsc-7 "Resource Recover - multiple - stop " do_test rec-rsc-8 "Resource Recover - multiple - block " do_test rec-rsc-9 "Resource Recover - group/group" echo "" do_test quorum-1 "No quorum - ignore" do_test quorum-2 "No quorum - freeze" do_test quorum-3 "No quorum - stop " do_test quorum-4 "No quorum - start anyway" do_test quorum-5 "No quorum - start anyway (group)" do_test quorum-6 "No quorum - start anyway (clone)" echo "" do_test rec-node-1 "Node Recover - Startup - no fence" do_test rec-node-2 "Node Recover - Startup - fence " do_test rec-node-3 "Node Recover - HA down - no fence" do_test rec-node-4 "Node Recover - HA down - fence " do_test rec-node-5 "Node Recover - CRM down - no fence" do_test rec-node-6 "Node Recover - CRM down - fence " do_test rec-node-7 "Node Recover - no quorum - ignore " do_test rec-node-8 "Node Recover - no quorum - freeze " do_test rec-node-9 "Node Recover - no quorum - stop " do_test rec-node-10 "Node Recover - no quorum - stop w/fence" do_test rec-node-11 "Node Recover - CRM down w/ group - fence " do_test rec-node-12 "Node Recover - nothing active - fence " do_test rec-node-13 "Node Recover - failed resource + shutdown - fence " do_test rec-node-15 "Node Recover - unknown lrm section" do_test rec-node-14 "Serialize all stonith's" echo "" do_test multi1 "Multiple Active (stop/start)" echo "" do_test migrate-1 "Migrate (migrate)" do_test migrate-2 "Migrate (stable)" do_test migrate-3 "Migrate (failed migrate_to)" do_test migrate-4 "Migrate (failed migrate_from)" do_test novell-252693 "Migration in a stopping stack" do_test novell-252693-2 "Migration in a starting stack" do_test novell-252693-3 "Non-Migration in a starting and stopping stack" do_test bug-1820 "Migration in a group" do_test bug-1820-1 "Non-migration in a group" #echo "" #do_test complex1 "Complex " echo "" do_test group1 "Group " do_test group2 "Group + Native " do_test group3 "Group + Group " do_test group4 "Group + Native (nothing)" do_test group5 "Group + Native (move) " do_test group6 "Group + Group (move) " do_test group7 "Group colocation" do_test group13 "Group colocation (cant run)" do_test group8 "Group anti-colocation" do_test group9 "Group recovery" do_test group10 "Group partial recovery" do_test group11 "Group target_role" do_test group14 "Group stop (graph terminated)" do_test group15 "-ve group colocation" do_test bug-1573 "Partial stop of a group with two children" do_test bug-1718 "Mandatory group ordering - Stop group_FUN" echo "" do_test clone-anon-probe-1 "Probe the correct (anonymous) clone instance for each node" do_test clone-anon-probe-2 "Avoid needless re-probing of anonymous clones" do_test inc0 "Incarnation start" do_test inc1 "Incarnation start order" do_test inc2 "Incarnation silent restart, stop, move" do_test inc3 "Inter-incarnation ordering, silent restart, stop, move" do_test inc4 "Inter-incarnation ordering, silent restart, stop, move (ordered)" do_test inc5 "Inter-incarnation ordering, silent restart, stop, move (restart 1)" do_test inc6 "Inter-incarnation ordering, silent restart, stop, move (restart 2)" do_test inc7 "Clone colocation" do_test inc8 "Clone anti-colocation" do_test inc9 "Non-unique clone" do_test inc10 "Non-unique clone (stop)" do_test inc11 "Primitive colocation with clones" do_test inc12 "Clone shutdown" do_test cloned-group "Make sure only the correct number of cloned groups are started" do_test clone-no-shuffle "Dont prioritize allocation of instances that must be moved" do_test clone-max-zero "Orphan processing with clone-max=0" do_test clone-anon-dup "Bug LF#2087 - Correctly parse the state of anonymous clones that are active more than once per node" echo "" do_test master-0 "Stopped -> Slave" do_test master-1 "Stopped -> Promote" do_test master-2 "Stopped -> Promote : notify" do_test master-3 "Stopped -> Promote : master location" do_test master-4 "Started -> Promote : master location" do_test master-5 "Promoted -> Promoted" do_test master-6 "Promoted -> Promoted (2)" do_test master-7 "Promoted -> Fenced" do_test master-8 "Promoted -> Fenced -> Moved" do_test master-9 "Stopped + Promotable + No quorum" do_test master-10 "Stopped -> Promotable : notify with monitor" do_test master-11 "Stopped -> Promote : colocation" do_test novell-239082 "Demote/Promote ordering" do_test novell-239087 "Stable master placement" do_test master-12 "Promotion based solely on rsc_location constraints" do_test master-13 "Include preferences of colocated resources when placing master" do_test master-demote "Ordering when actions depends on demoting a slave resource" do_test master-ordering "Prevent resources from starting that need a master" do_test bug-1765 "Master-Master Colocation (dont stop the slaves)" do_test master-group "Promotion of cloned groups" do_test bug-lf-1852 "Don't shuffle master/slave instances unnecessarily" do_test master-failed-demote "Dont retry failed demote actions" do_test master-failed-demote-2 "Dont retry failed demote actions (notify=false)" do_test master-depend "Ensure resources that depend on the master don't get allocated until the master does" do_test master-reattach "Re-attach to a running master" echo "" do_test managed-0 "Managed (reference)" do_test managed-1 "Not managed - down " do_test managed-2 "Not managed - up " echo "" do_test interleave-0 "Interleave (reference)" do_test interleave-1 "coloc - not interleaved" do_test interleave-2 "coloc - interleaved " do_test interleave-3 "coloc - interleaved (2)" do_test interleave-pseudo-stop "Interleaved clone during stonith" do_test interleave-stop "Interleaved clone during stop" do_test interleave-restart "Interleaved clone during dependancy restart" echo "" do_test notify-0 "Notify reference" do_test notify-1 "Notify simple" do_test notify-2 "Notify simple, confirm" do_test notify-3 "Notify move, confirm" do_test novell-239079 "Notification priority" #do_test notify-2 "Notify - 764" echo "" do_test 594 "OSDL #594" do_test 662 "OSDL #662" do_test 696 "OSDL #696" do_test 726 "OSDL #726" do_test 735 "OSDL #735" do_test 764 "OSDL #764" do_test 797 "OSDL #797" do_test 829 "OSDL #829" do_test 994 "OSDL #994" do_test 994-2 "OSDL #994 - with a dependant resource" do_test 1360 "OSDL #1360 - Clone stickiness" do_test 1484 "OSDL #1484 - on_fail=stop" do_test 1494 "OSDL #1494 - Clone stability" do_test unrunnable-1 "Unrunnable" do_test stonith-0 "Stonith loop - 1" do_test stonith-1 "Stonith loop - 2" do_test stonith-2 "Stonith loop - 3" do_test stonith-3 "Stonith startup" do_test bug-1572-1 "Recovery of groups depending on master/slave" do_test bug-1572-2 "Recovery of groups depending on master/slave when the master is never re-promoted" do_test bug-1685 "Depends-on-master ordering" do_test bug-1822 "Dont promote partially active groups" do_test bug-pm-11 "New resource added to a m/s group" do_test bug-pm-12 "Recover only the failed portion of a cloned group" do_test bug-n-387749 "Don't shuffle clone instances" do_test bug-n-385265 "Don't ignore the failure stickiness of group children - resource_idvscommon should stay stopped" do_test bug-n-385265-2 "Ensure groups are migrated instead of remaining partially active on the current node" do_test bug-lf-1920 "Correctly handle probes that find active resources" do_test bnc-515172 "Location constraint with multiple expressions" +echo "" +do_test systemhealth1 "System Health () #1" +do_test systemhealth2 "System Health () #2" +do_test systemhealth3 "System Health () #3" +do_test systemhealthn1 "System Health (None) #1" +do_test systemhealthn2 "System Health (None) #2" +do_test systemhealthn3 "System Health (None) #3" +do_test systemhealthm1 "System Health (Migrate On Red) #1" +do_test systemhealthm2 "System Health (Migrate On Red) #2" +do_test systemhealthm3 "System Health (Migrate On Red) #3" +do_test systemhealtho1 "System Health (Only Green) #1" +do_test systemhealtho2 "System Health (Only Green) #2" +do_test systemhealtho3 "System Health (Only Green) #3" +do_test systemhealthp1 "System Health (Progessive) #1" +do_test systemhealthp2 "System Health (Progessive) #2" +do_test systemhealthp3 "System Health (Progessive) #3" + echo "" test_results diff --git a/pengine/test10/systemhealth1.dot b/pengine/test10/systemhealth1.dot new file mode 100644 index 0000000000..d6a8ceff8a --- /dev/null +++ b/pengine/test10/systemhealth1.dot @@ -0,0 +1,11 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21c" -> "all_stopped" [ style = bold] +"stonith hs21c" [ style=bold color="green" fontcolor="black" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" -> "stonith hs21c" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21c" [ style = bold] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealth1.exp b/pengine/test10/systemhealth1.exp new file mode 100644 index 0000000000..a2ae40c3d5 --- /dev/null +++ b/pengine/test10/systemhealth1.exp @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealth1.scores b/pengine/test10/systemhealth1.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealth1.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealth1.xml b/pengine/test10/systemhealth1.xml new file mode 100644 index 0000000000..9f2fdae0ec --- /dev/null +++ b/pengine/test10/systemhealth1.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealth2.dot b/pengine/test10/systemhealth2.dot new file mode 100644 index 0000000000..80a686d4db --- /dev/null +++ b/pengine/test10/systemhealth2.dot @@ -0,0 +1,24 @@ +digraph "g" { +"all_stopped" -> "apache_1_start_0 hs21c" [ style = bold] +"all_stopped" -> "nfs_1_start_0 hs21c" [ style = bold] +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_monitor_10000 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_start_0 hs21c" -> "apache_1_monitor_10000 hs21c" [ style = bold] +"apache_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_20000 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_start_0 hs21c" -> "nfs_1_monitor_20000 hs21c" [ style = bold] +"nfs_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" -> "apache_1_start_0 hs21c" [ style = bold] +"probe_complete" -> "nfs_1_start_0 hs21c" [ style = bold] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealth2.exp b/pengine/test10/systemhealth2.exp new file mode 100644 index 0000000000..9a226102b5 --- /dev/null +++ b/pengine/test10/systemhealth2.exp @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealth2.scores b/pengine/test10/systemhealth2.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealth2.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealth2.xml b/pengine/test10/systemhealth2.xml new file mode 100644 index 0000000000..39d7237d47 --- /dev/null +++ b/pengine/test10/systemhealth2.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealth3.dot b/pengine/test10/systemhealth3.dot new file mode 100644 index 0000000000..80a686d4db --- /dev/null +++ b/pengine/test10/systemhealth3.dot @@ -0,0 +1,24 @@ +digraph "g" { +"all_stopped" -> "apache_1_start_0 hs21c" [ style = bold] +"all_stopped" -> "nfs_1_start_0 hs21c" [ style = bold] +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_monitor_10000 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_start_0 hs21c" -> "apache_1_monitor_10000 hs21c" [ style = bold] +"apache_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_20000 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_start_0 hs21c" -> "nfs_1_monitor_20000 hs21c" [ style = bold] +"nfs_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" -> "apache_1_start_0 hs21c" [ style = bold] +"probe_complete" -> "nfs_1_start_0 hs21c" [ style = bold] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealth3.exp b/pengine/test10/systemhealth3.exp new file mode 100644 index 0000000000..9a226102b5 --- /dev/null +++ b/pengine/test10/systemhealth3.exp @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealth3.scores b/pengine/test10/systemhealth3.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealth3.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealth3.xml b/pengine/test10/systemhealth3.xml new file mode 100644 index 0000000000..6bf712bc59 --- /dev/null +++ b/pengine/test10/systemhealth3.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthm1.dot b/pengine/test10/systemhealthm1.dot new file mode 100644 index 0000000000..d6a8ceff8a --- /dev/null +++ b/pengine/test10/systemhealthm1.dot @@ -0,0 +1,11 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21c" -> "all_stopped" [ style = bold] +"stonith hs21c" [ style=bold color="green" fontcolor="black" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" -> "stonith hs21c" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21c" [ style = bold] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthm1.exp b/pengine/test10/systemhealthm1.exp new file mode 100644 index 0000000000..a2ae40c3d5 --- /dev/null +++ b/pengine/test10/systemhealthm1.exp @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthm1.scores b/pengine/test10/systemhealthm1.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealthm1.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthm1.xml b/pengine/test10/systemhealthm1.xml new file mode 100644 index 0000000000..04277fefaa --- /dev/null +++ b/pengine/test10/systemhealthm1.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthm2.dot b/pengine/test10/systemhealthm2.dot new file mode 100644 index 0000000000..80a686d4db --- /dev/null +++ b/pengine/test10/systemhealthm2.dot @@ -0,0 +1,24 @@ +digraph "g" { +"all_stopped" -> "apache_1_start_0 hs21c" [ style = bold] +"all_stopped" -> "nfs_1_start_0 hs21c" [ style = bold] +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_monitor_10000 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_start_0 hs21c" -> "apache_1_monitor_10000 hs21c" [ style = bold] +"apache_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_20000 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_start_0 hs21c" -> "nfs_1_monitor_20000 hs21c" [ style = bold] +"nfs_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" -> "apache_1_start_0 hs21c" [ style = bold] +"probe_complete" -> "nfs_1_start_0 hs21c" [ style = bold] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthm2.exp b/pengine/test10/systemhealthm2.exp new file mode 100644 index 0000000000..9a226102b5 --- /dev/null +++ b/pengine/test10/systemhealthm2.exp @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthm2.scores b/pengine/test10/systemhealthm2.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealthm2.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthm2.xml b/pengine/test10/systemhealthm2.xml new file mode 100644 index 0000000000..c758d25838 --- /dev/null +++ b/pengine/test10/systemhealthm2.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthm3.dot b/pengine/test10/systemhealthm3.dot new file mode 100644 index 0000000000..b9426f8d51 --- /dev/null +++ b/pengine/test10/systemhealthm3.dot @@ -0,0 +1,14 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthm3.exp b/pengine/test10/systemhealthm3.exp new file mode 100644 index 0000000000..761bd6e390 --- /dev/null +++ b/pengine/test10/systemhealthm3.exp @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthm3.scores b/pengine/test10/systemhealthm3.scores new file mode 100644 index 0000000000..ef0e9c92b7 --- /dev/null +++ b/pengine/test10/systemhealthm3.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: -1000000 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: -1000000 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthm3.xml b/pengine/test10/systemhealthm3.xml new file mode 100644 index 0000000000..2e496a6f8c --- /dev/null +++ b/pengine/test10/systemhealthm3.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthn1.dot b/pengine/test10/systemhealthn1.dot new file mode 100644 index 0000000000..d6a8ceff8a --- /dev/null +++ b/pengine/test10/systemhealthn1.dot @@ -0,0 +1,11 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21c" -> "all_stopped" [ style = bold] +"stonith hs21c" [ style=bold color="green" fontcolor="black" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" -> "stonith hs21c" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21c" [ style = bold] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthn1.exp b/pengine/test10/systemhealthn1.exp new file mode 100644 index 0000000000..a2ae40c3d5 --- /dev/null +++ b/pengine/test10/systemhealthn1.exp @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthn1.scores b/pengine/test10/systemhealthn1.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealthn1.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthn1.xml b/pengine/test10/systemhealthn1.xml new file mode 100644 index 0000000000..542f632f78 --- /dev/null +++ b/pengine/test10/systemhealthn1.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthn2.dot b/pengine/test10/systemhealthn2.dot new file mode 100644 index 0000000000..80a686d4db --- /dev/null +++ b/pengine/test10/systemhealthn2.dot @@ -0,0 +1,24 @@ +digraph "g" { +"all_stopped" -> "apache_1_start_0 hs21c" [ style = bold] +"all_stopped" -> "nfs_1_start_0 hs21c" [ style = bold] +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_monitor_10000 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_start_0 hs21c" -> "apache_1_monitor_10000 hs21c" [ style = bold] +"apache_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_20000 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_start_0 hs21c" -> "nfs_1_monitor_20000 hs21c" [ style = bold] +"nfs_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" -> "apache_1_start_0 hs21c" [ style = bold] +"probe_complete" -> "nfs_1_start_0 hs21c" [ style = bold] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthn2.exp b/pengine/test10/systemhealthn2.exp new file mode 100644 index 0000000000..9a226102b5 --- /dev/null +++ b/pengine/test10/systemhealthn2.exp @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthn2.scores b/pengine/test10/systemhealthn2.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealthn2.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthn2.xml b/pengine/test10/systemhealthn2.xml new file mode 100644 index 0000000000..b0635570a7 --- /dev/null +++ b/pengine/test10/systemhealthn2.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthn3.dot b/pengine/test10/systemhealthn3.dot new file mode 100644 index 0000000000..80a686d4db --- /dev/null +++ b/pengine/test10/systemhealthn3.dot @@ -0,0 +1,24 @@ +digraph "g" { +"all_stopped" -> "apache_1_start_0 hs21c" [ style = bold] +"all_stopped" -> "nfs_1_start_0 hs21c" [ style = bold] +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_monitor_10000 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_start_0 hs21c" -> "apache_1_monitor_10000 hs21c" [ style = bold] +"apache_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_20000 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_start_0 hs21c" -> "nfs_1_monitor_20000 hs21c" [ style = bold] +"nfs_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" -> "apache_1_start_0 hs21c" [ style = bold] +"probe_complete" -> "nfs_1_start_0 hs21c" [ style = bold] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthn3.exp b/pengine/test10/systemhealthn3.exp new file mode 100644 index 0000000000..9a226102b5 --- /dev/null +++ b/pengine/test10/systemhealthn3.exp @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthn3.scores b/pengine/test10/systemhealthn3.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealthn3.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthn3.xml b/pengine/test10/systemhealthn3.xml new file mode 100644 index 0000000000..78fc7fd6c1 --- /dev/null +++ b/pengine/test10/systemhealthn3.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealtho1.dot b/pengine/test10/systemhealtho1.dot new file mode 100644 index 0000000000..d6a8ceff8a --- /dev/null +++ b/pengine/test10/systemhealtho1.dot @@ -0,0 +1,11 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21c" -> "all_stopped" [ style = bold] +"stonith hs21c" [ style=bold color="green" fontcolor="black" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" -> "stonith hs21c" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21c" [ style = bold] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealtho1.exp b/pengine/test10/systemhealtho1.exp new file mode 100644 index 0000000000..a2ae40c3d5 --- /dev/null +++ b/pengine/test10/systemhealtho1.exp @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealtho1.scores b/pengine/test10/systemhealtho1.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealtho1.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealtho1.xml b/pengine/test10/systemhealtho1.xml new file mode 100644 index 0000000000..f419b870a7 --- /dev/null +++ b/pengine/test10/systemhealtho1.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealtho2.dot b/pengine/test10/systemhealtho2.dot new file mode 100644 index 0000000000..b9426f8d51 --- /dev/null +++ b/pengine/test10/systemhealtho2.dot @@ -0,0 +1,14 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealtho2.exp b/pengine/test10/systemhealtho2.exp new file mode 100644 index 0000000000..761bd6e390 --- /dev/null +++ b/pengine/test10/systemhealtho2.exp @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealtho2.scores b/pengine/test10/systemhealtho2.scores new file mode 100644 index 0000000000..ef0e9c92b7 --- /dev/null +++ b/pengine/test10/systemhealtho2.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: -1000000 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: -1000000 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealtho2.xml b/pengine/test10/systemhealtho2.xml new file mode 100644 index 0000000000..8cc5a1af09 --- /dev/null +++ b/pengine/test10/systemhealtho2.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealtho3.dot b/pengine/test10/systemhealtho3.dot new file mode 100644 index 0000000000..b9426f8d51 --- /dev/null +++ b/pengine/test10/systemhealtho3.dot @@ -0,0 +1,14 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealtho3.exp b/pengine/test10/systemhealtho3.exp new file mode 100644 index 0000000000..761bd6e390 --- /dev/null +++ b/pengine/test10/systemhealtho3.exp @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealtho3.scores b/pengine/test10/systemhealtho3.scores new file mode 100644 index 0000000000..ef0e9c92b7 --- /dev/null +++ b/pengine/test10/systemhealtho3.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: -1000000 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: -1000000 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealtho3.xml b/pengine/test10/systemhealtho3.xml new file mode 100644 index 0000000000..d9215264f1 --- /dev/null +++ b/pengine/test10/systemhealtho3.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthp1.dot b/pengine/test10/systemhealthp1.dot new file mode 100644 index 0000000000..d6a8ceff8a --- /dev/null +++ b/pengine/test10/systemhealthp1.dot @@ -0,0 +1,11 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21c" -> "all_stopped" [ style = bold] +"stonith hs21c" [ style=bold color="green" fontcolor="black" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" -> "stonith hs21c" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21c" [ style = bold] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthp1.exp b/pengine/test10/systemhealthp1.exp new file mode 100644 index 0000000000..a2ae40c3d5 --- /dev/null +++ b/pengine/test10/systemhealthp1.exp @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthp1.scores b/pengine/test10/systemhealthp1.scores new file mode 100644 index 0000000000..f6fbaa5440 --- /dev/null +++ b/pengine/test10/systemhealthp1.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 100 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 100 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthp1.xml b/pengine/test10/systemhealthp1.xml new file mode 100644 index 0000000000..140475cc98 --- /dev/null +++ b/pengine/test10/systemhealthp1.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthp2.dot b/pengine/test10/systemhealthp2.dot new file mode 100644 index 0000000000..80a686d4db --- /dev/null +++ b/pengine/test10/systemhealthp2.dot @@ -0,0 +1,24 @@ +digraph "g" { +"all_stopped" -> "apache_1_start_0 hs21c" [ style = bold] +"all_stopped" -> "nfs_1_start_0 hs21c" [ style = bold] +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_monitor_10000 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_start_0 hs21c" -> "apache_1_monitor_10000 hs21c" [ style = bold] +"apache_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_20000 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_start_0 hs21c" -> "nfs_1_monitor_20000 hs21c" [ style = bold] +"nfs_1_start_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" -> "apache_1_start_0 hs21c" [ style = bold] +"probe_complete" -> "nfs_1_start_0 hs21c" [ style = bold] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthp2.exp b/pengine/test10/systemhealthp2.exp new file mode 100644 index 0000000000..9a226102b5 --- /dev/null +++ b/pengine/test10/systemhealthp2.exp @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthp2.scores b/pengine/test10/systemhealthp2.scores new file mode 100644 index 0000000000..7d1deacaa0 --- /dev/null +++ b/pengine/test10/systemhealthp2.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: 0 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: 0 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthp2.xml b/pengine/test10/systemhealthp2.xml new file mode 100644 index 0000000000..b4176b7dbf --- /dev/null +++ b/pengine/test10/systemhealthp2.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthp3.dot b/pengine/test10/systemhealthp3.dot new file mode 100644 index 0000000000..b9426f8d51 --- /dev/null +++ b/pengine/test10/systemhealthp3.dot @@ -0,0 +1,14 @@ +digraph "g" { +"all_stopped" [ style=bold color="green" fontcolor="orange" ] +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +"stonith hs21d" -> "all_stopped" [ style = bold] +"stonith hs21d" [ style=bold color="green" fontcolor="black" ] +"stonith_up" -> "stonith hs21d" [ style = bold] +"stonith_up" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthp3.exp b/pengine/test10/systemhealthp3.exp new file mode 100644 index 0000000000..761bd6e390 --- /dev/null +++ b/pengine/test10/systemhealthp3.exp @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthp3.scores b/pengine/test10/systemhealthp3.scores new file mode 100644 index 0000000000..ef0e9c92b7 --- /dev/null +++ b/pengine/test10/systemhealthp3.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: -1000000 +native_color: apache_1 allocation score on hs21d: 0 +native_color: nfs_1 allocation score on hs21c: -1000000 +native_color: nfs_1 allocation score on hs21d: 0 diff --git a/pengine/test10/systemhealthp3.xml b/pengine/test10/systemhealthp3.xml new file mode 100644 index 0000000000..d50b7f19ca --- /dev/null +++ b/pengine/test10/systemhealthp3.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthp4.dot b/pengine/test10/systemhealthp4.dot new file mode 100644 index 0000000000..3e2969c596 --- /dev/null +++ b/pengine/test10/systemhealthp4.dot @@ -0,0 +1,23 @@ +digraph "g" { +"apache_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"apache_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"apache_1_monitor_0 hs21d" -> "probe_complete hs21d" [ style = bold] +"apache_1_monitor_0 hs21d" [ style=bold color="green" fontcolor="black" ] +"apache_1_monitor_10000 hs21d" [ style=bold color="green" fontcolor="black" ] +"apache_1_start_0 hs21d" -> "apache_1_monitor_10000 hs21d" [ style = bold] +"apache_1_start_0 hs21d" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21c" -> "probe_complete hs21c" [ style = bold] +"nfs_1_monitor_0 hs21c" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_0 hs21d" -> "probe_complete hs21d" [ style = bold] +"nfs_1_monitor_0 hs21d" [ style=bold color="green" fontcolor="black" ] +"nfs_1_monitor_20000 hs21d" [ style=bold color="green" fontcolor="black" ] +"nfs_1_start_0 hs21d" -> "nfs_1_monitor_20000 hs21d" [ style = bold] +"nfs_1_start_0 hs21d" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21c" -> "probe_complete" [ style = bold] +"probe_complete hs21c" [ style=bold color="green" fontcolor="black" ] +"probe_complete hs21d" -> "probe_complete" [ style = bold] +"probe_complete hs21d" [ style=bold color="green" fontcolor="black" ] +"probe_complete" -> "apache_1_start_0 hs21d" [ style = bold] +"probe_complete" -> "nfs_1_start_0 hs21d" [ style = bold] +"probe_complete" [ style=bold color="green" fontcolor="orange" ] +} diff --git a/pengine/test10/systemhealthp4.exp b/pengine/test10/systemhealthp4.exp new file mode 100644 index 0000000000..83e714c12c --- /dev/null +++ b/pengine/test10/systemhealthp4.exp @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pengine/test10/systemhealthp4.scores b/pengine/test10/systemhealthp4.scores new file mode 100644 index 0000000000..1bb66ac6b5 --- /dev/null +++ b/pengine/test10/systemhealthp4.scores @@ -0,0 +1,5 @@ +Allocation scores: +native_color: apache_1 allocation score on hs21c: -106 +native_color: apache_1 allocation score on hs21d: 816 +native_color: nfs_1 allocation score on hs21c: -106 +native_color: nfs_1 allocation score on hs21d: 816 diff --git a/pengine/test10/systemhealthp4.xml b/pengine/test10/systemhealthp4.xml new file mode 100644 index 0000000000..37e1f60e44 --- /dev/null +++ b/pengine/test10/systemhealthp4.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/Makefile.am b/tools/Makefile.am index b750b60f65..cde3d0450e 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,121 +1,139 @@ # # Copyright (C) 2004-2009 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 ccdv SUBDIRS = shell INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl COMMONLIBS = \ $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/cib/libcib.la \ $(CURSESLIBS) $(CLUSTERLIBS) headerdir = $(pkgincludedir)/crm header_HEADERS = attrd.h EXTRA_DIST = ccdv.c halibdir = $(CRM_DAEMON_DIR) halib_SCRIPTS = haresources2cib.py hb2openais.sh halib_PROGRAMS = attrd pingd halib_PYTHON = crm_primitive.py hb2openais-helper.py sbin_PROGRAMS = crmadmin cibadmin crm_node crm_attribute crm_resource crm_verify \ crm_uuid crm_shadow attrd_updater crm_diff crm_mon iso8601 +if BUILD_SERVICELOG +sbin_PROGRAMS += notifyServicelogEvent +endif +if BUILD_OPENIPMI_SERICELOG +sbin_PROGRAMS += ipmiservicelogd +endif if BUILD_HELP man8_MANS = $(sbin_PROGRAMS:%=%.8) %.8: % echo Creating $@ help2man --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/tools/$< endif sbin_SCRIPTS = crm crm_standby crm_master crm_failcount ## SOURCES ccdv: $(top_srcdir)/tools/ccdv.c gcc $(AM_CFLAGS) $(CFLAGS) -o ccdv $(top_srcdir)/tools/ccdv.c ## SOURCES #noinst_HEADERS = config.h control.h crmd.h noinst_HEADERS = crmadmin_SOURCES = crmadmin.c crmadmin_LDADD = $(COMMONLIBS) $(CLUSTERLIBS) \ $(top_builddir)/lib/pengine/libpe_status.la crm_uuid_SOURCES = crm_uuid.c crm_uuid_LDADD = $(top_builddir)/lib/common/libcrmcluster.la cibadmin_SOURCES = cibadmin.c cibadmin_LDADD = $(COMMONLIBS) crm_shadow_SOURCES = cib_shadow.c crm_shadow_LDADD = $(COMMONLIBS) crm_node_SOURCES = ccm_epoche.c crm_node_LDADD = $(COMMONLIBS) $(CLUSTERLIBS) \ $(top_builddir)/lib/common/libcrmcluster.la crm_diff_SOURCES = xml_diff.c crm_diff_LDADD = $(COMMONLIBS) crm_mon_SOURCES = crm_mon.c crm_mon_LDADD = $(COMMONLIBS) $(SNMPLIBS) $(ESMTPLIBS) -llrm \ $(top_builddir)/lib/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/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la crm_attribute_SOURCES = crm_attribute.c crm_attribute_LDADD = $(COMMONLIBS) crm_resource_SOURCES = crm_resource.c crm_resource_LDADD = $(COMMONLIBS) \ $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la iso8601_SOURCES = test.iso8601.c iso8601_LDADD = $(COMMONLIBS) # A little trick. Now ccdv can be auto-built but not auto-cleaned. attrd_DEPENDENCIES = ccdv attrd_SOURCES = attrd.c attrd_LDADD = $(COMMONLIBS) $(top_builddir)/lib/common/libcrmcluster.la pingd_SOURCES = pingd.c pingd_LDADD = $(COMMONLIBS) attrd_updater_SOURCES = attrd_updater.c attrd_updater_LDADD = $(COMMONLIBS) +if BUILD_SERVICELOG +notifyServicelogEvent_SOURCES = notifyServicelogEvent.c +notifyServicelogEvent_CFLAGS = `pkg-config --cflags servicelog-1` +notifyServicelogEvent_LDFLAGS = `pkg-config --libs servicelog-1` $(top_builddir)/lib/common/libcrmcommon.la +endif + +if BUILD_OPENIPMI_SERICELOG +ipmiservicelogd_SOURCES = ipmiservicelogd.c +ipmiservicelogd_CFLAGS = `pkg-config --cflags OpenIPMI OpenIPMIposix servicelog-1` +ipmiservicelogd_LDFLAGS = `pkg-config --libs OpenIPMI OpenIPMIposix servicelog-1` $(top_builddir)/lib/common/libcrmcommon.la +endif + clean-generic: rm -f *.log *.debug *.xml *~ install-exec-local: uninstall-local: .PHONY: install-exec-hook diff --git a/tools/ipmiservicelogd.c b/tools/ipmiservicelogd.c new file mode 100644 index 0000000000..f921d60498 --- /dev/null +++ b/tools/ipmiservicelogd.c @@ -0,0 +1,631 @@ +/* + * ipmiservicelogd.c + * + * A program that listens to IPMI events and writes them + * out to servicelog. + * + * Author: International Business Machines, IBM + * Mark Hamzy + * Author: Intel Corporation + * Jeff Zheng + * + * Copyright 2009 International Business Machines, IBM + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* gcc -o ipmiservicelogd -g `pkg-config --cflags --libs OpenIPMI OpenIPMIposix servicelog-1` ipmiservicelogd.c + */ +/* ./ipmiservicelogd smi 0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#define COMPLEX 1 + +static os_handler_t *os_hnd; + +char *getStringExecOutput (char *args[]); +char *getSerialNumber (void); +char *getProductName (void); +static void con_usage (const char *name, const char *help, void *cb_data); +static void usage (const char *progname); +void ipmi2servicelog (struct sl_data_bmc *bmc_data); +static int sensor_threshold_event_handler (ipmi_sensor_t *sensor, enum ipmi_event_dir_e dir, enum ipmi_thresh_e threshold, enum ipmi_event_value_dir_e high_low, enum ipmi_value_present_e value_present, unsigned int raw_value, double value, void *cb_data, ipmi_event_t *event); +static int sensor_discrete_event_handler (ipmi_sensor_t *sensor, enum ipmi_event_dir_e dir, int offset, int severity, int prev_severity, void *cb_data, ipmi_event_t *event); +static void sensor_change (enum ipmi_update_e op, ipmi_entity_t *ent, ipmi_sensor_t *sensor, void *cb_data); +static void entity_change (enum ipmi_update_e op, ipmi_domain_t *domain, ipmi_entity_t *entity, void *cb_data); +void setup_done (ipmi_domain_t *domain, int err, unsigned int conn_num, unsigned int port_num, int still_connected, void *user_data); + +char * +getStringExecOutput (char *args[]) +{ + int rc; + pid_t pid; + int pipefd[2]; + + rc = pipe2 (pipefd, 0); + + if (rc == -1) { + + crm_err ("Error: pipe errno = %d", errno); + + return NULL; + } + + pid = fork (); + + if (0 < pid) { + + /* Parent */ + int childExitStatus; + char serialNumber[256]; + ssize_t sizeRead; + + /* close write end of pipe */ + rc = close (pipefd[1]); + if (rc == -1) { + crm_err ("Error: parent close (pipefd[1]) = %d", errno); + } + + /* make 0 same as read-from end of pipe */ + rc = dup2 (pipefd[0], 0); + if (rc == -1) { + crm_err ("Error: parent dup2 (pipefd[0]) = %d", errno); + } + + /* close excess fildes */ + rc = close (pipefd[0]); + if (rc == -1) { + crm_err ("Error: parent close (pipefd[0]) = %d", errno); + } + + waitpid (pid, &childExitStatus, 0); + + if (!WIFEXITED(childExitStatus)) { + + crm_err ("waitpid() exited with an error: status = %d", WEXITSTATUS(childExitStatus)); + + return NULL; + + } else if (WIFSIGNALED(childExitStatus)) { + + crm_err ("waitpid() exited due to a signal = %d", WTERMSIG(childExitStatus)); + + return NULL; + + } + + memset (serialNumber, 0, sizeof (serialNumber)); + + sizeRead = read (0, serialNumber, sizeof (serialNumber) - 1); + + if (sizeRead > 0) { + + char *end = serialNumber + strlen (serialNumber) - 1; + char *retSerialNumber = NULL; + + while ( end > serialNumber + && (*end == '\n' || *end == '\r' || *end == '\t' || *end == ' ') + ) { + *end = '\0'; + end--; + } + + retSerialNumber = malloc (strlen (serialNumber) + 1); + + if (retSerialNumber) { + + strcpy (retSerialNumber, serialNumber); + + } + + return retSerialNumber; + + } + + return NULL; + + } else if (pid == 0) { + + /* Child */ + + /* close read end of pipe */ + rc = close (pipefd[0]); + if (rc == -1) { + crm_err ("Error: child close (pipefd[0]) = %d", errno); + } + + /* make 1 same as write-to end of pipe */ + rc = dup2 (pipefd[1], 1); + if (rc == -1) { + crm_err ("Error: child dup2 (pipefd[1]) = %d", errno); + } + + /* close excess fildes */ + rc = close (pipefd[1]); + if (rc == -1) { + crm_err ("Error: child close (pipefd[1]) = %d", errno); + } + + rc = execvp (args[0], args); + + if (rc == -1) { + crm_err ("Error: child execvp = %d", errno); + } + + /* In case of error */ + return NULL; + + } else { + + /* Error */ + crm_err ("fork errno = %d", errno); + + return NULL; + } + + return NULL; +} + +char * +getSerialNumber (void) +{ + char *dmiArgs[] = { + "dmidecode", + "--string", + "system-serial-number", + NULL + }; + + return getStringExecOutput (dmiArgs); +} + +char * +getProductName (void) +{ + char *dmiArgs[] = { + "dmidecode", + "--string", + "system-product-name", + NULL + }; + + return getStringExecOutput (dmiArgs); +} + +static void +con_usage (const char *name, const char *help, void *cb_data) +{ + printf("\n%s%s", name, help); +} + +static void +usage(const char *progname) +{ + printf("Usage:\n"); + printf(" %s \n", progname); + printf(" Where is one of:"); + ipmi_parse_args_iter_help(con_usage, NULL); +} + +void +ipmi2servicelog (struct sl_data_bmc *bmc_data) +{ + servicelog *slog = NULL; + struct sl_event sl_event; + uint64_t new_id = 0; + struct utsname name; + char *serial_number = NULL; + char *product_name = NULL; + int rc; + + if (uname (&name) == -1) + { + crm_err ("Error: uname failed"); + return; + } + + rc = servicelog_open (&slog, 0); /* flags is one of SL_FLAG_xxx */ + + if (!slog) + { + crm_err ("Error: servicelog_open failed, rc = %d", rc); + return; + } + + serial_number = getSerialNumber (); + if (serial_number) { + if (strlen (serial_number) > 20) { + serial_number[20] = '\0'; + } + } + + product_name = getProductName (); + if (product_name) { + if (strlen (product_name) > 20) { + product_name[20] = '\0'; + } + } + + memset (&sl_event, 0, sizeof (sl_event)); + + sl_event.next = NULL; /* only used if in a linked list */ + sl_event.id = 0; /* unique identifier - filled in by API call */ + sl_event.time_logged = time (NULL); + sl_event.time_event = time (NULL); + sl_event.time_last_update = time (NULL); + sl_event.type = SL_TYPE_BMC; /* one of SL_TYPE_* */ + sl_event.severity = SL_SEV_WARNING; /* one of SL_SEV_* */ + sl_event.platform = name.machine; /* ppc64, etc */ + sl_event.machine_serial = serial_number; + sl_event.machine_model = product_name; /* it may not have the serial # within the first 20 chars */ + sl_event.nodename = name.nodename; + sl_event.refcode = "ipmi"; + sl_event.description = "ipmi event"; + sl_event.serviceable = 1; /* 1 or 0 */ + sl_event.predictive = 0; /* 1 or 0 */ + sl_event.disposition = SL_DISP_RECOVERABLE; /* one of SL_DISP_* */ + sl_event.call_home_status = SL_CALLHOME_NONE; /* one of SL_CALLHOME_*, + only valid if serviceable */ + sl_event.closed = 1; /* 1 or 0, only valid if serviceable */ + sl_event.repair = 0; /* id of repairing repair_action */ + sl_event.callouts = NULL; + sl_event.raw_data_len = 0; + sl_event.raw_data = NULL; + sl_event.addl_data = &bmc_data; /* pointer to an sl_data_* struct */ + + rc = servicelog_event_log (slog, &sl_event, &new_id); + + if (rc != 0) + { + crm_err ("Error: servicelog_event_log, rc = %d (\"%s\")", rc, servicelog_error (slog)); + } + else + { + crm_debug ("Sending to servicelog database"); + } + + if (serial_number) { + free (serial_number); + } + + if (product_name) { + free (product_name); + } + + servicelog_close (slog); +} + +static int +sensor_threshold_event_handler(ipmi_sensor_t *sensor, + enum ipmi_event_dir_e dir, + enum ipmi_thresh_e threshold, + enum ipmi_event_value_dir_e high_low, + enum ipmi_value_present_e value_present, + unsigned int raw_value, + double value, + void *cb_data, + ipmi_event_t *event) +{ + ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor); + int id, + instance; + char name[IPMI_ENTITY_NAME_LEN]; + struct sl_data_bmc bmc_data; + uint32_t sel_id; + uint32_t sel_type; + uint16_t generator; + uint8_t version; + uint8_t sensor_type; + int sensor_lun; + int sensor_number; + uint8_t event_class; + uint8_t event_type; + int direction; + + id = ipmi_entity_get_entity_id(ent); + instance = ipmi_entity_get_entity_instance(ent); + ipmi_sensor_get_id(sensor, name, sizeof (name)); + + ipmi_sensor_get_num (sensor, &sensor_lun, &sensor_number); + + sel_id = ipmi_entity_get_entity_id (ent); + sel_type = ipmi_entity_get_type (ent); + generator = ipmi_entity_get_slave_address (ent) | (sensor_lun << 5); /* LUN (2 bits) | SLAVE ADDRESS (5 bits) */ + version = 0x04; + sensor_type = ipmi_sensor_get_sensor_type (sensor); + event_class = 0; /* @TBD - where does this come from? */ + event_type = ipmi_event_get_type (event); + direction = dir; + + memset (&bmc_data, 0, sizeof (bmc_data)); + + bmc_data.sel_id = sel_id; + bmc_data.sel_type = sel_type; + bmc_data.generator = generator; + bmc_data.version = version; + bmc_data.sensor_type = sensor_type; + bmc_data.sensor_number = sensor_number; + bmc_data.event_class = event_class; + bmc_data.event_type = event_type; + bmc_data.direction = direction; + + crm_debug ("Writing bmc_data (%08x, %08x, %04x, %02x, %02x, %02x, %02x, %02x, %d)\n", + bmc_data.sel_id, + bmc_data.sel_type, + bmc_data.generator, + bmc_data.version, + bmc_data.sensor_type, + bmc_data.sensor_number, + bmc_data.event_class, + bmc_data.event_type, + bmc_data.direction); + + ipmi2servicelog (&bmc_data); + + /* This passes the event on to the main event handler, which does + not exist in this program. */ + return IPMI_EVENT_NOT_HANDLED; +} + +static int +sensor_discrete_event_handler(ipmi_sensor_t *sensor, + enum ipmi_event_dir_e dir, + int offset, + int severity, + int prev_severity, + void *cb_data, + ipmi_event_t *event) +{ + ipmi_entity_t *ent = ipmi_sensor_get_entity(sensor); + int id, + instance; + char name[IPMI_ENTITY_NAME_LEN]; + struct sl_data_bmc bmc_data; + uint32_t sel_id; + uint32_t sel_type; + uint16_t generator; + uint8_t version; + uint8_t sensor_type; + int sensor_lun; + int sensor_number; + uint8_t event_class; + uint8_t event_type; + int direction; + + id = ipmi_entity_get_entity_id(ent); + instance = ipmi_entity_get_entity_instance(ent); + ipmi_sensor_get_id(sensor, name, sizeof (name)); + + sel_id = ipmi_entity_get_entity_id (ent); + sel_type = ipmi_entity_get_type (ent); + generator = ipmi_entity_get_slave_address (ent) | (sensor_lun << 5); /* LUN (2 bits) | SLAVE ADDRESS (5 bits) */ + version = 0x04; + sensor_type = ipmi_sensor_get_sensor_type (sensor); + + ipmi_sensor_get_num (sensor, &sensor_lun, &sensor_number); + + event_class = 0; /* @TBD - where does this come from? */ + event_type = ipmi_event_get_type (event); + direction = dir; + + memset (&bmc_data, 0, sizeof (bmc_data)); + + bmc_data.sel_id = sel_id; + bmc_data.sel_type = sel_type; + bmc_data.generator = generator; + bmc_data.version = version; + bmc_data.sensor_type = sensor_type; + bmc_data.sensor_number = sensor_number; + bmc_data.event_class = event_class; + bmc_data.event_type = event_type; + bmc_data.direction = direction; + + crm_debug ("Writing bmc_data (%08x, %08x, %04x, %02x, %02x, %02x, %02x, %02x, %d)\n", + bmc_data.sel_id, + bmc_data.sel_type, + bmc_data.generator, + bmc_data.version, + bmc_data.sensor_type, + bmc_data.sensor_number, + bmc_data.event_class, + bmc_data.event_type, + bmc_data.direction); + + ipmi2servicelog (&bmc_data); + + /* This passes the event on to the main event handler, which does + not exist in this program. */ + return IPMI_EVENT_NOT_HANDLED; +} + +/* Whenever the status of a sensor changes, the function is called + We display the information of the sensor if we find a new sensor +*/ +static void +sensor_change(enum ipmi_update_e op, + ipmi_entity_t *ent, + ipmi_sensor_t *sensor, + void *cb_data) +{ + int rv; + + if (op == IPMI_ADDED) { + if (ipmi_sensor_get_event_reading_type(sensor) == IPMI_EVENT_READING_TYPE_THRESHOLD) + rv = ipmi_sensor_add_threshold_event_handler (sensor, + sensor_threshold_event_handler, + NULL); + else + rv = ipmi_sensor_add_discrete_event_handler (sensor, + sensor_discrete_event_handler, + NULL); + if (rv) + crm_err ("Unable to add the sensor event handler: %x", rv); + } +} + +/* Whenever the status of an entity changes, the function is called + When a new entity is created, we search all sensors that belong + to the entity */ +static void +entity_change(enum ipmi_update_e op, + ipmi_domain_t *domain, + ipmi_entity_t *entity, + void *cb_data) +{ + int rv; + int id, instance; + + id = ipmi_entity_get_entity_id(entity); + instance = ipmi_entity_get_entity_instance(entity); + if (op == IPMI_ADDED) { + /* Register callback so that when the status of a + sensor changes, sensor_change is called */ + rv = ipmi_entity_add_sensor_update_handler(entity, + sensor_change, + entity); + if (rv) { + crm_err ("ipmi_entity_set_sensor_update_handler: 0x%x", rv); + exit(1); + } + } +} + +/* After we have established connection to domain, this function get called + At this time, we can do whatever things we want to do. Herr we want to + search all entities in the system */ +void +setup_done(ipmi_domain_t *domain, + int err, + unsigned int conn_num, + unsigned int port_num, + int still_connected, + void *user_data) +{ + int rv; + + /* Register a callback functin entity_change. When a new entities + is created, entity_change is called */ + rv = ipmi_domain_add_entity_update_handler(domain, entity_change, domain); + if (rv) { + crm_err ("ipmi_domain_add_entity_update_handler return error: %d", rv); + return; + } + +} + +int +main(int argc, char *argv[]) +{ + int rv; + int curr_arg = 1; + ipmi_args_t *args; + ipmi_con_t *con; + + /* OS handler allocated first. */ + os_hnd = ipmi_posix_setup_os_handler(); + if (!os_hnd) { + crm_err ("ipmi_smi_setup_con: Unable to allocate os handler"); + exit(1); + } + + /* Initialize the OpenIPMI library. */ + ipmi_init(os_hnd); + +#ifdef COMPLEX + rv = ipmi_parse_args2(&curr_arg, argc, argv, &args); + if (rv) { + crm_err ("Error parsing command arguments, argument %d: %s", + curr_arg, strerror(rv)); + usage(argv[0]); + exit(1); + } +#endif + + crm_make_daemon ("ipmiservicelogd", TRUE, "/var/run/ipmiservicelogd.pid0"); + + crm_log_init ("ipmiservicelogd", LOG_INFO, FALSE, TRUE, argc, argv); + +#ifdef COMPLEX + rv = ipmi_args_setup_con(args, os_hnd, NULL, &con); + if (rv) { + crm_err ("ipmi_ip_setup_con: %s", strerror(rv)); + crm_err ("Error: Is IPMI configured correctly?"); + exit(1); + } +#else + /* If all you need is an SMI connection, this is all the code you + need. */ + /* Establish connections to domain through system interface. This + function connect domain, selector and OS handler together. + When there is response message from domain, the status of file + descriptor in selector is changed and predefined callback is + called. After the connection is established, setup_done will be + called. */ + rv = ipmi_smi_setup_con(0, os_hnd, NULL, &con); + if (rv) { + crm_err ("ipmi_smi_setup_con: %s", strerror(rv)); + crm_err ("Error: Is IPMI configured correctly?"); + exit(1); + } +#endif + + rv = ipmi_open_domain("", &con, 1, setup_done, NULL, NULL, NULL, + NULL, 0, NULL); + if (rv) { + crm_err ("ipmi_init_domain: %s", strerror(rv)); + exit(1); + } + + /* This is the main loop of the event-driven program. + Try to exit the program */ + /* Let the selector code run the select loop. */ + os_hnd->operation_loop(os_hnd); + + /* Technically, we can't get here, but this is an example. */ + os_hnd->free_os_handler(os_hnd); +} diff --git a/tools/notifyServicelogEvent.c b/tools/notifyServicelogEvent.c new file mode 100644 index 0000000000..d3e224f32a --- /dev/null +++ b/tools/notifyServicelogEvent.c @@ -0,0 +1,218 @@ +/* + * Copyright (C) 2009 International Business Machines, IBM, Mark Hamzy + * + * 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 + */ + +/* gcc -o notifyServicelogEvent `pkg-config --cflags servicelog-1` `pkg-config --libs servicelog-1` notifyServicelogEvent.c +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef enum {STATUS_GREEN = 1, STATUS_YELLOW, STATUS_RED} STATUS; + +const char * status2char (STATUS status); +STATUS event2status (struct sl_event *event); + +const char * +status2char (STATUS status) +{ + switch (status) + { + default: + case STATUS_GREEN: + return "green"; + case STATUS_YELLOW: + return "yellow"; + case STATUS_RED: + return "red"; + } +} + +STATUS +event2status (struct sl_event *event) +{ + STATUS status = STATUS_GREEN; + + crm_debug ("Severity = %d, Disposition = %d", event->severity, event->disposition); + + /* @TBD */ + if (event->severity == SL_SEV_WARNING) + { + status = STATUS_YELLOW; + } + + if (event->disposition == SL_DISP_UNRECOVERABLE) + { + status = STATUS_RED; + } + + return status; +} + +static struct crm_option long_options[] = { + /* Top-level Options */ + {"help", 0, 0, '?', "\tThis text"}, + {"version", 0, 0, '$', "\tVersion information" }, + {"-spacer-",0, 0, '-', "\nUsage: notifyServicelogEvent event_id"}, + {"-spacer-",0, 0, '-', "\nWhere event_id is unique unsigned event identifier which is then passed into servicelog"}, + + {0, 0, 0, 0} +}; + +int +main (int argc, char *argv[]) +{ + int argerr = 0; + int flag; + int index = 0; + int rc = 0; + servicelog *slog = NULL; + struct sl_event *event = NULL; + uint64_t event_id = 0; + + crm_log_init("notifyServicelogEvent", LOG_INFO, FALSE, TRUE, 0, NULL); + crm_set_options("?$", "event_id ", long_options, "Gets called upon events written to servicelog database"); + + if (argc < 2) { + argerr++; + } + + while (1) { + flag = crm_get_option(argc, argv, &index); + if (flag == -1) + break; + + switch(flag) { + case '?': + case '$': + crm_help(flag, 0); + break; + default: + ++argerr; + break; + } + } + + if (argc - optind != 1) { + ++argerr; + } + + if (argerr) { + crm_help('?', 1); + } + + openlog ("notifyServicelogEvent", LOG_NDELAY, LOG_USER); + + if (sscanf (argv[optind], U64T, &event_id) != 1) + { + crm_err ("Error: could not read event_id from args!"); + + rc = 1; + goto cleanup; + } + + if (event_id == 0) + { + crm_err ("Error: event_id is 0!"); + + rc = 1; + goto cleanup; + } + + rc = servicelog_open (&slog, 0); /* flags is one of SL_FLAG_xxx */ + + if (!slog) + { + crm_err ("Error: servicelog_open failed, rc = %d", rc); + + rc = 1; + goto cleanup; + } + + if (slog) + { + rc = servicelog_event_get (slog, event_id, &event); + } + + if (rc == 0) + { + STATUS status = STATUS_GREEN; + const char *health_component = "#health-ipmi"; + const char *health_status = NULL; + + crm_debug ("Event id = "U64T", Log timestamp = %s, Event timestamp = %s", + event_id, + ctime (&(event->time_logged)), + ctime (&(event->time_event))); + + status = event2status (event); + + health_status = status2char (status); + + if (health_status) + { + gboolean rc; + + rc = attrd_update_no_mainloop (NULL, + 'v', + NULL, + health_component, + health_status, + NULL, + NULL, + NULL); + + crm_debug ("attrd_update_no_mainloop ('%s', '%s') = %d", + health_component, + health_status, + rc); + } + else + { + crm_err ("Error: status2char failed, status = %d", status); + rc = 1; + } + } + else + { + crm_err ("Error: servicelog_event_get failed, rc = %d", rc); + } + +cleanup: + if (event) + { + servicelog_event_free (event); + } + + if (slog) + { + servicelog_close (slog); + } + + closelog (); + + return rc; +}