Revision a8b9a6e3 src/Ganeti/WConfd/Monad.hs

b/src/Ganeti/WConfd/Monad.hs
85 85
  -- all IDs of threads that do asynchronous work should probably also go here
86 86
  , dhSaveConfigWorker :: AsyncWorker ()
87 87
  , dhDistMCsWorker :: AsyncWorker ()
88
  , dhDistSSConfWorker :: AsyncWorker ()
88 89
  , dhSaveLocksWorker :: AsyncWorker ()
89 90
  }
90 91

  
......
97 98
               -> (IO ConfigState -> ResultG (AsyncWorker ()))
98 99
                  -- ^ A function that creates a worker that asynchronously
99 100
                  -- distributes the configuration to master candidates
101
               -> (IO ConfigState -> ResultG (AsyncWorker ()))
102
                  -- ^ A function that creates a worker that asynchronously
103
                  -- distributes SSConf to nodes
100 104
               -> (IO GanetiLockAllocation -> ResultG (AsyncWorker ()))
101 105
                  -- ^ A function that creates a worker that asynchronously
102 106
                  -- saves the lock allocation state.
103 107
               -> ResultG DaemonHandle
104 108
mkDaemonHandle cpath cstat lstat
105
               saveWorkerFn distMCsWorkerFn
109
               saveWorkerFn distMCsWorkerFn distSSConfWorkerFn
106 110
               saveLockWorkerFn = do
107 111
  ds <- newIORef $ DaemonState cstat lstat
108 112
  let readConfigIO = dsConfigState `liftM` readIORef ds :: IO ConfigState
109 113

  
110 114
  saveWorker <- saveWorkerFn readConfigIO
115
  ssconfWorker <- distSSConfWorkerFn readConfigIO
111 116
  distMCsWorker <- distMCsWorkerFn readConfigIO
112 117

  
113 118
  saveLockWorker <- saveLockWorkerFn $ dsLockAllocation `liftM` readIORef ds
114 119

  
115
  return $ DaemonHandle ds cpath saveWorker distMCsWorker
120
  return $ DaemonHandle ds cpath saveWorker distMCsWorker ssconfWorker
116 121
                                 saveLockWorker
117 122

  
118 123
-- * The monad and its instances
......
184 189
    logDebug "Triggering config write"
185 190
    liftBase . triggerAndWait . dhSaveConfigWorker $ dh
186 191
    logDebug "Config write finished"
187
    -- trigger the config. distribution worker asynchronously
188
    liftBase . triggerAndWait . dhDistMCsWorker $ dh
189
    -- TODO: SSConf
192
    -- trigger the config. distribution worker synchronously
193
    -- TODO: figure out what configuration changes need synchronous updates
194
    -- and otherwise use asynchronous triggers
195
    _ <- liftBase . triggerAndWaitMany $ [ dhDistMCsWorker dh
196
                                         , dhDistSSConfWorker dh
197
                                         ]
198
    return ()
190 199
  return r
191 200

  
192 201
-- | Atomically modifies the lock allocation state in WConfdMonad.

Also available in: Unified diff