Statistics
| Branch: | Tag: | Revision:

root / htools / Ganeti / Daemon.hs @ daa79414

History | View | Annotate | Download (14 kB)

# Date Author Comment
1a865afe 11/20/2012 12:12 pm Iustin Pop

Properly log errors when setting up daemon FDs

While writing the pipe-based reporting and trying various ways to
break the startup, I fought for a while trying to understand why error
reporting was different when running the daemon as a user (with no
rights). It turns out that setupDaemonFDs wants to open the log file...

551a29df 11/12/2012 06:17 pm Iustin Pop

Merge branch 'devel-2.6' into master

  • devel-2.6:
    Improve error message when migration status fail
    Fix type error in kvm/GetMigrationStatus
    Fix PID file writing in Haskell daemons

Conflicts (both trivial):
htools/Ganeti/Daemon.hs (_writePidFile rename)...

a4c0fe1e 11/12/2012 01:29 pm Iustin Pop

Fix PID file writing in Haskell daemons

Currently, the code uses createFile, which has the effect of always
truncating the file. This is bad, as the content of the PID file is
wiped even when we wouldn't be able to lock it!

We switch to openFd (createFile is just a wrapper over that), and we...

29a30533 11/12/2012 01:21 pm Iustin Pop

Remove unsafePerformIO usage

We need to change a few things, most importantly CLI options defaults,
but otherwise we already used the path to files from functions which
were already in the I/O monad, so we don't have to change much of the
code flow.

Additionally, Path.hs now has an explicit export list, to stop...

48483a2e 11/12/2012 12:02 pm Iustin Pop

Two small logging improvements

The "starting" message is changed to match the Python one, and in case
the preparation fails, we also log the error (beside printing it on
stderr or writing it to the error reporting pipe), as at this time
logging is usually set up....

b9097468 11/12/2012 12:02 pm Iustin Pop

Switch daemon startup to pipe-based error reporting

This changes the daemon reporting error to the same mechanism as in
Python: use a pipe which is written to from the forked children.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

7413b229 11/12/2012 12:02 pm Iustin Pop

Move and rename BasicTypes.annotateIOError

It turns out that annotateIOError already exists in the standard
library, with a different purpose (this made me waste 10 minutes
trying to understand why the types were wrong…). Let's move this out
of BasicTypes, since it's used only in Daemon.hs, and also rename it....

e14b84e9 11/12/2012 12:02 pm Iustin Pop

Switch writing of PID file to new reporting style

Currently, the writing of the PID file uses a "standard" error
reporting: catch exception, transform it into a 'Result' type, leave
handling of that to the caller. However, for daemon startup, we
actually want exceptions to be propagated up until the handler which...

2ac2e420 11/07/2012 05:58 pm Iustin Pop

Implement base checkFn/prepFn/execFn model for daemons

This mirrors the code in the Python code base, and is required for
clean error reporting during startup.

This patch implements the basic infrastructure; the confd daemon is
not yet modified to take advantage of this, just the types are...

b9612abb 11/07/2012 03:06 pm Iustin Pop

Merge branch 'devel-2.6' into submit

  • devel-2.6:
    Fix compatibility with newer Haskell libraries
    Fix gnt-instance console with xl

Conflicts:
Makefile.am (reordering, fixed)
htools/Ganeti/Confd/Server.hs (hlint fixes on master)
htools/Ganeti/Daemon.hs (hlint)...

1251817b 11/07/2012 10:46 am Iustin Pop

Fix compatibility with newer Haskell libraries

This small patch fixes compatibility with a few newer Haskell libraries:

- base 4.6, included with ghc 7.6, removed the deprecated 'catch'
function from Prelude, so our "import Prelude hiding (catch)" is now...

ecebe9f6 10/08/2012 02:07 pm Iustin Pop

Split the OptComplNumeric into integer/float ones

This allows the command completion to treat them as separate option
types; this is not useful in build-bash-completion right now, but
might become so in the future.

Signed-off-by: Iustin Pop <>...

22278fa7 10/08/2012 02:06 pm Iustin Pop

Define the actual arguments that are supported by programs

This defines the arguments supported and then modifies the
--help-completion output to include them too.

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

26d62e4c 10/08/2012 12:35 pm Iustin Pop

Rename Ganeti/HTools/Utils.hs to Ganeti/Utils.hs

This is, I believe, the last non-htools specific file that still lived
in the htools directory; it's already widely used in non-htools code,
so let's move it before we add more functionality to this module....

42834645 09/26/2012 02:18 pm Iustin Pop

Remove generic options from individual programs

Currently, we test and require that each individual program (hbal,
etc.) defines/supports the generic options (currently --help and
--version). Even with the test, this is not optimal, since it requires
changes in many places whenever we modify the list of generic options,...

ce207617 09/26/2012 02:18 pm Iustin Pop

Annotate options with completion information

This is a quite boring patch, just adding annotation information to
all existing options. Some of the annotations are not very good; but
we don't have support for more precise completion in
build-bash-completion, so this is good enough....

097ad7ee 09/26/2012 02:18 pm Iustin Pop

Add option for displaying completion information

This patch adds support for a --help-completion option, which will
display the defined options and their completion information, in a
format designed to be parsed easily from Python, for integration into
build-bash-completion....

51000365 09/05/2012 05:31 pm Iustin Pop

Rework CLI modules and tests

While investigating how we could test the Daemon.hs module, I realised
that we have a very, erm, sub-optimal situation:

- HTools/CLI.hs has a nice IO/pure separation testing in cmdline
parsing, which allows some basic functionality to be tested, but...

5b11f8db 09/05/2012 05:31 pm Iustin Pop

Further hlint fixes

Commit 2cdaf22, “Re-enable standard hlint warnings”, got it almost
right. The only problem is that (confusingly) the default set of hints
is not in HLint.Default, but in HLint.HLint (it includes Default and
some built-ins).

After changing the lint file to correctly include the defaults, we had...

2997cb0a 09/05/2012 03:33 pm Iustin Pop

Move Version.hs up from under HTools/

This is another module that is generic, and not htools-specific.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

0d0ac025 09/03/2012 03:13 pm Iustin Pop

Cleanup query socket before attempting to bind

This patch adds a simple function to ensure a socket doesn't exist
before binding to it. Additionally, we cleanup the exports of
Queryd.hs.

Signed-off-by: Iustin Pop <>
Reviewed-by: Agata Murawska <>

2cdaf225 08/28/2012 05:59 pm Iustin Pop

Re-enable standard hlint warnings

Commit 5a1e31b4 (Add infrastructure for, and two extra hlint rules)
was intended to add two extra hlint rules, but I didn't realise at
that time that "--hint" when first used overrides the built-in
lints. As such, since then we were basically running with just those...

36691f08 05/29/2012 12:09 pm Iustin Pop

Add support for SIGHUP handling in Haskell daemons

This patch adds support for handling SIGHUP and reopening the
stdout/stderr logfile in daemon mode (but not in foreground mode).

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

0c28bee1 05/29/2012 12:09 pm Iustin Pop

Rework logging setup for Haskell daemons

This fixes a missing functionality: closing of stdout/stderr when
forking daemons. Without this, starting the daemons from the command
line seems to work, but doing it from utils.RunCmd breaks, since
without closing the standard descriptors, RunCmd never finishes....

79ac58fa 05/01/2012 08:11 pm Iustin Pop

Further fixes for new-style exception handling

Commit 30d25dd8 moved the htools code to new-style exception handling,
but the hconfd code hasn't been, which fails when compiling on newer
GHC versions.

This patch does the rest of the move; however, the situation is not...

88a10df5 03/22/2012 07:30 pm Iustin Pop

Rework exit model

While updating the confd code, I realised that we have lots of
duplication in the exit model for the various programs.

So this patch attempts to abstract all the exits via a couple of new
functions; sorry for the somewhat big patch, but I hope the payoff is...

b714ff89 03/22/2012 03:58 pm Iustin Pop

Add command line option for controlling syslog use

… and enable it in hconfd.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

a6e2a138 03/22/2012 03:58 pm Iustin Pop

Add support for syslog logging to Ganeti.Logging

Currently this is initialised to no from Daemon.hs, but will in the
future allow command-line options for controlling it.

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

152e05e1 03/21/2012 12:25 am Iustin Pop

Add the bind-address option

This implements the same logic as the Python code: if the option is
not used, use the default appropriate for the cluster, otherwise try
to parse and use whatever was passed in.

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>

e6812a1a 03/19/2012 12:00 pm Iustin Pop

htools: fix long version of --port for daemons

The dashes do not need to be in, if they are then the resulting option
is:

-p PORT  ----port=PORT     Network port (default: 1814)

Signed-off-by: Iustin Pop <>
Reviewed-by: René Nussbaumer <>

6ec7a50e 03/13/2012 02:48 pm Iustin Pop

htools: add basic daemon-related functionality

This is not complete for now, just the basic functionality has been
implemented:

- daemonize
- check we're running under the correct user
- call setup logging

Signed-off-by: Iustin Pop <>
Reviewed-by: Guido Trotter <>