Commit 1b94c0db authored by Klaus Aehlig's avatar Klaus Aehlig

Add the predicate of the queue being open

Adding jobs to the queue is only allowed if the queue
is not drained.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent e773a018
......@@ -49,6 +49,7 @@ module Ganeti.JQueue
, allocateJobIds
, allocateJobId
, writeJobToDisk
, isQueueOpen
) where
import Control.Concurrent.MVar
......@@ -389,3 +390,7 @@ allocateJobId :: [Node] -> MVar () -> IO (Result JobId)
allocateJobId mastercandidates lock = do
jids <- allocateJobIds mastercandidates lock 1
return (jids >>= monadicThe "Failed to allocate precisely one Job ID")
-- | Decide if job queue is open
isQueueOpen :: IO Bool
isQueueOpen = liftM not (jobQueueDrainFile >>= doesFileExist)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment