Rename all HTTP classes to camel case
It should be consistent.
Reviewed-by: amishchenko
ganeti.http: Remove ApacheLogfile class
We don't need it anymore and it wouldn't work as it is, anyway.
Reviewed-by: ultrotter
Fix hooks_unittest with new rpc call structure
Reviewed-by: iustinp
RAPI:Fix root list and unittest for it.
Reviewed-by: imsnah
Enable auto-unit formatting in script output
This patch enables by default the old 'human-readable' option, but in aslightly different model.
The option is now called "units" and takes either: - 'h' for automatic formatting - 'm', 'g' or 't' for mebi/gibi/tebibytes...
Move FieldSet class to utils.py
Since we can use the FieldSet class in cli.py to nicely format disksizes and such, we move it to utils.py and also move its associatedunittest. I didn't remove the cmdlib.py unittest file as that's not thegood direction :)...
Skip another testWaitingXblocksY
The waiting sharer blocks exclusive is another not-possible to testright now.
Sorry for missing it the first time; there are no other testWaiting...tests.
Add a FieldSet class for variable parameter sets
This patch adds a _FieldSet class that can be used for the new variableparameter sets: e.g. the sda_size will change to disk/0.size (orsimilar) and we need to both check validity and extract the index of the...
Skip the waitingExclusiveBlockSharer test
Until we have a way to properly test this, we'll skip the test.
Convert the locking unittests to repetition-test
Currently the locking tests are using timeouts to ensure an event will'never happen'. However, this is suboptimal.
The patch converts all of these to instead: not wait, but sequence theoperations logically and expect that they execute as such. In case of...
Remove zombie special case from IsProcessAlive
Based on the discussion on the mailing list, we remove the specialcasing of zombie processes.
Note we don't use kill -0 since that has a different meaning than "checkprocess is alive", so this function is still linux-specific....
Add cleanup of processes to utils.KillProcess
In case the process we want to signal is our own process, and the signalwe send is a deadly one, we should also cleanup after the process.
This patch adds a new parameter waitpid to this function that does this,...
Implement working directory for utils.RunCmd
In order to replace usage of the shell just for 'cd %s; ...' we need tobe able to specify the working directory for childs.
The patch also changes the default working directory (when notspecified) to "/", as opposed to the current dir; since the daemos run...
Modify utils.RunCmd to write output to file
Currently we launch processes via the shell in a few places only toredirect standard output and error to a log file ("&> $file"). It isbetter to do such redirection from within RunCmd itself.
This patch splits RunCmd in two parts, the setup and the execution part,...
Move some LU logging to use proc.Log*
We change some messages which are obviously intended for the user to usethe proc.Log* functions instead of (only) the logging ones.
We also fix some wrong uses of feedback_fn.
Generalize the reading of test file data
Currently we have two methods in ganeti.bdev_unittest.py of computingthe test data file name - and, of course, they don't give the sameresults.
The patch moves the functions to compute the test file name and reading...
Set default hypervisor at cluster init
During cluster init, set the default hypervisor to be used for instances.Ensure that the default hypervisor belongs to the set enabled hypervisorsfor this cluster. Also fix a small bug with setting the default enabled...
Convert cli.py to logging
We also add two function for printing messages, so that scripts won'thave to import logger to get these. They are a simple extension over thelogger ones, as they accept the call style from logging: ToStdout("Message: %s", msg)...
Remove old HTTP server code
All users of this code have been migrated to the new and shiny HttpServerclass.
It also fixes a typo in the ApacheLogfile unittests. It has not yet beendecided whether we should keep ApacheLogfile or not, hence leaving it in....
Fix remote API unittest
I broke it with rev 1864. This patch also removes whitespace atline endings.
Really fix with the zombie test (hopefully)
So, instead of any timeouts for synchronization, we move to actualevents. We still have one (huge) timeout for pathological cases (just tocleanup), but we don't sleep at all in normal usage.
The patch moves the zombie/cleaned up child creation out from setUp(),...
Implement parameter removal in SplitKeyVal
This patch adds paramter removal in SplitKeyVal, by prefixing avalue-less key with "-"; this is needed in resetting parameters back tocluster defaults, but care must be applied now that None can come fromthe parser....
Add two new options types for CLI usage
For the new 2.0-style command line options, we need to parse strings ofthe type: ident:key=val[,...]and key=val[,...]
This patch adds two new option builders for these two, which return(ident, {key=val,}) and {key=val,} for the above two formats. It also...
Abstract checking own address into a function
Currently, we check if we have a given ip address (i.e. it's alive onone of our interfaces) but manually calling TcpPing(source=localhost).This works, but having it spread all over the code makes it hard to...
Convert rpc module to RpcRunner
This big patch changes the call model used in internode-rpc fromstandalong function calls in the rpc module to via a RpcRunner class,that holds all the methods. This can be used in the future to enablesmarter processing in the RPC layer itself (some quick examples are not...
Ajust config unittest.
Add a simple timespec parsing function
This function will be used for auto-archiving jobs via the command line.The function is pretty simple, we only support up to weeks since monthsand higher are not 'precise' entities, and dealing with them wouldrequire us to start using calendar functions....
Get rid of ssconf
Remove leftovers from ssconf.
Convert ssh.py
Get rid of ssconf and convert to configuration instead.
Convert mcpu.py
Replacing ssconf with configuration.
Fix unittests broken by revision 1727
Add cluster options from ssconf to configuration
ssconf will become write-only from ganeti-masterd's point of view,therefore all settings in there need to go into the main configurationfile.
Move instantiation of config into bootstrap.py
Future patches will add even more variables to the cluster config.Adding more parameters wouldn't make the function easier to use andit doesn't make sense to pass them to another function, as it'sonly done once in bootstrap.py on cluster initialization....
LockSet: forbid add() on a partially owned set
This patch bans add() on a half-acquired set. This behavior waspreviously possible, but created a deadlock if someone tried to acquirethe set-lock in the meantime, and thus is now forbidden. ThetestAddRemove unit test is fixed for this new behavior, and includes a...
Fix LockSet._names() to work with the set-lock
If the set-lock is acquired, currently, the _names function will fail ona double acquire of a non-recursive lock. This patch fixes the behavior,and some lines of code added to the testAcquireSetLock test check that...
utils.SplitTime: More rounding fixes
SplitTime didn't round the same on different platforms. This patch changesit to use microseconds and not care about rounding.
utils.SplitTime: Fix rounding of milliseconds
Reported by Iustin.
It used to return this:
utils.SplitTime(1234.999999999999)
(1234, 1000)
while it should've returned this:
(1235, 0)
A few more locking unit tests
A few more tests written while bug-hunting. One of them shows a realissue, at last. :)
Add lock-all-through-GLM unit test
I was hunting for a bug in my code and thought the culprit was in thelocking library, so I added a test to check. Unfortunately turns out itwasn't. :( Committing the test anyway, while still trying to figure outwhat's wrong......
Add functions to split time into tuple and merge it back
These will be used for job logs.
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)
First write operation (add tag) for Ganeti RAPI
Add instance tag handling, improved error logging....oh, yes adopt instance listing for RAPI2!
Expose utils.DaemonPidFileName
Since we need to compute this from outside utils.py, we change this to apublic function.
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....
Fix unittests for ganeti-rapi
The RESTHTTPServer module went the way of the dodo.
Switch RAPI to ganeti.http module
Add utils unittests for new functions
The submitted WritePidFile, RemovePidfile and IsPidFileAlive functionsmiss unit tests. Adding a simple one which covers their basicfunctionality.
Invert nodes/instances locking order
An implementation mistake from the original design caused nodes to belocked before instances, rather than after. This patch inverts the levelnumbering, changing also the relevant unittests and the recursivelocking function starting point....
Split RAPI resources to pieces
Copy the rest of the Restful-API files to trunk
Fix utils.py unittest
Remove the old locking functions
This removes (hopefully) all traces of the old locking functions anduses.
Add a more comment lines to testLockingConstants
This is to discourage even more whoever may think that this requirementis not really useful and can be lifted, and to at least know where it'sused before trying to break it.
Add a new LockSet unittest
This test checks the LockSet behaviour when an empty list is passed.The current behaviour is expected, but since this is a corner case,we're safer to keep it under a check, and if we need a different onemonitor that everything is as we expect it to be....
Pass context to LUs
Rather than passing a ConfigWriter to the LUs we'll pass the wholecontext, from which a ConfigWriter can be extracted, but we can alsoaccess the GanetiLockManager. This also fixes the places where a FakeLUis created.
mocks: create a FakeContext object
This will be passed to FakeLUs
Locking: remove LEVEL_CONFIG lockset
Since the ConfigWriter now handles its own locking it's not necessary tohave a specific level for the config in the Locking Manager anymore.This patch thus removes it, and all the unittest calls that used it, ordepended on it being present....
Locking: add ssynchronized decorator
This patch creates a new decorator function ssynchronized in the lockinglibrary, which takes as input a SharedLock, and synchronizes access tothe decorated functions using it. The usual SharedLock semantics apply,so it's possible to call more than one synchronized function at the same...
Add generic worker pool implementation
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).
Remove duplicate code in hooks unittests
All the tests there used to creare a cfg, a sstore, an opcode and a LU.Put all the duplicate code in the setUp function.
Add unittests for ganeti.serializer
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...
Add functions to calculate version number to constants.py
In cfgupgrade, we need to extract parts of and build new version numbers.
Use a single Makefile.am instead of many
This change allows us to use cleaner dependencies betweendirectories. The build system is basically rewritten in large partsand may contain bugs.
Fix bdev unittest when run under distcheck
The path to the filename for drbd8 proc data is not correctly computedwhen using distcheck. The patch duplicates it from the other drbd tests.
Rework the DRBD8 device status computation
Currently, compute the status of a drbd8 device in GetSyncStatus andreturn only the values that we need (and fit in the framework ofGetSyncStatus). However, the full status details are useful (and needed)in other places, so the patch attempts to improve this situation....
Add unittest for constants
locking: remove obsolete comment
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...
Add function to write cluster SSH key to known_hosts file
The whole Ganeti cluster has a single SSH key. Its fingerprint iswritten to Ganeti's known_hosts file, together with an alias. Thisallows us to always use that alias instead of the real hostname,...
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...
LockSet: handle empty case
A LockSet is mostly useful when it has some locks in it. On the other handthere are cases in which it must function even when empty. For example if acluster has no instances in it there's no reason why locking all of themshouldn't work anyway. This patch adds test code for that situation and...
LockSet: add missing check code
This check that no operation had been performed before release() was missing inthe test code. Adding it.
Codestyle updates for locking code
LockSet: make acquire() able to get the whole set
This new functionality makes it possible to acquire a whole set, by passing"None" to the acquire() function as the list of elements. This will avoid newadditions to the set, and then acquire all the current elements. The list of...
LockSet: improve remove() api
Lockset's remove() function used to return a list of locks we failed to remove.Rather than doing this we'll return a list of removed locks, so it's moresimilar to how acquire() behaves. This patch also fixes the relevant unit tests....
LockSet: make acquire() return the set of names
In a LockSet acquire() returned True on success. This code changes that toreturn a set containing the names of the elements acquired. This is still atrue value if we acquired any lock but is slightly more useful (because if...
Initial GanetiLockManager implementation
Includes some locking-related constants and explanations on how theLockManager should be used, the class itself and its test cases.
The class includes: - a basic constructor - functions to acquire and release lists of locks at the same level...
LockSet implementation and unit tests
A LockSet represents locking for a set of resources of the same type. A threadcan acquire multiple resources at the same time, and release some or all ofthem, but cannot acquire more resources incrementally at different times...
Split GanetiUnitTest into testutils.py
Add a few SharedLock delete() tests
- Check that even a shared acquire() fails on a deleted lock- Check that delete() fails on a lock you share (must own it or nothing)
These are assumptions I build on in future code, so better check for them.Currently no code change is necessary for them to be valid....
SharedLock: fix a wrong unit-test helper code
The _doItDelete helper code was supposed to be used to dispatch threads thatdeleted the SharedLock. It actually just acquired it exclusively. This remainedunnoticed as the helper thread is just used to test interaction, not the delete...
Add the delete() operation to SharedLock
This new operation lets a lock be cleanly deleted. The lock will be exclusivelyheld before deletion, and after it pending and future acquires will raise anexception. Other SharedLock operations are modify to deal with delete() and to...
Fix a couple of SharedLock docstrings
Use the actual class name rather than a spaced version of it.
Shared Lock implementation and unit tests.
Adding a locking.py file for the ganeti locking library. Its first component isthe implementation of a non-recursive blocking shared lock complete with atesting library.
Reviewed-by: imsnah, iustinp
Fix the make dist rule
In revision 459 I added a bug in the make dist rule in the sense thatthe archive will include all of test/data directory, including the.svn directory if it exists.
This patch fixes that problem and adds a distcheck hook that tests for...
Fix ‘make distcheck’ breakage introduced in r455
This patch fixes the ‘make distcheck’ breakage caused by missing test data inthe archive and missing handling of builddir!=srcdir case.
Reviewed-by: schreiberal
Add unittest for DRBD8 drdbsetup show parser
This patch changes the bdev.DRBD8._GetDevInfo to take a string insteadof a minor, separates the `drbdsetup show` invocation into a newseparate method (bdev.DRBD8._GetShowData) and modifies the rest of theDRBD8 class to make the appropriate calls....
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.
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.