Statistics
| Branch: | Tag: | Revision:

root / lib / daemon.py @ 7e1fac25

History | View | Annotate | Download (10.1 kB)

# Date Author Comment
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