jqueue: Improve inotify error reporting
[ganeti-local] / Makefile.am
index ba073c9..c7865e6 100644 (file)
@@ -60,6 +60,7 @@ HTOOLS_DIRS = \
        htools/Ganeti/Block \
        htools/Ganeti/Block/Drbd \
        htools/Ganeti/Confd \
+       htools/Ganeti/DataCollectors \
        htools/Ganeti/HTools \
        htools/Ganeti/HTools/Backend \
        htools/Ganeti/HTools/Program \
@@ -113,6 +114,7 @@ ALL_APIDOC_HS_DIRS = \
        $(APIDOC_HS_DIR)/Ganeti/Block \
        $(APIDOC_HS_DIR)/Ganeti/Block/Drbd \
        $(APIDOC_HS_DIR)/Ganeti/Confd \
+       $(APIDOC_HS_DIR)/Ganeti/DataCollectors \
        $(APIDOC_HS_DIR)/Ganeti/HTools \
        $(APIDOC_HS_DIR)/Ganeti/HTools/Backend \
        $(APIDOC_HS_DIR)/Ganeti/HTools/Program \
@@ -332,6 +334,8 @@ server_PYTHON = \
 pytools_PYTHON = \
        lib/tools/__init__.py \
        lib/tools/ensure_dirs.py \
+       lib/tools/node_cleanup.py \
+       lib/tools/node_daemon_setup.py \
        lib/tools/prepare_node_join.py
 
 utils_PYTHON = \
@@ -402,13 +406,14 @@ docrst = \
        doc/virtual-cluster.rst \
        doc/walkthrough.rst
 
-HS_PROGS = htools/htools
+HS_PROGS = htools/htools htools/mon-collector
 HS_BIN_ROLES = hbal hscan hspace hinfo hcheck
 HS_HTOOLS_PROGS = $(HS_BIN_ROLES) hail
 
 HS_ALL_PROGS = \
        $(HS_PROGS) \
        htest/hpc-htools \
+       htest/hpc-mon-collector \
        htest/test \
        htools/hconfd \
        htools/rpc-test
@@ -450,6 +455,8 @@ HS_LIB_SRCS = \
        htools/Ganeti/Confd/Utils.hs \
        htools/Ganeti/Config.hs \
        htools/Ganeti/Daemon.hs \
+       htools/Ganeti/DataCollectors/Drbd.hs \
+       htools/Ganeti/DataCollectors/Program.hs \
        htools/Ganeti/Errors.hs \
        htools/Ganeti/HTools/Backend/IAlloc.hs \
        htools/Ganeti/HTools/Backend/Luxi.hs \
@@ -460,6 +467,7 @@ HS_LIB_SRCS = \
        htools/Ganeti/HTools/Cluster.hs \
        htools/Ganeti/HTools/Container.hs \
        htools/Ganeti/HTools/ExtLoader.hs \
+       htools/Ganeti/HTools/Graph.hs \
        htools/Ganeti/HTools/Group.hs \
        htools/Ganeti/HTools/Instance.hs \
        htools/Ganeti/HTools/Loader.hs \
@@ -478,6 +486,7 @@ HS_LIB_SRCS = \
        htools/Ganeti/Jobs.hs \
        htools/Ganeti/Logging.hs \
        htools/Ganeti/Luxi.hs \
+       htools/Ganeti/Network.hs \
        htools/Ganeti/Objects.hs \
        htools/Ganeti/OpCodes.hs \
        htools/Ganeti/OpParams.hs \
@@ -511,6 +520,7 @@ HS_TEST_SRCS = \
        htest/Test/Ganeti/HTools/CLI.hs \
        htest/Test/Ganeti/HTools/Cluster.hs \
        htest/Test/Ganeti/HTools/Container.hs \
+       htest/Test/Ganeti/HTools/Graph.hs \
        htest/Test/Ganeti/HTools/Instance.hs \
        htest/Test/Ganeti/HTools/Loader.hs \
        htest/Test/Ganeti/HTools/Node.hs \
@@ -519,6 +529,7 @@ HS_TEST_SRCS = \
        htest/Test/Ganeti/JSON.hs \
        htest/Test/Ganeti/Jobs.hs \
        htest/Test/Ganeti/Luxi.hs \
+       htest/Test/Ganeti/Network.hs \
        htest/Test/Ganeti/Objects.hs \
        htest/Test/Ganeti/OpCodes.hs \
        htest/Test/Ganeti/Query/Filter.hs \
@@ -614,6 +625,8 @@ PYTHON_BOOTSTRAP_SBIN = \
 PYTHON_BOOTSTRAP = \
        $(PYTHON_BOOTSTRAP_SBIN) \
        tools/ensure-dirs \
+       tools/node-cleanup \
+       tools/node-daemon-setup \
        tools/prepare-node-join
 
 qa_scripts = \
@@ -666,8 +679,11 @@ htest/test: HEXTRA_INT=-fhpc -ihtest
 # we compile the hpc-htools binary with the program coverage
 htest/hpc-htools: HEXTRA_INT=-fhpc
 
+# we compile the hpc-mon-collector binary with the program coverage
+htest/hpc-mon-collector: HEXTRA_INT=-fhpc
+
 # test dependency
-htest/offline-tests.sh: htest/hpc-htools
+htest/offline-tests.sh: htest/hpc-htools htest/hpc-mon-collector
 
 # rules for building profiling-enabled versions of the haskell
 # programs: hs-prof does the full two-step build, whereas
@@ -716,7 +732,11 @@ dist_tools_SCRIPTS = \
        tools/master-ip-setup \
        tools/xen-console-wrapper
 
+nodist_tools_python_scripts = \
+       tools/node-cleanup
+
 nodist_tools_SCRIPTS = \
+       $(nodist_tools_python_scripts) \
        tools/vcluster-setup
 
 pkglib_python_scripts = \
@@ -725,12 +745,14 @@ pkglib_python_scripts = \
 
 nodist_pkglib_python_scripts = \
        tools/ensure-dirs \
+       tools/node-daemon-setup \
        tools/prepare-node-join
 
 myexeclib_SCRIPTS = \
        daemons/daemon-util \
        tools/kvm-ifup \
-       $(pkglib_python_scripts)
+       $(pkglib_python_scripts) \
+       htools/mon-collector
 
 nodist_myexeclib_SCRIPTS = \
        $(nodist_pkglib_python_scripts)
@@ -816,7 +838,8 @@ man_MANS = \
        man/hinfo.1 \
        man/hscan.1 \
        man/hspace.1 \
-       man/htools.1
+       man/htools.1 \
+       man/mon-collector.7
 
 manrst = $(patsubst %.1,%.rst,$(patsubst %.7,%.rst,$(patsubst %.8,%.rst,$(man_MANS))))
 manhtml = $(patsubst %.rst,%.html,$(manrst))
@@ -853,6 +876,7 @@ TEST_FILES = \
        htest/shelltests/htools-rapi.test \
        htest/shelltests/htools-single-group.test \
        htest/shelltests/htools-text-backend.test \
+       htest/shelltests/htools-mon-collector.test \
        test/data/bdev-drbd-8.0.txt \
        test/data/bdev-drbd-8.3.txt \
        test/data/bdev-drbd-disk.txt \
@@ -968,6 +992,7 @@ python_tests = \
        test/ganeti.ssh_unittest.py \
        test/ganeti.storage_unittest.py \
        test/ganeti.tools.ensure_dirs_unittest.py \
+       test/ganeti.tools.node_daemon_setup_unittest.py \
        test/ganeti.tools.prepare_node_join_unittest.py \
        test/ganeti.uidpool_unittest.py \
        test/ganeti.utils.algo_unittest.py \
@@ -1007,7 +1032,10 @@ check_SCRIPTS =
 if WANT_HTOOLSTESTS
 nodist_TESTS += $(haskell_tests)
 dist_TESTS += htest/offline-test.sh
-check_SCRIPTS += htest/hpc-htools $(HS_BUILT_TEST_HELPERS)
+check_SCRIPTS += \
+       htest/hpc-htools \
+       htest/hpc-mon-collector \
+       $(HS_BUILT_TEST_HELPERS)
 endif
 
 TESTS = $(dist_TESTS) $(nodist_TESTS)
@@ -1028,6 +1056,7 @@ all_python_code = \
        $(python_scripts) \
        $(pkglib_python_scripts) \
        $(nodist_pkglib_python_scripts) \
+       $(nodist_tools_python_scripts) \
        $(python_tests) \
        $(pkgpython_PYTHON) \
        $(client_PYTHON) \
@@ -1206,7 +1235,7 @@ htools/Ganeti/Version.hs: htools/Ganeti/Version.hs.in \
        sed -e "s/%ver%/$$VCSVER/" < $< > $@
 
 htools/Ganeti/Constants.hs: htools/Ganeti/Constants.hs.in \
-       lib/constants.py lib/_autoconf.py lib/luxi.py \
+       lib/constants.py lib/_autoconf.py lib/luxi.py lib/errors.py \
        $(CONVERT_CONSTANTS) $(built_base_sources) \
        | lib/_vcsversion.py
        set -e; \
@@ -1371,7 +1400,9 @@ daemons/ganeti-%: MODULE = ganeti.server.$(patsubst ganeti-%,%,$(notdir $@))
 daemons/ganeti-watcher: MODULE = ganeti.watcher
 scripts/%: MODULE = ganeti.client.$(subst -,_,$(notdir $@))
 tools/ensure-dirs: MODULE = ganeti.tools.ensure_dirs
+tools/node-daemon-setup: MODULE = ganeti.tools.node_daemon_setup
 tools/prepare-node-join: MODULE = ganeti.tools.prepare_node_join
+tools/node-cleanup: MODULE = ganeti.tools.node_cleanup
 $(HS_BUILT_TEST_HELPERS): TESTROLE = $(patsubst htest/%,%,$@)
 
 $(PYTHON_BOOTSTRAP): Makefile | stamp-directories
@@ -1476,12 +1507,17 @@ check-local: check-dirs $(GENERATED_FILES)
          echo "File $(top_srcdir)/doc/design-$$expver.rst not found"; \
          exit 1; \
        fi; \
-       if test $$(wc --max-line-length < $(top_srcdir)/configure.ac) -gt 80; then \
-         echo 'Longest line in configure.ac is longer than 80 characters' >&2; \
-       fi
+       error= ; \
+       for file in configure.ac $(HS_LIBTEST_SRCS) $(HS_PROG_SRCS); do \
+         if test $$(wc --max-line-length < $(top_srcdir)/$$file) -gt 80; then \
+           echo "Longest line in $$file is longer than 80 characters" >&2; \
+           error=1; \
+         fi; \
+       done; \
+       test -z "$$error"
 
 .PHONY: hs-check
-hs-check: htest/test htest/hpc-htools $(HS_BUILT_TEST_HELPERS)
+hs-check: htest/test htest/hpc-htools htest/hpc-mon-collector $(HS_BUILT_TEST_HELPERS)
        @rm -f test.tix
        ./htest/test
        HBINARY="./htest/hpc-htools" ./htest/offline-test.sh
@@ -1534,6 +1570,7 @@ pep8: $(GENERATED_FILES)
          --repeat $(pep8_python_code)
 
 # FIXME: remove ignore "Use void" when GHC 6.x is deprecated
+HLINT_EXCLUDES = htools/Ganeti/THH.hs htest/hpc-htools.hs
 .PHONY: hlint
 hlint: $(HS_BUILT_SRCS) htools/lint-hints.hs
        @test -n "$(HLINT)" || { echo 'hlint' not found during configure; exit 1; }
@@ -1546,7 +1583,7 @@ hlint: $(HS_BUILT_SRCS) htools/lint-hints.hs
          --ignore "Use &&&" \
          --ignore "Use void" \
          --hint htools/lint-hints \
-         $(filter-out htools/Ganeti/THH.hs,$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS))
+         $(filter-out $(HLINT_EXCLUDES),$(HS_LIBTEST_SRCS) $(HS_PROG_SRCS))
 
 # a dist hook rule for updating the vcs-version file; this is
 # hardcoded due to where it needs to build the file...
@@ -1623,6 +1660,7 @@ endif
 
 .PHONY: py-apidoc
 py-apidoc: epydoc.conf $(RUN_IN_TEMPDIR) $(GENERATED_FILES)
+       env - PATH="$$PATH" PYTHONPATH="$$PYTHONPATH" \
        $(RUN_IN_TEMPDIR) epydoc -v \
          --conf $(CURDIR)/epydoc.conf \
          --output $(CURDIR)/$(APIDOC_PY_DIR)
@@ -1696,12 +1734,12 @@ py-coverage: $(GENERATED_FILES) $(python_tests)
        $(python_tests)
 
 .PHONY: hs-coverage
-hs-coverage: $(haskell_tests) htest/hpc-htools
+hs-coverage: $(haskell_tests) htest/hpc-htools htest/hpc-mon-collector
        rm -f *.tix
        $(MAKE) $(AM_MAKEFLAGS) hs-check
        @mkdir_p@ $(COVERAGE_HS_DIR)
-       hpc combine --union $(HPCEXCL) \
-         test.tix hpc-htools.tix > coverage-htools.tix
+       hpc sum --union $(HPCEXCL) \
+         test.tix hpc-htools.tix hpc-mon-collector.tix > coverage-htools.tix
        hpc markup --destdir=$(COVERAGE_HS_DIR) coverage-htools.tix
        hpc report coverage-htools.tix
        $(LN_S) -f hpc_index.html $(COVERAGE_HS_DIR)/index.html
@@ -1735,7 +1773,7 @@ gitignore-check:
 # Target that builds all binaries (including those that are not
 # rebuilt except when running the tests)
 .PHONY: really-all
-really-all: all $(check_SCRIPTS) $(haskell_tests)
+really-all: all $(check_SCRIPTS) $(haskell_tests) $(HS_ALL_PROGS)
 
 # we don't need the ancient implicit rules:
 %: %,v