Revision a8b9a6e3
b/lib/config.py | ||
---|---|---|
200 | 200 |
# better to raise an error before starting to modify the config |
201 | 201 |
# file than after it was modified |
202 | 202 |
self._my_hostname = netutils.Hostname.GetSysName() |
203 |
self._last_cluster_serial = -1 |
|
204 | 203 |
self._cfg_id = None |
205 | 204 |
self._context = None |
206 | 205 |
self._wconfd = None |
... | ... | |
2397 | 2396 |
raise errors.ConfigurationError(msg) |
2398 | 2397 |
|
2399 | 2398 |
self._config_data = data |
2400 |
# reset the last serial as -1 so that the next write will cause |
|
2401 |
# ssconf update |
|
2402 |
self._last_cluster_serial = -1 |
|
2403 | 2399 |
|
2404 | 2400 |
# Upgrade configuration if needed |
2405 | 2401 |
self._UpgradeConfig() |
... | ... | |
2509 | 2505 |
|
2510 | 2506 |
self.write_count += 1 |
2511 | 2507 |
|
2512 |
# Write ssconf files on all nodes (including locally) |
|
2513 |
if self._last_cluster_serial < self._config_data.cluster.serial_no: |
|
2514 |
if not self._offline: |
|
2515 |
result = self._GetRpc(None).call_write_ssconf_files( |
|
2516 |
self._UnlockedGetNodeNames(self._UnlockedGetOnlineNodeList()), |
|
2517 |
self._UnlockedGetSsconfValues()) |
|
2518 |
|
|
2519 |
for nname, nresu in result.items(): |
|
2520 |
msg = nresu.fail_msg |
|
2521 |
if msg: |
|
2522 |
errmsg = ("Error while uploading ssconf files to" |
|
2523 |
" node %s: %s" % (nname, msg)) |
|
2524 |
logging.warning(errmsg) |
|
2525 |
|
|
2526 |
if feedback_fn: |
|
2527 |
feedback_fn(errmsg) |
|
2528 |
|
|
2529 |
self._last_cluster_serial = self._config_data.cluster.serial_no |
|
2530 |
|
|
2531 | 2508 |
def _GetAllHvparamsStrings(self, hypervisors): |
2532 | 2509 |
"""Get the hvparams of all given hypervisors from the config. |
2533 | 2510 |
|
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. |
b/src/Ganeti/WConfd/Server.hs | ||
---|---|---|
90 | 90 |
lock |
91 | 91 |
(saveConfigAsyncTask conf_file cstat) |
92 | 92 |
(distMCsAsyncTask ents conf_file) |
93 |
distSSConfAsyncTask |
|
93 | 94 |
(writeLocksAsyncTask lock_file) |
94 | 95 |
dh <- withError (strMsg . ("Initialization of the daemon failed" ++) . show) |
95 | 96 |
dhOpt |
Also available in: Unified diff