History | View | Annotate | Download (24.4 kB)
Add FileLock utility class
This class is a wrapper around fcntl.flock and abstracts opening andclosing the lockfile. It'll used for the job queue.
(The patch also removes a duplicate import of tempfile into the unittest)
Reviewed-by: iustinp
Expose utils.DaemonPidFileName
Since we need to compute this from outside utils.py, we change this to apublic function.
Reviewed-by: ultrotter
Add a KillProcess function
We cannot depend on all environments to have a start-stop-daemon orsimilar tool. We instead implement a KillProcess function that behavessimilar to “start-stop-daemon --retry”.
Note that the attached unittest can hang in foreground if the child...
Change IsPidFileAlive into ReadPidFile
We already have a function to test if a PID is alive, so it makes moresense to use function composition that force calling (since we need toread PIDs from files in other places too). Now IsProcessAlive returnsFalse for PIDs <= 0, since this is the error return from ReadPidFile....
Add utils unittests for new functions
The submitted WritePidFile, RemovePidfile and IsPidFileAlive functionsmiss unit tests. Adding a simple one which covers their basicfunctionality.
Fix utils.py unittest
Reviewed-by: imsnah
Remove the old locking functions
This removes (hopefully) all traces of the old locking functions anduses.
Add a FirstFree function to utils.py
This function will return the first unused integer based on a list ofused integers (e.g. [0, 1, 3] will return 2).
Fix the zombie process unittest
The failure is because in high load, the parent gets to run before thechild has the chance to os._exit(), and therefore it is still runningwhen the parent does the check.
The fix removes the chance of this happening by waiting to receive a SIGCHLD...
Make testSignal unittest not depend on default shell
This patch changes the code executed when testing the signal handlingof RunCmd. Since sh does not always point to bash (e.g. on Ubuntu,where it points to /bin/dash) this test might fail due to the returned...
Modify utils.TcpPing to make source address optional
This patch modifies TcpPing and its callers to make the source addressselection optional. Usually, the kernel will know better whatsource address to use, just in some cases we want to enforce a given...
Split GanetiUnitTest into testutils.py
Fix the unittest for locking.
Make sure aliases written to /etc/hosts are unique.
Add function to return list with unique elements.
Fix typo in function name.
Reviewed-by: schreiberal
Use setUp/tearDown for tests using temporary files.
Wrap line longer than 80 characters.
Compare file contents directly in unittests.
Reviewed-by: schreiberal, ultrotter
Fix unittests broken by revision 360.
Fix functions for /etc/hosts.
- Combine hostname and aliases on one line- Fix bug with wrongfully removed newline characters- Use wrapper for SetEtcHostsEntry in cmdlib
Reviewed-by: iustin
Rollback commit 356.
Add functions for known_hosts files.
Reviewed-by: TODO
Add functions to modify /etc/hosts.
Rename utils.GetUUID to utils.NewUUID.
Use the kernel's ability to generate UUIDs.
This removes the dependency on either the uuid module or e2fsprogs' uuidgen.
Remove fping as a dependency for Ganeti.
This patch completely gets rid of fping - replace all fping invocations with TcpPing calls - update documentation accordingly. - associated cleanups (use constant for localhost IP, use more sensible defaults for TcpPing and use those)...
Add function to list files in a directory, excluding those beginning with adot.
Cleanup up selective imports for utils and utils unit test.
Reviewed-by: iustinp, imsnah
Added TcpPing to do ping-alike via TCP connect(2) with defined source address.To be used to replace the currently fping(8) based reachability test.
Fix typo in last commit.