X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=cmdatahandlers%2Fsrc%2Fcmdatahandlers%2Fhosts%2Fconfig.py;h=1bd37d89c74420d4c9be2897cfab59afe447b0ff;hb=7a6a437dd67c682768bc7c9974eafea72dc17719;hp=a9a445ed09045f00a9a660ffd9576683539da08a;hpb=c3bc257650a437d095bb85e7320d2e9405391a30;p=ta%2Fconfig-manager.git diff --git a/cmdatahandlers/src/cmdatahandlers/hosts/config.py b/cmdatahandlers/src/cmdatahandlers/hosts/config.py index a9a445e..1bd37d8 100644 --- a/cmdatahandlers/src/cmdatahandlers/hosts/config.py +++ b/cmdatahandlers/src/cmdatahandlers/hosts/config.py @@ -196,8 +196,24 @@ class Config(config.Config): 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)) @@ -838,20 +854,27 @@ class Config(config.Config): caasconf = self.confman.get_caas_config_handler() if caasconf.is_vnf_embedded_deployment(): return VNF_EMBEDDED_RESERVED_MEMORY - + profiles = self.get_service_profiles(hostname) if 'controller' in profiles: return DUAL_VIM_CONTROLLER_RESERVED_MEMORY if 'compute' in profiles: return DUAL_VIM_DEFAULT_RESERVED_MEMORY - return self.config.get(self.ROOT, {}).get('middleware_reserved_memory', + return self.config.get(self.ROOT, {}).get('middleware_reserved_memory', MIDDLEWARE_RESERVED_MEMORY) def set_default_reserved_memory_to_all_hosts(self, def_memory): for host in self.get_hosts(): self.config[self.ROOT][host]['middleware_reserved_memory'] = def_memory + def set_default_ipmi_priv_level_to_all_hosts(self, def_priv): + for host in self.get_hosts(): + if 'hwmgmt' not in self.config[self.ROOT][host]: + self.config[self.ROOT][host]['hwmgmt'] = {'priv_level': def_priv} + elif 'priv_level' not in self.config[self.ROOT][host]['hwmgmt']: + self.config[self.ROOT][host]['hwmgmt']['priv_level'] = def_priv + def _get_path_for_virtio_id(disk): disk_id = disk.get('id', '')