Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong CPU mumber reported in list hosts #9290

Closed
fermosan opened this issue Jun 24, 2024 · 7 comments · Fixed by #10218
Closed

Wrong CPU mumber reported in list hosts #9290

fermosan opened this issue Jun 24, 2024 · 7 comments · Fixed by #10218
Assignees
Milestone

Comments

@fermosan
Copy link
Contributor

fermosan commented Jun 24, 2024

ISSUE TYPE

Bug

COMPONENT NAME
Component: API
CLOUDSTACK VERSION
4.19.0.1
CONFIGURATION
OS / ENVIRONMENT

UBUNTU 22.04

SUMMARY

The cpunumber reported from list hosts is incosistent with physical hardware and records in database host table.

STEPS TO REPRODUCE
Maybe its related to fix #8252 and issue #6744 

The host has 
88 Cores
2.2 Ghz
(overprovisioning factor 1)

that means a maximum share of 193600 according to the #8252 patch

EXPECTED RESULTS
cpunumber matches physical hardware and detected cpus from host table
ACTUAL RESULTS
list hosts  filter=id,cpuallocatedvalue,cpunumber,cpusockets,cpuspeed,cpuwithoverprovisioning
{
  "count": 13,
  "host": [
    {
      "cpuallocatedvalue": 13500,
      "cpunumber": 176,
      "cpusockets": 2,
      "cpuspeed": 2200,
      "cpuwithoverprovisioning": "387200",
      "id": "7a75ccbc-8184-46ed-b42d-f9cdba1b9ccc"
    },
    {
      "cpuallocatedvalue": 24500,
      "cpunumber": 176,
      "cpusockets": 2,
      "cpuspeed": 2200,
      "cpuwithoverprovisioning": "387200",
      "id": "6dff8ccf-ad40-4755-8208-bea9745129d4"
    },
    {
      "cpuallocatedvalue": 14000,
      "cpunumber": 176,
      "cpusockets": 2,
      "cpuspeed": 2200,
      "cpuwithoverprovisioning": "387200",
      "id": "d2533dd4-1ed8-4b92-8001-4704b1973903"
    },
    {
      "cpuallocatedvalue": 18500,
      "cpunumber": 176,
      "cpusockets": 2,
      "cpuspeed": 2200,
      "cpuwithoverprovisioning": "387200",
      "id": "b5a0d84b-6248-4054-b61a-603e76fb8b2e"
    },
    {
      "cpuallocatedvalue": 12500,
      "cpunumber": 176,
      "cpusockets": 2,
      "cpuspeed": 2200,
      "cpuwithoverprovisioning": "387200",
      "id": "a1322c18-c806-4f05-bb44-9ec9d800d2bd"
    },
    {
      "cpuallocatedvalue": 16000,
      "cpunumber": 176,
      "cpusockets": 2,
      "cpuspeed": 2200,
      "cpuwithoverprovisioning": "387200",
      "id": "23016ba8-c508-4b60-b850-c992f01a5340"
    },
    {
      "id": "6f62f21a-ccd8-4e62-a311-5033a813e887"
    },
    {
      "id": "9d8d6faa-3221-4ed2-ac27-a1cdcdae5293"
    },
    {
      "cpuallocatedvalue": 16000,
      "cpunumber": 176,
      "cpusockets": 2,
      "cpuspeed": 2200,
      "cpuwithoverprovisioning": "387200",
      "id": "f621a88f-79f8-4857-bb9b-62b78bb5be02"
    },
    {
      "cpuallocatedvalue": 28100,
      "cpunumber": 176,
      "cpusockets": 2,
      "cpuspeed": 2200,
      "cpuwithoverprovisioning": "387200",
      "id": "ae35f566-a5bf-40f7-bacc-716904692e56"
    },
    {
      "cpuallocatedvalue": 8500,
      "cpunumber": 32,
      "cpusockets": 2,
      "cpuspeed": 2600,
      "cpuwithoverprovisioning": "83200",
      "id": "87f9a908-00ed-4018-b1f6-72d7d5476606"
    },
    {
      "cpuallocatedvalue": 10000,
      "cpunumber": 32,
      "cpusockets": 2,
      "cpuspeed": 2600,
      "cpuwithoverprovisioning": "83200",
      "id": "2e338815-a2f0-4663-a391-7ebe6ddbfa99"
    },
    {
      "cpuallocatedvalue": 22500,
      "cpunumber": 56,
      "cpusockets": 2,
      "cpuspeed": 2000,
      "cpuwithoverprovisioning": "112000",
      "id": "004f29a4-49ae-4e71-81bf-eb946d52e43e"
    }
  ]
}

select uuid,version,cpus,speed from host_view where cpus is not NULL;
--------------------------------------+----------+------+-------+
| uuid                                 | version  | cpus | speed |
+--------------------------------------+----------+------+-------+
| 7a75ccbc-8184-46ed-b42d-f9cdba1b9ccc | 4.19.0.1 |   88 |  2200 |
| 6dff8ccf-ad40-4755-8208-bea9745129d4 | 4.19.0.1 |   88 |  2200 |
| d2533dd4-1ed8-4b92-8001-4704b1973903 | 4.19.0.1 |   88 |  2200 |
| b5a0d84b-6248-4054-b61a-603e76fb8b2e | 4.19.0.1 |   88 |  2200 |
| a1322c18-c806-4f05-bb44-9ec9d800d2bd | 4.19.0.1 |   88 |  2200 |
| 23016ba8-c508-4b60-b850-c992f01a5340 | 4.19.0.1 |   88 |  2200 |
| f621a88f-79f8-4857-bb9b-62b78bb5be02 | 4.19.0.1 |   88 |  2200 |
| ae35f566-a5bf-40f7-bacc-716904692e56 | 4.19.0.1 |   88 |  2200 |
| 87f9a908-00ed-4018-b1f6-72d7d5476606 | 4.19.0.1 |   32 |  2600 |
| 2e338815-a2f0-4663-a391-7ebe6ddbfa99 | 4.19.0.1 |   32 |  2600 |
| 004f29a4-49ae-4e71-81bf-eb946d52e43e | 4.19.0.1 |   56 |  2000 |
+--------------------------------------+----------+------+-------+

lscpu:
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         46 bits physical, 48 bits virtual
  Byte Order:            Little Endian
CPU(s):                  88
  On-line CPU(s) list:   0-87
Vendor ID:               GenuineIntel
  Model name:            Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz
    CPU family:          6
    Model:               79
    Thread(s) per core:  2
    Core(s) per socket:  22
    Socket(s):           2
    Stepping:            1
    CPU max MHz:         3600.0000
    CPU min MHz:         1200.0000
    BogoMIPS:            4400.28

@weizhouapache
Copy link
Member

it looks like the cpuNumber values are set differently

hostResponse.setCpuNumber(host.getCpus());

hostResponse.setCpuNumber(host.getCpus());

float cpuOverprovisioningFactor = ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId());
hostResponse.setCpuNumber((int)(host.getCpus() * cpuOverprovisioningFactor));

the last change was added in the PR #4795 years ago.
should we change it to keep consistent with others ? cc @shwstppr

@shwstppr
Copy link
Contributor

@weizhouapache yes, makes sense. Maybe we can have a common method to create HostResponse or a method to fill in CPU/memory details

@weizhouapache
Copy link
Member

@weizhouapache yes, makes sense. Maybe we can have a common method to create HostResponse or a method to fill in CPU/memory details

thanks @shwstppr
I will make some change as you suggested.

@weizhouapache weizhouapache moved this from Todo to Dev In Progress in Apache CloudStack BugFest - Issues Jan 20, 2025
@weizhouapache weizhouapache linked a pull request Jan 20, 2025 that will close this issue
14 tasks
@weizhouapache weizhouapache moved this from Dev In Progress to ready for Review in Apache CloudStack BugFest - Issues Jan 20, 2025
@DaanHoogland
Copy link
Contributor

@weizhouapache after your fix, will this still need a documentation change?

@weizhouapache
Copy link
Member

@weizhouapache after your fix, will this still need a documentation change?

@DaanHoogland good point

I quickly checked the page for host https://docs.cloudstack.apache.org/en/latest/adminguide/hosts.html
could not find a paragraph for the cpu number

maybe a paragraph in 4.19.2 release note ?

@DaanHoogland
Copy link
Contributor

maybe a paragraph in 4.19.2 release note ?

never mind, as discussed; It is now uniform and intuative, so no changes in docs needed.

@DaanHoogland
Copy link
Contributor

fixed in #10218

@github-project-automation github-project-automation bot moved this from ready for Review to Done in Apache CloudStack BugFest - Issues Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

5 participants