cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Fix lscpu speed checking order

Open guillemtp opened this issue 3 weeks ago • 9 comments

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)
  • [X] 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
  • [X] Minor

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [ ] Minor
  • [X] 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

guillemtp avatar Dec 04 '25 14:12 guillemtp

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:

  • In case of a new feature add useful documentation (raise doc PR at https://github.com/apache/cloudstack-documentation)
  • Be patient and persistent. It might take some time to get a review or get the final approval from the committers.
  • Pay attention to the quality of your code, ensure tests are passing and your PR doesn't have conflicts.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Issues, Mailing list and Slack.
  • Be sure to read the CloudStack Coding Conventions. Apache CloudStack is a community-driven project and together we are making it better 🚀. In case of doubts contact the developers at: Mailing List: [email protected] (https://cloudstack.apache.org/mailing-lists.html) Slack: https://apachecloudstack.slack.com/

boring-cyborg[bot] avatar Dec 04 '25 14:12 boring-cyborg[bot]

@blueorangutan package

DaanHoogland avatar Dec 08 '25 09:12 DaanHoogland

@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.

blueorangutan avatar Dec 08 '25 09:12 blueorangutan

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 3.58%. Comparing base (2600965) to head (f567935). :warning: Report is 4 commits behind head on main.

:exclamation: There is a different number of reports uploaded between BASE (2600965) and HEAD (f567935). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (2600965) HEAD (f567935)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               main   #12190       +/-   ##
=============================================
- Coverage     17.57%    3.58%   -13.99%     
=============================================
  Files          5913      445     -5468     
  Lines        529427    37538   -491889     
  Branches      64677     6905    -57772     
=============================================
- Hits          93024     1347    -91677     
+ Misses       425940    36025   -389915     
+ Partials      10463      166    -10297     
Flag Coverage Δ
uitests 3.58% <ø> (ø)
unittests ?

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Dec 08 '25 09:12 codecov[bot]

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

blueorangutan avatar Dec 08 '25 10:12 blueorangutan

Debian build failed, retrying that.

DaanHoogland avatar Dec 08 '25 10:12 DaanHoogland

@blueorangutan test

DaanHoogland avatar Dec 08 '25 10:12 DaanHoogland

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

blueorangutan avatar Dec 08 '25 11:12 blueorangutan

[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

blueorangutan avatar Dec 09 '25 04:12 blueorangutan