Commit 73b0fa69 authored by Iustin Pop's avatar Iustin Pop

Enable selection between Python and Haskell confd

This patch changes configure.ac Makefile.am so that the user can pass:

- --disable-confd (or --enable-confd=no) to disable it completely
- --enable-confd=yes or --enable-confd=python to select the
  traditional implementation (this is the default setting)
- --enable-confd=haskell to select hconfd

The only "not nice" thing is that I've chosen to keep the
hconfd.hs/hconfd name, and we rename it after install via an
install-exec-hook. The other choice is possible too (to rename the
source file/binary).

One additional note is that if we select haskell, the _rule_ for
creating daemons/ganeti-confd dissapears; whereas if we select python,
the rule for htools/hconfd still exists (one can build it explicitly),
it just is not installed. This is due to the different way in which
the rules are declared.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent acf70442
......@@ -355,12 +355,9 @@ docrst = \
doc/walkthrough.rst
HS_PROGS = htools/htools
if WANT_CONFD
HS_PROGS += htools/hconfd
endif
HS_BIN_ROLES = hbal hscan hspace hinfo
HS_ALL_PROGS = $(HS_PROGS) htools/test htools/hpc-htools
HS_ALL_PROGS = $(HS_PROGS) htools/test htools/hpc-htools htools/hconfd
HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_ALL_PROGS))
HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/%) test/hail
......@@ -485,13 +482,16 @@ gnt_scripts = \
scripts/gnt-os
PYTHON_BOOTSTRAP_SBIN = \
daemons/ganeti-confd \
daemons/ganeti-masterd \
daemons/ganeti-noded \
daemons/ganeti-watcher \
daemons/ganeti-rapi \
$(gnt_scripts)
if PY_CONFD
PYTHON_BOOTSTRAP_SBIN += daemons/ganeti-confd
endif
PYTHON_BOOTSTRAP = \
$(PYTHON_BOOTSTRAP_SBIN) \
tools/ensure-dirs
......@@ -523,6 +523,9 @@ install-exec-hook:
$(LN_S) -f htools \
$(DESTDIR)$(bindir)/$$role ; \
done
if HS_CONFD
mv $(DESTDIR)$(sbindir)/hconfd $(DESTDIR)$(sbindir)/ganeti-confd
endif
endif
$(HS_ALL_PROGS): %: %.hs $(HS_LIB_SRCS) $(HS_BUILT_SRCS) Makefile
......@@ -573,6 +576,10 @@ nodist_sbin_SCRIPTS = \
$(PYTHON_BOOTSTRAP_SBIN) \
daemons/ganeti-cleaner
if HS_CONFD
nodist_sbin_SCRIPTS += htools/hconfd
endif
python_scripts = \
tools/burnin \
tools/cfgshell \
......@@ -1109,6 +1116,8 @@ lib/_autoconf.py: Makefile | lib/.dir
echo "HTOOLS = False"; \
fi; \
echo "ENABLE_CONFD = $(ENABLE_CONFD)"; \
echo "PY_CONFD = $(PY_CONFD)"; \
echo "HS_CONFD = $(HS_CONFD)"; \
} > $@
lib/_vcsversion.py: Makefile vcs-version | lib/.dir
......
......@@ -270,13 +270,22 @@ AC_ARG_ENABLE([htools-rapi],
ENABLE_CONFD=
AC_ARG_ENABLE([confd],
[AS_HELP_STRING([--enable-confd],
[enable the ganeti-confd daemon (default: yes)])],
[enable the ganeti-confd daemon (default: python, options haskell/python/no)])],
[[case "$enableval" in
no)
enable_confd=False
py_confd=False
hs_confd=False
;;
yes)
yes|python)
enable_confd=True
py_confd=True
hs_confd=False
;;
haskell)
enable_confd=True
py_confd=False
hs_confd=True
;;
*)
echo "Invalid value for enable-confd '$enableval'"
......@@ -284,10 +293,14 @@ AC_ARG_ENABLE([confd],
;;
esac
]],
[enable_confd=True])
[enable_confd=True;py_confd=True;hs_confd=False])
AC_SUBST(ENABLE_CONFD, $enable_confd)
AC_SUBST(PY_CONFD, $py_confd)
AC_SUBST(HS_CONFD, $hs_confd)
AM_CONDITIONAL([WANT_CONFD], [test x$enable_confd = xTrue])
AM_CONDITIONAL([PY_CONFD], [test x$py_confd = xTrue])
AM_CONDITIONAL([HS_CONFD], [test x$hs_confd = xTrue])
# --with-disk-separator=...
AC_ARG_WITH([disk-separator],
......@@ -485,6 +498,11 @@ AC_SUBST(HTOOLS_APIDOC)
fi # end if enable_htools, define automake conditions
if test "$HTOOLS" != "yes" && test "$HS_CONFD" = "True"; then
AC_MSG_ERROR(m4_normalize([cannot enable Haskell version of ganeti-confd if
htools support is not enabled]))
fi
AM_CONDITIONAL([WANT_HTOOLS], [test x$HTOOLS = xyes])
AM_CONDITIONAL([WANT_HTOOLSTESTS], [test "x$GHC_PKG_QUICKCHECK" != x])
AM_CONDITIONAL([WANT_HTOOLSAPIDOC], [test x$HTOOLS_APIDOC = xyes])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment