Commit 64f3a6ea authored by Petr Pudlak's avatar Petr Pudlak

Add a livelock file for the Luxi daemon

The file is initialized and kept within JQStatus.
It is temporarily assigned to jobs spawned by Luxi until they create
their own livelock files.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 35e3ce28
......@@ -4666,6 +4666,10 @@ luxiDefRwto = 60
luxiWfjcTimeout :: Int
luxiWfjcTimeout = (luxiDefRwto - 1) `div` 2
-- | The prefix of the LUXI livelock file name
luxiLivelockPrefix :: String
luxiLivelockPrefix = "luxi-daemon"
-- * Query language constants
-- ** Logic operators with one or more operands, each of which is a
......
......@@ -52,6 +52,7 @@ import Ganeti.Objects
import Ganeti.Path
import Ganeti.Types
import Ganeti.Utils
import Ganeti.Utils.Livelock
data JobWithStat = JobWithStat { jINotify :: Maybe INotify
, jStat :: FStat
......@@ -72,13 +73,15 @@ both, in particular when scheduling jobs to be handed over for execution.
data JQStatus = JQStatus
{ jqJobs :: IORef Queue
, jqConfig :: IORef (Result ConfigData)
, jqLivelock :: Livelock
}
emptyJQStatus :: IORef (Result ConfigData) -> IO JQStatus
emptyJQStatus config = do
jqJ <- newIORef Queue { qEnqueued = [], qRunning = []}
return JQStatus { jqJobs = jqJ, jqConfig = config }
(_, livelock) <- mkLivelockFile C.luxiLivelockPrefix
return JQStatus { jqJobs = jqJ, jqConfig = config, jqLivelock = livelock }
-- | Apply a function on the running jobs.
onRunningJobs :: ([JobWithStat] -> [JobWithStat]) -> Queue -> Queue
......
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