Commit 4a3a34d4 authored by Petr Pudlak's avatar Petr Pudlak

Add a WConfd call for flushing the configuration

After the call successfully returns, the configuration is saved and
fully distributed to the master candidates.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 2b63951d
......@@ -103,6 +103,11 @@ unlockConfig
:: ClientId -> WConfdMonad ()
unlockConfig cid = freeLocksLevel cid LevelConfig
-- | Force the distribution of configuration without actually modifying it.
-- It is not necessary to hold a lock for this operation.
flushConfig :: WConfdMonad ()
flushConfig = forceConfigStateDistribution
-- ** Temporary reservations related functions
computeDRBDMap :: WConfdMonad T.DRBDMap
......@@ -189,6 +194,7 @@ exportedFunctions = [ 'echo
, 'writeConfig
, 'lockConfig
, 'unlockConfig
, 'flushConfig
-- temporary reservations
, 'computeDRBDMap
, 'allocateDRBDMinor
......
......@@ -43,6 +43,7 @@ module Ganeti.WConfd.Monad
, WConfdMonad
, daemonHandle
, modifyConfigState
, forceConfigStateDistribution
, readConfigState
, modifyLockWaiting
, modifyLockWaiting_
......@@ -221,6 +222,17 @@ modifyConfigState f = do
return ()
return r
-- | Force the distribution of configuration without actually modifying it.
--
-- We need a separate call for this operation, because 'modifyConfigState' only
-- triggers the distribution when the configuration changes.
forceConfigStateDistribution :: WConfdMonad ()
forceConfigStateDistribution = do
logDebug "Forcing synchronous config write together with full distribution"
dh <- daemonHandle
liftBase . triggerAndWait (Any True) . dhSaveConfigWorker $ dh
logDebug "Forced config write and distribution finished"
-- | Atomically modifies the state of temporary reservations in
-- WConfdMonad in the presence of possible errors.
modifyTempResStateErr
......
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