- Jan 21, 2011
-
-
René Nussbaumer authored
This patch renames QRFS_* to RS_* fields so they can be used in other places (i.e. LUs) without confusion, as this was initially meant for query operations. Signed-off-by:
René Nussbaumer <rn@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Jan 06, 2011
-
-
Michael Hanselmann authored
Locks can now be queried using “Query(what="lock", …)” over LUXI. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Dec 06, 2010
-
-
Guido Trotter authored
This also changes masterd to initialize the ganeti's manager with the current list of nodegroup uuids, and updates unittests Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Oct 28, 2010
-
-
Guido Trotter authored
The nodes and instances parameters to the constructor are mandatory anyway, as a value of None will fail when creating the LockSet. Rather than fixing this adding code lines, since we never used the default value, let's remove them and require that the parameters are passed. This also fixes the only places where we inited GanetiLockManager with keyed parameters and without arguments. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Guido Trotter authored
Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Sep 07, 2010
-
-
Michael Hanselmann authored
For proper support of job priorities, jobs' locks need to respect priorities. Otherwise it could happen that a job with a lower priority could get a lock before a job with a higher priority (depending on timeouts and when they start acquiring). This patch adds support for priorities in SharedLock and LockSet and provides (unfortunately non-trivial) unittests. Outdated comments are also adjusted and improved. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Aug 27, 2010
-
-
Michael Hanselmann authored
This is accomplished by keeping a list of waiting threads instead of just their number inside the lock-internal condition. A few other tweaks to the output format are also made. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Aug 24, 2010
-
-
Michael Hanselmann authored
While writing unittests for the new lock monitor, I made a small mistake and didn't synchronize acquiring locks properly. This patch takes care of this issue by adding additional synchronization. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
This patch adds an initial implementation of a lock monitor, accessible for the user through “gnt-debug locks”. It currently shows all resource locks: BGL, nodes and instances. Config and job queue locks could be shown too, but wouldn't be of much help. The current owner(s) and mode are also shown. Showing pending acquires will require further changes on the SharedLock internals and is not yet implemented. Example output: $ gnt-debug locks -o name,mode,owner Name Mode Owner BGL/BGL shared JobQueue19/Job147 instances/inst1 exclusive JobQueue19/Job147 instances/inst2 - - instances/inst3 - - instances/inst4 - - nodes/node1 exclusive JobQueue19/Job147 nodes/node2 exclusive JobQueue19/Job147 Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Jul 16, 2010
-
-
Iustin Pop authored
This patch adds lock names to SharedLocks and LockSets, that can be used later for displaying the actual locks being held/used in places where we only have the lock, and not the entire context of the locking operation. Since I realized that the production code doesn't call LockSet with the proper members= syntax, but directly as positional parameters, I've converted this (and the arguments to GlobalLockManager) into positional arguments. Signed-off-by:
Iustin Pop <iustin@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Jun 30, 2010
-
-
Manuel Franceschini authored
Signed-off-by:
Manuel Franceschini <livewire@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Jun 10, 2010
-
-
Guido Trotter authored
Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Guido Trotter authored
If a shared lock is used inside a condition, we need to make sure that it's reacquired in the same way as it was originally, after the wait. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
- Jan 15, 2010
-
-
Michael Hanselmann authored
Every once in a while we saw failures in the locking unittest, but weren't able to determine the cause. This patch fixes it by using threading.Event instead of plain threading.Condition to notify another thread. In most cases, threading.Condition must be used with another variable to keep the actual state. threading.Event does this for us. Otherwise it can happen that the waiter only gets the lock after condition was notified. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Nov 03, 2009
-
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Oct 13, 2009
-
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Oct 12, 2009
-
-
Michael Hanselmann authored
The timeout passed to LockSet.acquire() is measured over all lock acquires. If LockSet.acquire fails to acquire all requested locks within the specified amount of time, all locks are released again and the acquire fails. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Oct 02, 2009
-
-
Michael Hanselmann authored
Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
There were more race conditions. By adding a notify function to SharedLock.acquire we can prevent them. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
- Oct 01, 2009
-
-
Guido Trotter authored
With this patch we simplify usage on the SingleActionCondition (which wasn't a condition at all) by making it a real condition. This way we can just wait() on it, or notifyAll() as we would on a normal one. The only catch is that notifyAll can be called only once, and wait can only be called before notifyAll has, but luckily our PipeCondition, now quite simplified, takes care of this, by providing a new SingleActionCondition each time the previous one has been notified. No Start/StopUsing function are needed anymore, and thus the condition is a lot more robust, and there's no way file descriptors can be left open, as they are closed in a finally block, in the same function where they were opened, by the last thread exiting the class. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Guido Trotter authored
Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Guido Trotter authored
This way they can be used to test different condition classes. Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Guido Trotter authored
All (ok, all but one) _ThreadedTestCase users have a done Queue, so we move its building in the _ThreadedTestCase setUp Signed-off-by:
Guido Trotter <ultrotter@google.com> Reviewed-by:
Michael Hanselmann <hansmi@google.com>
-
Michael Hanselmann authored
SharedLock.__acquire_unlocked uses keyword parameters. Just passing the timeout would set the “shared” parameter. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Also remove the “blocking” parameter from LockSet.remove and GanetiLockManager.remove. There's no point in implementing timeouts on removal unless we need them. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Iustin Pop <iustin@google.com>
-
Michael Hanselmann authored
Our automated test system found a few problems in the new locking unittests. This patch should fix them, although I wasn't able to reproduce the problem. All are race conditions. Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Sep 30, 2009
-
-
Michael Hanselmann authored
_PipeCondition is a condition implemented using pipe(2) and poll(2). It allows the implementation of timeouts without using a busy-wait loop with time.sleep. Unlike Python's built-in threading.Condition class and to save file descriptors and an internal queue, it can only be used to notify all waiters. Ganeti's use case for this condition class doesn't require the ability to notify only one waiter. Signed-off-by:
Guido Trotter <ultrotter@google.com> Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michael Hanselmann authored
This class will be used as a basic block for pipe(2)-based conditions. Upon initialization it creates a pipe and can be notified once (hence the “single action” in the name). A callable helper class is used to wait for notifications. Signed-off-by:
Guido Trotter <ultrotter@google.com> Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
Michael Hanselmann authored
This patch greatly simplifies the SharedLock code and implements timeouts for the acquire() and delete() functions. A wrapper around Python's threading.Condition class must be used to ensure thread safety when check whether there are any waiters left. Signed-off-by:
Guido Trotter <ultrotter@google.com> Signed-off-by:
Michael Hanselmann <hansmi@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
-
- Nov 18, 2008
-
-
Iustin Pop authored
The waiting sharer blocks exclusive is another not-possible to test right now. Sorry for missing it the first time; there are no other testWaiting... tests. Reviewed-by: ultrotter
-
Iustin Pop authored
Until we have a way to properly test this, we'll skip the test. Reviewed-by: imsnah
-
- Nov 12, 2008
-
-
Iustin Pop authored
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 the operations logically and expect that they execute as such. In case of not so, they will timeout with a big (60s) timeout. The 'never happen' is tested by multiple repetitions of the same test - this is not perfect, but again 'X will never happen' is not actually testable. This patch reduces the runtime of the tests from ~5.4 to ~0.8 seconds (with 8 repetitions of each test thas has 'never happen' situations). Reviewed-by: imsnah
-
- Sep 11, 2008
-
-
Guido Trotter authored
This patch bans add() on a half-acquired set. This behavior was previously possible, but created a deadlock if someone tried to acquire the set-lock in the meantime, and thus is now forbidden. The testAddRemove unit test is fixed for this new behavior, and includes a few more lines of testing and a new testConcurrentSetLockAdd function tests its behavior in the concurrent case. Reviewed-by: imsnah
-
Guido Trotter authored
If the set-lock is acquired, currently, the _names function will fail on a double acquire of a non-recursive lock. This patch fixes the behavior, and some lines of code added to the testAcquireSetLock test check that this and other functioins behave properly. Reviewed-by: imsnah
-
- Aug 18, 2008
-
-
Guido Trotter authored
A few more tests written while bug-hunting. One of them shows a real issue, at last. :) Reviewed-by: imsnah
-
Guido Trotter authored
I was hunting for a bug in my code and thought the culprit was in the locking library, so I added a test to check. Unfortunately turns out it wasn't. :( Committing the test anyway, while still trying to figure out what's wrong... Reviewed-by: imsnah
-
- Jul 23, 2008
-
-
Guido Trotter authored
An implementation mistake from the original design caused nodes to be locked before instances, rather than after. This patch inverts the level numbering, changing also the relevant unittests and the recursive locking function starting point. Reviewed-by: iustinp
-
- Jul 08, 2008
-
-
Guido Trotter authored
This is to discourage even more whoever may think that this requirement is not really useful and can be lifted, and to at least know where it's used before trying to break it. Reviewed-by: imsnah
-
Guido Trotter authored
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 one monitor that everything is as we expect it to be. Reviewed-by: imsnah
-
Guido Trotter authored
Since the ConfigWriter now handles its own locking it's not necessary to have a specific level for the config in the Locking Manager anymore. This patch thus removes it, and all the unittest calls that used it, or depended on it being present. Reviewed-by: iustinp
-