...so that owners can request their locks to granted when ready instead of having to rely on polling. This will, in particular, be important for high-priority jobs as it makes sure they get their locks earlier.
Signed-off-by: Klaus Aehlig <[email protected]> --- src/Ganeti/WConfd/Core.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Ganeti/WConfd/Core.hs b/src/Ganeti/WConfd/Core.hs index c8574db..faa8c9e 100644 --- a/src/Ganeti/WConfd/Core.hs +++ b/src/Ganeti/WConfd/Core.hs @@ -189,6 +189,16 @@ tryUpdateLocks cid req = . (>>= toErrorStr) $ modifyLockWaiting (LW.updateLocks cid (fromGanetiLockRequest req)) +-- | Try to update the locks of a given owner and make that a pending +-- request if not immediately possible. +updateLocksWaiting :: ClientId -> Integer + -> GanetiLockRequest -> WConfdMonad [ClientId] +updateLocksWaiting cid prio req = + liftM S.toList + . (>>= toErrorStr) + . modifyLockWaiting + $ LW.updateLocksWaiting prio cid (fromGanetiLockRequest req) + -- | Tell whether a given owner has pending requests. hasPendingRequest :: ClientId -> WConfdMonad Bool hasPendingRequest cid = liftM (LW.hasPendingRequest cid) readLockWaiting @@ -246,6 +256,7 @@ exportedFunctions = [ 'echo , 'listAllLocks , 'listAllLocksOwners , 'tryUpdateLocks + , 'updateLocksWaiting , 'freeLocks , 'freeLocksLevel , 'downGradeLocksLevel -- 1.9.1.423.g4596e3a
