History | View | Annotate | Download (10.1 kB)
Add targeted pylint disables
This patch should have only:
- pylint disables- docstring changes- whitespace changes
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Olivier Tharan <olive@google.com>
Another round of pylint-related style fixes
A newer version of pylint, more warnings…
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
Code and docstring style fixes
Found using pylint and epydoc.
Signed-off-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Add missing import sys to lib/daemon.py
It does “print >> sys.stderr, …” but there is no import sys.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>Reviewed-by: Guido Trotter <ultrotter@google.com>
Abstract AsyncUDPSocket to daemon
This allows this extended asyncore+udp module to be used also in otherdaemons, and in the confd client library
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Michael Hanselmann <hansmi@google.com>
AsyncUDPSocket: Move to a well defined UDP size
Currently we read maximum 4K packets, and don't check packets whensending them. With this patch we move to a well defined maximum size of60K.
Merge branch 'next' into branch-2.1
Reinsert simple timers in Mainloop
This time we use the standard python sched module, rather than doing itall by ourselves. The scheduler in mainloop can be manipulated directlyby callers, to enter new events.
Signed-off-by: Guido Trotter <ultrotter@google.com>...
Convert the http server/mainloop to asyncore
We can avoid most of the Mainloop.Run() code if we use asyncorefor delivering I/O events, and just concentrate on what's missing inasyncore: singnal handling and timers. This way confd can be ported touse Mainloop as well....
Pass the correct signal to handlers
Mainloop currently calls all handlers with the signal number harcoded tosigchild. Fixing this.
Signed-off-by: Guido Trotter <ultrotter@google.com>Reviewed-by: Olivier Tharan <olive@google.com>
Convert daemon.Mainloop to @SignalHandled
This makes the function a lot simpler, since it used to install twodifferent signal handlers, which are now transparently handled by thedecorator. The code is unindented, but remains unchanged apart from thepart that checks the signal handlers (which is now collapsed toghether)....
Simplify IO waiting in Mainloop
IO is never unregistered in our current usage, so dropping thatfunctionality 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....
Remove timers from Mainloop
Timers are currently unused, slightly buggy (for example timeout doesn'tget updated correctly), and unneeded in the current form. Confd willhave timeouts in more simple fashion, and is not a mainloop useranyway.
Collapse SSL key checking/overriding for daemons
Signed-off-by: Guido Trotter <ultrotter@google.com>
Collapse daemon's main function
With three ganeti daemons, and one or two more coming, the daemon's mainfunction started becoming too much cut&pasted code. Collapsing most ofit in a daemon.GenericMain function. Some more code could be collapsedbetween the two http-based daemons, but since the new daemons won't be...
Mainloop: avoid calculating timeout every time
set timeout_needs_update to False after calculating the timeout.
Reviewed-by: imsnah
ganeti.daemon: Add timers to Mainloop
This is a fallout from my work on the HTTP client class. Repeatingtimers are prepared, but not yet implemented.
Reviewed-by: iustinp
ganeti.daemon: Make Mainloop more flexible
While working on the HTTP client class, I wanted to use Mainloopbefore 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...
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
Mainloop: handle sigterm
This fixes removals of the pid files and clean exit in the init script
Mainloop: init sigchld_handler as None
There is no point in initializing sigchld_handler as an empty dict, whenit will be overwritten by an instance of utils.SignalHandlerimmediately after.
Add daemon library with mainloop
This mainloop can be used in daemons like ganeti-noded.