From: Michael Hanselmann Date: Fri, 9 May 2008 12:46:52 +0000 (+0000) Subject: Add --enable-rapi parameter to configure X-Git-Tag: v1.2.4~64 X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/130440e7d0f26fb256b801c1474dccfe6f3cb76c Add --enable-rapi parameter to configure This allows developers and packagers to control whether they want to start the remote API daemon, ganeti-rapi, automatically or not. Reviewed-by: ultrotter --- diff --git a/DEVNOTES b/DEVNOTES index 862f239..83714ff 100644 --- a/DEVNOTES +++ b/DEVNOTES @@ -6,4 +6,5 @@ Configuring for development sh autogen.sh && \ ./configure --enable-maintainer-mode \ - --prefix=/usr/local --sysconfdir=/etc --localstatedir=/var + --prefix=/usr/local --sysconfdir=/etc --localstatedir=/var \ + --enable-rapi diff --git a/configure.ac b/configure.ac index 53380bf..331c856 100644 --- a/configure.ac +++ b/configure.ac @@ -64,6 +64,21 @@ AC_ARG_WITH([xen-initrd], [xen_initrd="/boot/initrd-2.6-xenU"]) AC_SUBST(XEN_INITRD, $xen_initrd) +# --enable-rapi +AC_ARG_ENABLE([rapi], + [AS_HELP_STRING([--enable-rapi], + [Whether to enable remote API daemon] + )]) +if test "$enable_rapi" = "yes" +then + enable_rapi_py=True +else + enable_rapi=no + enable_rapi_py=False +fi +AC_SUBST(PY_ENABLE_RAPI, $enable_rapi_py) + + # Check common programs AC_PROG_INSTALL AC_PROG_LN_S diff --git a/daemons/ganeti-master b/daemons/ganeti-master index 5d882fc..b13ed98 100755 --- a/daemons/ganeti-master +++ b/daemons/ganeti-master @@ -128,11 +128,12 @@ def StartMaster(master_netdev, master_ip, debug): "-s", master_ip, master_ip]) # we'll ignore the exit code of arping - # Start remote API - result = utils.RunCmd(["ganeti-rapi", "--port=%s" % constants.RAPI_PORT]) - if debug and result.failed: - sys.stderr.write("Failed to start ganeti-rapi, error: %s\n" % - result.output) + if constants.RAPI_ENABLE: + # Start remote API + result = utils.RunCmd(["ganeti-rapi", "--port=%s" % constants.RAPI_PORT]) + if debug and result.failed: + sys.stderr.write("Failed to start ganeti-rapi, error: %s\n" % + result.output) return EXIT_OK @@ -141,10 +142,13 @@ def StopMaster(master_netdev, master_ip, debug): """Stops the master. """ - # Stop remote API - result = utils.RunCmd(["fuser", "-k", "-n", "tcp", str(constants.RAPI_PORT)]) - if debug and result.failed: - sys.stderr.write("Failed to stop ganeti-rapi, error: %s\n" % result.output) + if constants.RAPI_ENABLE: + # Stop remote API + result = utils.RunCmd(["fuser", "-k", "-n", "tcp", + str(constants.RAPI_PORT)]) + if debug and result.failed: + sys.stderr.write("Failed to stop ganeti-rapi, error: %s\n" % + result.output) result = utils.RunCmd(["ip", "address", "del", "%s/32" % master_ip, "dev", master_netdev]) diff --git a/lib/Makefile.am b/lib/Makefile.am index 062bcf1..c965f1f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -22,6 +22,7 @@ _autoconf.py: Makefile echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \ echo "XEN_INITRD = '$(XEN_INITRD)'"; \ echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \ + echo "RAPI_ENABLE = $(PY_ENABLE_RAPI)"; \ } > $@ include $(srcdir)/Makefile.libcommon diff --git a/lib/constants.py b/lib/constants.py index d970ec3..15446ed 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -182,4 +182,5 @@ IARUN_FAILURE = 2 IARUN_SUCCESS = 3 # Remote API constants +RAPI_ENABLE = _autoconf.RAPI_ENABLE RAPI_PORT = 5080