Commit 952cf6e2 authored by Petr Pudlak's avatar Petr Pudlak
Browse files

After each lock operation, log the current lock status



.. using the DEBUG channel.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent e1374a9e
......@@ -50,6 +50,7 @@ module Ganeti.WConfd.Monad
) where
import Control.Applicative
import Control.Arrow ((&&&))
import Control.Monad
import Control.Monad.Base
import Control.Monad.Error
......@@ -57,6 +58,7 @@ import Control.Monad.Reader
import Control.Monad.Trans.Control
import Data.IORef.Lifted
import Data.Tuple (swap)
import qualified Text.JSON as J
import Ganeti.BasicTypes
import Ganeti.Errors
......@@ -203,8 +205,10 @@ modifyLockAllocation :: (GanetiLockAllocation -> (GanetiLockAllocation, a))
-> WConfdMonad a
modifyLockAllocation f = do
dh <- lift . WConfdMonadInt $ ask
r <- atomicModifyIORef (dhDaemonState dh)
(swap . traverseOf dsLockAllocationL (swap . f))
let f' = swap . (fst &&& id) . f
(lockAlloc, r) <- atomicModifyIORef (dhDaemonState dh)
(swap . traverseOf dsLockAllocationL f')
logDebug $ "Current lock status: " ++ J.encode lockAlloc
logDebug "Triggering lock state write"
liftBase . triggerAndWait . dhSaveLocksWorker $ dh
logDebug "Lock write finished"
......
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