Statistics
| Branch: | Tag: | Revision:

root / lib / daemon.py @ d9b67f70

History | View | Annotate | Download (11.1 kB)

# Date Author Comment
5a062513 05/07/2010 02:34 pm Guido Trotter

daemon.GenericMain: fix docstring

The docstring reports a wrong type for the "dirs" argument. Fixing.

Signed-off-by: Guido Trotter <>
Reviewed-by: Balazs Lecz <>

1b429e2a 04/07/2010 04:55 pm Iustin Pop

Fix utils.WaitForFdCondition inner retry loop

Commit dfdc4060 added WaitForFdCondition which uses utils.Retry without
handling timeout exceptions. This breaks any nested retry loops.

This patch fixes the above function, and also changes utils.Retry to
detect and warn future similar cases. In addition, we add a few small...

6ddf5c8f 03/18/2010 01:39 pm Guido Trotter

AsyncUDPSocket.process_next_packet

This function allows receiving socket data synchronously.

Signed-off-by: Guido Trotter <>
Reviewed-by: Michael Hanselmann <>

8216580d 03/18/2010 01:38 pm Guido Trotter

AsyncUDPSocket: abstract do_read function

This basically implements read handling, without catching all
exceptions. When using the socket in synchronous mode, it's useful to
avoid losing exception data (which, in an async daemon, can only be
logged)

Signed-off-by: Guido Trotter <>...

551b6283 01/28/2010 11:43 am Iustin Pop

Add capability to use syslog for logging

This patch adds a configure-time parameter that will set the defaults
used by all programs, and command-line parameters in the daemons that
allow overriding it.

Syslog 'yes' enables syslog in addition to file-based logging, 'only'...

7260cfbe 01/04/2010 11:15 am Iustin Pop

Add targeted pylint disables

This patch should have only:

- pylint disables
- docstring changes
- whitespace changes

Signed-off-by: Iustin Pop <>
Reviewed-by: Olivier Tharan <>

099c52ad 11/03/2009 04:31 pm Iustin Pop

Another round of pylint-related style fixes

A newer version of pylint, more warnings…

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

69b99987 10/12/2009 01:48 pm Michael Hanselmann

Code and docstring style fixes

Found using pylint and epydoc.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Guido Trotter <>

c124045f 09/24/2009 06:12 pm Iustin Pop

Add missing import sys to lib/daemon.py

It does “print >> sys.stderr, …” but there is no import sys.

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

5f3269fc 09/16/2009 03:55 pm Guido Trotter

Abstract AsyncUDPSocket to daemon

This allows this extended asyncore+udp module to be used also in other
daemons, and in the confd client library

Signed-off-by: Guido Trotter <>
Reviewed-by: Michael Hanselmann <>

c8eded0b 09/16/2009 03:55 pm Guido Trotter

AsyncUDPSocket: Move to a well defined UDP size

Currently we read maximum 4K packets, and don't check packets when
sending them. With this patch we move to a well defined maximum size of
60K.

Signed-off-by: Guido Trotter <>
Reviewed-by: Michael Hanselmann <>

5c566e17 08/28/2009 06:35 pm Michael Hanselmann

Merge branch 'next' into branch-2.1

  • next:
    Add script to clean archived jobs after 21 days
    rapi: export more static node information
    Pass the correct signal to handlers
    cli: Use ToStdout/ToStderr instead of print
    Fix small typo in gnt-node
    Simplify handling of boolean args in rapi...
a02b89cf 08/21/2009 01:02 pm Guido Trotter

Reinsert simple timers in Mainloop

This time we use the standard python sched module, rather than doing it
all by ourselves. The scheduler in mainloop can be manipulated directly
by callers, to enter new events.

Signed-off-by: Guido Trotter <>...

112d240d 08/20/2009 05:04 pm Guido Trotter

Convert the http server/mainloop to asyncore

We can avoid most of the Mainloop.Run() code if we use asyncore
for delivering I/O events, and just concentrate on what's missing in
asyncore: singnal handling and timers. This way confd can be ported to
use Mainloop as well....

a9fe7232 08/20/2009 01:42 pm Guido Trotter

Pass the correct signal to handlers

Mainloop currently calls all handlers with the signal number harcoded to
sigchild. Fixing this.

Signed-off-by: Guido Trotter <>
Reviewed-by: Olivier Tharan <>

9b739173 08/20/2009 12:28 pm Guido Trotter

Convert daemon.Mainloop to @SignalHandled

This makes the function a lot simpler, since it used to install two
different signal handlers, which are now transparently handled by the
decorator. The code is unindented, but remains unchanged apart from the
part that checks the signal handlers (which is now collapsed toghether)....

565fe4c4 08/20/2009 11:43 am Guido Trotter

Simplify IO waiting in Mainloop

IO is never unregistered in our current usage, so dropping that
functionality for now. Also putting the poller outside of the Run()
function allows us to avoid the double step of adding tuples to an
_io_wait_add queue and adding them later in the main loop....

577c90a3 08/20/2009 11:43 am Guido Trotter

Remove timers from Mainloop

Timers are currently unused, slightly buggy (for example timeout doesn't
get updated correctly), and unneeded in the current form. Confd will
have timeouts in more simple fashion, and is not a mainloop user
anyway.

Signed-off-by: Guido Trotter <>...

3b1b0cb6 07/26/2009 01:31 pm Guido Trotter

Collapse SSL key checking/overriding for daemons

Signed-off-by: Guido Trotter <>

04ccf5e9 07/25/2009 05:32 pm Guido Trotter

Collapse daemon's main function

With three ganeti daemons, and one or two more coming, the daemon's main
function started becoming too much cut&pasted code. Collapsing most of
it in a daemon.GenericMain function. Some more code could be collapsed
between the two http-based daemons, but since the new daemons won't be...

53d47a06 03/20/2009 03:06 pm Guido Trotter

Mainloop: avoid calculating timeout every time

set timeout_needs_update to False after calculating the timeout.

Reviewed-by: imsnah

b11c9e5c 11/11/2008 01:02 pm Michael Hanselmann

ganeti.daemon: Add timers to Mainloop

This is a fallout from my work on the HTTP client class. Repeating
timers are prepared, but not yet implemented.

Reviewed-by: iustinp

b14b975f 11/10/2008 02:37 pm Michael Hanselmann

ganeti.daemon: Make Mainloop more flexible

While working on the HTTP client class, I wanted to use Mainloop
before deciding to use threads instead.

- Add docstrings
- Rename "quit" to "running", move it to a local variable
- Support adding and removing I/O listeners while running...

54cf6599 10/23/2008 02:58 pm Michael Hanselmann

daemon.py: Don't wake up every second

We don't have timers yet, hence waking up is not needed at all.

Reviewed-by: ultrotter

a570e2a8 10/17/2008 02:08 pm Guido Trotter

Mainloop: handle sigterm

This fixes removals of the pid files and clean exit in the init script

Reviewed-by: iustinp

07fc5289 10/17/2008 02:07 pm Guido Trotter

Mainloop: init sigchld_handler as None

There is no point in initializing sigchld_handler as an empty dict, when
it will be overwritten by an instance of utils.SignalHandler
immediately after.

Reviewed-by: iustinp

821d9e43 10/10/2008 07:00 pm Michael Hanselmann

Add daemon library with mainloop

This mainloop can be used in daemons like ganeti-noded.

Reviewed-by: iustinp