Commit bb6b097b authored by Klaus Aehlig's avatar Klaus Aehlig

Make WConfD have a livelock file as well

During cluster destruction, WConfD will need to take the
BGL. Therefore, it has to have a livelock file as well.
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent 341d74ea
......@@ -46,6 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
module Ganeti.WConfd.Monad
( DaemonHandle
, dhConfigPath
, dhLivelock
, mkDaemonHandle
, WConfdMonadInt
, runWConfdMonadInt
......@@ -92,6 +93,7 @@ import Ganeti.Logging.WriterLog
import Ganeti.Objects (ConfigData)
import Ganeti.Utils.AsyncWorker
import Ganeti.Utils.IORef
import Ganeti.Utils.Livelock (Livelock)
import Ganeti.WConfd.ConfigState
import Ganeti.WConfd.TempRes
......@@ -116,6 +118,7 @@ data DaemonHandle = DaemonHandle
, dhSaveConfigWorker :: AsyncWorker Any ()
, dhSaveLocksWorker :: AsyncWorker () ()
, dhSaveTempResWorker :: AsyncWorker () ()
, dhLivelock :: Livelock
}
mkDaemonHandle :: FilePath
......@@ -138,10 +141,12 @@ mkDaemonHandle :: FilePath
-> (IO TempResState -> ResultG (AsyncWorker () ()))
-- ^ A function that creates a worker that asynchronously
-- saves the temporary reservations state.
-> Livelock
-> ResultG DaemonHandle
mkDaemonHandle cpath cstat lstat trstat
saveWorkerFn distMCsWorkerFn distSSConfWorkerFn
saveLockWorkerFn saveTempResWorkerFn = do
saveLockWorkerFn saveTempResWorkerFn
livelock = do
ds <- newIORef $ DaemonState cstat lstat trstat
let readConfigIO = dsConfigState `liftM` readIORef ds :: IO ConfigState
......@@ -155,6 +160,7 @@ mkDaemonHandle cpath cstat lstat trstat
saveTempResWorker <- saveTempResWorkerFn $ dsTempRes `liftM` readIORef ds
return $ DaemonHandle ds cpath saveWorker saveLockWorker saveTempResWorker
livelock
-- * The monad and its instances
......
......@@ -46,15 +46,16 @@ import Control.Monad
import Control.Monad.Error
import Ganeti.BasicTypes
import qualified Ganeti.Constants as C
import Ganeti.Daemon
import Ganeti.Daemon.Utils (handleMasterVerificationOptions)
import Ganeti.Logging (logDebug)
import qualified Ganeti.Path as Path
import Ganeti.THH.RPC
import Ganeti.UDSServer
import Ganeti.Errors (formatError)
import Ganeti.Runtime
import Ganeti.Utils.Livelock (mkLivelockFile)
import Ganeti.WConfd.ConfigState
import Ganeti.WConfd.ConfigVerify
import Ganeti.WConfd.ConfigWriter
......@@ -93,6 +94,7 @@ prepMain _ _ = do
verifyConfigErr cdata
lock <- readPersistent persistentLocks
tempres <- readPersistent persistentTempRes
(_, livelock) <- mkLivelockFile C.wconfdLivelockPrefix
mkDaemonHandle conf_file
(mkConfigState cdata)
lock
......@@ -102,6 +104,7 @@ prepMain _ _ = do
distSSConfAsyncTask
(writePersistentAsyncTask persistentLocks)
(writePersistentAsyncTask persistentTempRes)
livelock
return (s, dh)
......
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