From 64f3a6ea490040b780e17f01ef27f1a30dbe211e Mon Sep 17 00:00:00 2001 From: Petr Pudlak Date: Fri, 11 Apr 2014 08:53:19 +0200 Subject: [PATCH] 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: Petr Pudlak Reviewed-by: Klaus Aehlig --- src/Ganeti/Constants.hs | 4 ++++ src/Ganeti/JQScheduler.hs | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs index f9c3ef199..45c806926 100644 --- a/src/Ganeti/Constants.hs +++ b/src/Ganeti/Constants.hs @@ -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 diff --git a/src/Ganeti/JQScheduler.hs b/src/Ganeti/JQScheduler.hs index 3a923951f..8128140c1 100644 --- a/src/Ganeti/JQScheduler.hs +++ b/src/Ganeti/JQScheduler.hs @@ -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 -- GitLab