Revision d8aab233 tools/cluster-merge
b/tools/cluster-merge | ||
---|---|---|
208 | 208 |
" Fail reason: %s; output: %s" % |
209 | 209 |
(cluster, result.fail_reason, result.output)) |
210 | 210 |
|
211 |
|
|
212 |
# R0201: Method could be a function |
|
213 |
def _EnableWatcher(self): # pylint: disable-msg=R0201 |
|
214 |
"""Reenable watcher (locally). |
|
215 |
|
|
216 |
""" |
|
217 |
result = utils.RunCmd(["gnt-cluster", "watcher", "continue"]) |
|
218 |
|
|
219 |
if result.failed: |
|
220 |
logging.warning("Unable to continue watcher. Fail reason: %s;" |
|
221 |
" output: %s", result.fail_reason, result.output) |
|
222 |
|
|
223 | 211 |
def _StopDaemons(self): |
224 | 212 |
"""Stop all daemons on merging nodes. |
225 | 213 |
|
226 | 214 |
""" |
227 |
# FIXME: Worth to put this into constants? |
|
228 |
cmds = [] |
|
229 |
for daemon in (constants.RAPI, constants.MASTERD, |
|
230 |
constants.NODED, constants.CONFD): |
|
231 |
cmds.append("%s stop %s" % (constants.DAEMON_UTIL, daemon)) |
|
215 |
cmd = "%s stop-all" % constants.DAEMON_UTIL |
|
232 | 216 |
for data in self.merger_data: |
233 | 217 |
for node in data.nodes: |
234 |
result = self._RunCmd(node, " && ".join(cmds))
|
|
218 |
result = self._RunCmd(node, cmd)
|
|
235 | 219 |
|
236 | 220 |
if result.failed: |
237 | 221 |
raise errors.RemoteError("Unable to stop daemons on %s." |
... | ... | |
401 | 385 |
self._StopDaemons() |
402 | 386 |
logging.info("Merging config") |
403 | 387 |
self._FetchRemoteConfig() |
404 |
self._KillMasterDaemon() |
|
405 |
|
|
406 |
rbsteps.append("Restore %s from another master candidate" % |
|
407 |
constants.CLUSTER_CONF_FILE) |
|
408 |
self._MergeConfig() |
|
409 |
self._StartMasterDaemon(no_vote=True) |
|
410 |
|
|
411 |
# Point of no return, delete rbsteps |
|
412 |
del rbsteps[:] |
|
413 |
|
|
414 |
logging.warning("We are at the point of no return. Merge can not easily" |
|
415 |
" be undone after this point.") |
|
416 |
logging.info("Readd nodes and redistribute config") |
|
417 |
self._ReaddMergedNodesAndRedist() |
|
418 |
self._KillMasterDaemon() |
|
419 |
self._StartMasterDaemon() |
|
388 |
|
|
389 |
def _OfflineClusterMerge(): |
|
390 |
"""Closure run when master daemons stopped |
|
391 |
|
|
392 |
""" |
|
393 |
rbsteps.append("Restore %s from another master candidate" % |
|
394 |
constants.CLUSTER_CONF_FILE) |
|
395 |
self._MergeConfig() |
|
396 |
self._StartMasterDaemon(no_vote=True) |
|
397 |
|
|
398 |
# Point of no return, delete rbsteps |
|
399 |
del rbsteps[:] |
|
400 |
|
|
401 |
logging.warning("We are at the point of no return. Merge can not easily" |
|
402 |
" be undone after this point.") |
|
403 |
logging.info("Readd nodes and redistribute config") |
|
404 |
self._ReaddMergedNodesAndRedist() |
|
405 |
self._KillMasterDaemon() |
|
406 |
|
|
407 |
cli.RunWhileClusterStopped(logging.info, _OfflineClusterMerge) |
|
408 |
|
|
420 | 409 |
logging.info("Starting instances again") |
421 | 410 |
self._StartupAllInstances() |
422 | 411 |
logging.info("Post cluster verification") |
Also available in: Unified diff