Skip to content
Snippets Groups Projects
Commit 8f44674f authored by Stephen Shirley's avatar Stephen Shirley Committed by René Nussbaumer
Browse files

Merge node groups from other cluster


Signed-off-by: default avatarStephen Shirley <diamond@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 18ffc0fe
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,7 @@ PAUSE_PERIOD_OPT = cli.cli_option("-p", "--watcher-pause-period", default=1800, ...@@ -47,6 +47,7 @@ PAUSE_PERIOD_OPT = cli.cli_option("-p", "--watcher-pause-period", default=1800,
dest="pause_period", dest="pause_period",
help=("Amount of time in seconds watcher" help=("Amount of time in seconds watcher"
" should be suspended from running")) " should be suspended from running"))
_CLUSTERMERGE_ECID = "clustermerge-ecid"
def Flatten(unflattened_list): def Flatten(unflattened_list):
...@@ -268,6 +269,7 @@ class Merger(object): ...@@ -268,6 +269,7 @@ class Merger(object):
for data in self.merger_data: for data in self.merger_data:
other_config = config.ConfigWriter(data.config_path, accept_foreign=True) other_config = config.ConfigWriter(data.config_path, accept_foreign=True)
self._MergeNodeGroups(my_config, other_config)
for node in other_config.GetNodeList(): for node in other_config.GetNodeList():
node_info = other_config.GetNodeInfo(node) node_info = other_config.GetNodeInfo(node)
...@@ -295,6 +297,17 @@ class Merger(object): ...@@ -295,6 +297,17 @@ class Merger(object):
my_config.AddInstance(instance_info, str(fake_ec_id)) my_config.AddInstance(instance_info, str(fake_ec_id))
fake_ec_id += 1 fake_ec_id += 1
# R0201: Method could be a function
def _MergeNodeGroups(self, my_config, other_config):
"""Adds foreign node groups
ConfigWriter.AddNodeGroup takes care of making sure there are no conflicts.
"""
# pylint: disable-msg=R0201
for (_, grp) in other_config.GetAllNodeGroupsInfo():
#TODO: handle node group conflicts
my_config.AddNodeGroup(grp, _CLUSTERMERGE_ECID)
# R0201: Method could be a function # R0201: Method could be a function
def _StartMasterDaemon(self, no_vote=False): # pylint: disable-msg=R0201 def _StartMasterDaemon(self, no_vote=False): # pylint: disable-msg=R0201
"""Starts the local master daemon. """Starts the local master daemon.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment