Revision 9b945588 tools/cluster-merge
b/tools/cluster-merge | ||
---|---|---|
52 | 52 |
help=("Amount of time in seconds watcher" |
53 | 53 |
" should be suspended from running")) |
54 | 54 |
GROUPS_OPT = cli.cli_option("--groups", default=None, metavar="STRATEGY", |
55 |
choices=(_GROUPS_MERGE, _GROUPS_RENAME), dest="groups", |
|
55 |
choices=(_GROUPS_MERGE, _GROUPS_RENAME), |
|
56 |
dest="groups", |
|
56 | 57 |
help=("How to handle groups that have the" |
57 | 58 |
" same name (One of: %s/%s)" % |
58 | 59 |
(_GROUPS_MERGE, _GROUPS_RENAME))) |
... | ... | |
314 | 315 |
ConfigWriter.AddNodeGroup takes care of making sure there are no conflicts. |
315 | 316 |
""" |
316 | 317 |
# pylint: disable-msg=R0201 |
317 |
logging.info("Node group conflict strategy: %s" % self.groups)
|
|
318 |
logging.info("Node group conflict strategy: %s", self.groups)
|
|
318 | 319 |
|
319 | 320 |
my_grps = my_config.GetAllNodeGroupsInfo().values() |
320 | 321 |
other_grps = other_config.GetAllNodeGroupsInfo().values() |
... | ... | |
328 | 329 |
|
329 | 330 |
if conflicts: |
330 | 331 |
conflict_names = utils.CommaJoin([g.name for g in conflicts]) |
331 |
logging.info("Node groups in both local and remote cluster: %s" %
|
|
332 |
logging.info("Node groups in both local and remote cluster: %s",
|
|
332 | 333 |
conflict_names) |
333 | 334 |
|
334 | 335 |
# User hasn't specified how to handle conflicts |
... | ... | |
343 | 344 |
for grp in conflicts: |
344 | 345 |
new_name = "%s-%s" % (grp.name, other_config.GetClusterName()) |
345 | 346 |
logging.info("Renaming remote node group from %s to %s" |
346 |
" to resolve conflict" % (grp.name, new_name))
|
|
347 |
" to resolve conflict", grp.name, new_name)
|
|
347 | 348 |
grp.name = new_name |
348 | 349 |
|
349 | 350 |
# User wants to merge conflicting groups |
350 | 351 |
elif self.groups == 'merge': |
351 | 352 |
for other_grp in conflicts: |
352 |
logging.info("Merging local and remote '%s' groups" % other_grp.name)
|
|
353 |
logging.info("Merging local and remote '%s' groups", other_grp.name)
|
|
353 | 354 |
for node_name in other_grp.members[:]: |
354 | 355 |
node = other_config.GetNodeInfo(node_name) |
356 |
# Access to a protected member of a client class |
|
357 |
# pylint: disable-msg=W0212 |
|
355 | 358 |
other_config._UnlockedRemoveNodeFromGroup(node) |
356 | 359 |
|
360 |
# Access to a protected member of a client class |
|
361 |
# pylint: disable-msg=W0212 |
|
357 | 362 |
my_grp_uuid = my_config._UnlockedLookupNodeGroup(other_grp.name) |
363 |
|
|
364 |
# Access to a protected member of a client class |
|
365 |
# pylint: disable-msg=W0212 |
|
358 | 366 |
my_config._UnlockedAddNodeToGroup(node, my_grp_uuid) |
359 | 367 |
node.group = my_grp_uuid |
360 | 368 |
# Remove from list of groups to add |
Also available in: Unified diff