return True
return False
+def get_installation_host_name(hostsconf):
+ hostname = 'controller-1'
+ if not is_virtualized():
+ ownip = get_own_hwmgmt_ip()
+ hostname = hostsconf.get_host_having_hwmgmt_address(ownip)
+ return hostname
+
def flatten_config_data(jsondata):
result = {}
for key, value in jsondata.iteritems():
self.set_caas_parameter('infra_log_store', DEFAULT_CAAS_INFRA_LOG_TYPE)
if not self.get_caas_parameter('log_forwarding'):
self.set_caas_parameter('log_forwarding', [])
+ hostsconf = self.confman.get_hosts_config_handler()
+ hostsconf.set_nodeindex()
def set_static_config(self):
try:
return service_profiles[0]
+ def set_nodeindex(self):
+ hostsconf = self.confman.get_hosts_config_handler()
+ install_host = utils.get_installation_host_name(hostsconf)
+ self.config[self.ROOT][install_host]['caas_nodeindex'] = 1
+
+ masters = self.get_service_profile_hosts('caas_master')
+ masters.remove(install_host)
+ self._set_nodeindexes(masters, 2)
+ self._set_nodeindexes(self.get_service_profile_hosts('caas_worker'), 1)
+
+ def _set_nodeindexes(self, hosts, base_index):
+ index = base_index
+ for host in hosts:
+ self.config[self.ROOT][host]['caas_nodeindex'] = index
+ index += 1
+
def get_nodeindex(self, hostname):
- return re.search(r'[-_](\d+)$', hostname).group(1)
+ return self.config[self.ROOT][hostname]['caas_nodeindex']
def get_nodename(self, hostname):
return "{}{}".format(self.get_nodetype(hostname), self.get_nodeindex(hostname))