Skip to content

Conversation

@guillemtp
Copy link

Description

On KVM hosts, when agent checks the CPU speed it starts from lscpu before other mechanisms. It does a first check obtaining the CPU frequency from Model Name and if it's not specified in model name it takes from dynamic MHz option.

Dynamic MHz and frequency specified in model name can be different. Normally, dynamic MHz is bigger if the model name specifies. This means that we can have a registered host in CloudStack with a smaller frequency that it can achieve.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

The following host has been registered with a frequency of 2.4Ghz, which can achieve 3.4GHz. Here the commands that executes the KVMHostInfo.java:

imatge

How Has This Been Tested?

Overriding the lscpu command as the following and restarting the cloudstack agent shows the hosts in CloudStack control plane with the right frequency:

sudo mv /usr/bin/lscpu /usr/bin/lscpu.real
sudo tee /usr/bin/lscpu >/dev/null << 'EOF'
#!/bin/bash
# Wrapper per lscpu: elimina la freqüència del Model name
/usr/bin/lscpu.real "$@" | sed -E 's/(Model name:\s+.*)@ [0-9.]+[GM]Hz/\1/'
EOF

sudo chmod +x /usr/bin/lscpu

@boring-cyborg
Copy link

boring-cyborg bot commented Dec 4, 2025

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.88%. Comparing base (a55f85a) to head (1a047ba).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...org/apache/cloudstack/utils/linux/KVMHostInfo.java 33.33% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              main   #12190       +/-   ##
============================================
+ Coverage     3.57%   17.88%   +14.30%     
- Complexity       0    16059    +16059     
============================================
  Files          451     5934     +5483     
  Lines        38156   532088   +493932     
  Branches      7044    65065    +58021     
============================================
+ Hits          1363    95138    +93775     
- Misses       36627   426307   +389680     
- Partials       166    10643    +10477     
Flag Coverage Δ
uitests 3.57% <ø> (ø)
unittests 18.98% <33.33%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 15943

@DaanHoogland
Copy link
Contributor

Debian build failed, retrying that.

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-14916)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 60202 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12190-t14916-kvm-ol8.zip
Smoke tests completed. 142 look OK, 8 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestAccounts>:setup Error 0.00 test_accounts.py
ContextSuite context=TestAddVmToSubDomain>:setup Error 0.00 test_accounts.py
test_DeleteDomain Error 10.11 test_accounts.py
test_forceDeleteDomain Failure 10.00 test_accounts.py
ContextSuite context=TestRemoveUserFromAccount>:setup Error 10.89 test_accounts.py
ContextSuite context=TestTemplateHierarchy>:setup Error 12.38 test_accounts.py
ContextSuite context=TestDeployVmWithAffinityGroup>:setup Error 0.00 test_affinity_groups_projects.py
ContextSuite context=TestAnnotations>:setup Error 0.00 test_annotations.py
test_query_async_job_result Error 0.00 test_async_job.py
test_01_host_tags Error 60.57 test_host_tags.py
test_01_migrate_VM_and_root_volume Error 76.29 test_vm_life_cycle.py
test_02_migrate_VM_with_two_data_disks Error 23.59 test_vm_life_cycle.py
test_03_secured_to_nonsecured_vm_migration Error 373.88 test_vm_life_cycle.py
test_04_nonsecured_to_secured_vm_migration Error 0.01 test_vm_life_cycle.py
test_01_redundant_vpc_site2site_vpn Failure 425.49 test_vpc_vpn.py
test_hostha_enable_ha_when_host_disabled Error 3.68 test_hostha_kvm.py
test_hostha_enable_ha_when_host_in_maintenance Error 304.81 test_hostha_kvm.py

@github-actions
Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes CPU speed detection on KVM hosts by reordering the priority of CPU frequency detection methods in the lscpu command. The change ensures that hosts report their maximum achievable CPU frequency rather than the base frequency from the model name.

  • Swaps the order of CPU frequency detection: now tries "CPU max MHz" first, then falls back to model name frequency
  • Preserves S390x architecture-specific handling with the model name frequency detection block

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16139

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-15048)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 54458 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr12190-t15048-kvm-ol8.zip
Smoke tests completed. 148 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_03_deploy_and_scale_kubernetes_cluster Failure 28.97 test_kubernetes_clusters.py
test_01_redundant_vpc_site2site_vpn Failure 379.10 test_vpc_vpn.py

@DaanHoogland
Copy link
Contributor

@harikrishna-patnala @sureshanaparti , can you please review?

@blueorangutan
Copy link

[LL] Trillian Build Failed (tid-7170)

@rajujith
Copy link

@blueorangutan package

@blueorangutan
Copy link

@rajujith a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✔️ debian ✖️ suse15. SL-JID 16592

@DaanHoogland DaanHoogland added this to the 4.23.0 milestone Jan 28, 2026
@rajujith
Copy link

@blueorangutan package

@blueorangutan
Copy link

@rajujith a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16607

@DaanHoogland DaanHoogland force-pushed the cpu-lscpu-speed-detection-fix branch from e2b3a51 to 1a047ba Compare January 29, 2026 10:29
@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16619

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants