diff --git a/sysinv/sysinv/sysinv/sysinv/db/api.py b/sysinv/sysinv/sysinv/sysinv/db/api.py index 076d1e5657..87f2db3935 100644 --- a/sysinv/sysinv/sysinv/sysinv/db/api.py +++ b/sysinv/sysinv/sysinv/sysinv/db/api.py @@ -420,6 +420,14 @@ class Connection(object): :returns: cpus. """ + @abc.abstractmethod + def icpu_is_hyper_threading_enabled(self, ihost): + """Return if Hyper Threading is enabled on host. + + :param ihost: The id or uuid of an ihost. + :returns: True if enabled and False if not. + """ + @abc.abstractmethod def icpu_update(self, cpu_id, values, forihostid=None): """Update properties of a cpu. diff --git a/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/api.py b/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/api.py index e25d85cd12..34c8068319 100644 --- a/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/api.py +++ b/sysinv/sysinv/sysinv/sysinv/db/sqlalchemy/api.py @@ -1626,6 +1626,15 @@ class Connection(api.Connection): return _paginate_query(models.icpu, limit, marker, sort_key, sort_dir, query) + def icpu_is_hyper_threading_enabled(self, ihost): + + query = model_query(models.icpu.id) + query = add_icpu_filter_by_ihost(query, ihost) + query = query.filter(models.icpu.thread > 0) + + result = query.first() + return result is not None + @db_objects.objectify(objects.cpu) def icpu_update(self, cpu_id, values, forihostid=None): with _session_for_write() as session: diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/base.py b/sysinv/sysinv/sysinv/sysinv/puppet/base.py index a382ec7378..897bccfe2b 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/base.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/base.py @@ -228,6 +228,12 @@ class BasePuppet(object): cpus = self._get_host_cpu_list(host, constants.PLATFORM_FUNCTION) return sorted(cpus, key=lambda c: c.cpu) + def _get_hyperthreading_enabled(self, host): + """ + Check if the Hyper-Threading feature is enabled on host + """ + return self.dbapi.icpu_is_hyper_threading_enabled(host.id) + def _get_service_parameters(self, service=None): service_parameters = [] if self.dbapi is None: diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/platform.py b/sysinv/sysinv/sysinv/sysinv/puppet/platform.py index c338c20285..57166a1498 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/platform.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/platform.py @@ -339,6 +339,12 @@ class PlatformPuppet(base.BasePuppet): cpu_count, }) + hyperthreading_enabled = self._get_hyperthreading_enabled(host) + config.update({ + 'platform::params::hyperthreading_enabled': + hyperthreading_enabled, + }) + return config def _get_host_platform_config_upgrade(self, host, config_uuid):