]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
orchestrator: Fix representation of threads in host ls 56097/head
authorPaul Cuzner <pcuzner@ibm.com>
Wed, 20 Dec 2023 23:47:51 +0000 (18:47 -0500)
committerAdam King <adking@redhat.com>
Sun, 10 Mar 2024 20:12:23 +0000 (16:12 -0400)
This patch fixes the calculation when determining the
number of threads for hosts when using the --detail
parameter.

Signed-off-by: Paul Cuzner <pcuzner@ibm.com>
(cherry picked from commit 5bc735fb6ffbdcacffc3e678b7682f91fe7593c2)

src/pybind/mgr/orchestrator/module.py

index 054cd58f8b0d86a743bc0ff7f7aa00d789aec53c..e0a89ecadcff29b72a21bc15dcae9d74d446d243 100644 (file)
@@ -95,8 +95,9 @@ class HostDetails:
 
         if self._facts:
             self.server = f"{self._facts.get('vendor', '').strip()} {self._facts.get('model', '').strip()}"
-            _cores = self._facts.get('cpu_cores', 0) * self._facts.get('cpu_count', 0)
-            _threads = self._facts.get('cpu_threads', 0) * _cores
+            _cpu_count = self._facts.get('cpu_count', 1)
+            _cores = self._facts.get('cpu_cores', 0) * _cpu_count
+            _threads = self._facts.get('cpu_threads', 0) * _cpu_count
             self.os = self._facts.get('operating_system', 'N/A')
             self.cpu_summary = f"{_cores}C/{_threads}T" if _cores > 0 else 'N/A'