winterhazel opened a new pull request, #14383:
URL: https://github.com/apache/cloudstack/pull/14383

   ### Description
   
   This PR is a minimal follow-up to #12190. A few refactorings and adjustments 
will be done in a separate PR targeting `main`.
   
   #12190 changed the order in which the KVM Agent retrieves the CPU speed from 
`lscpu`, so that `CPU max MHz` is preferred over the frequency advertised in 
the model name. However, the host CPU speed is not only informative. It is used 
to:
   
   - calculate the CPU capacity of the host (`cores * speed`);
   - calculate the CPU quota of VMs that use a compute offering with CPU cap 
enabled (`VM speed / host speed`).
   
   `CPU max MHz` may include the turbo frequency, which the CPU is not able to 
sustain; thus, it is not a suitable value for these calculations. Besides that, 
its meaning depends on the cpufreq driver in use: with 
`intel_pstate`/`amd-pstate` it is the turbo frequency, with `acpi-cpufreq` it 
is the base frequency plus 1 MHz, and without a cpufreq driver it is not 
reported at all.
   
   As a consequence, the change impacts existing VMs with CPU cap enabled. 
Considering a host with a base frequency of 2.9 GHz and a maximum frequency of 
4.8 GHz, a VM using a CPU cap enabled offering with 2.9 GHz does not have its 
CPU time limited. After #12190, once the Agent reconnects and the VM is started 
or migrated, it is able to use only ~60% of the CPU time, making users feel 
that the performance of their VMs degraded out of nowhere.
   
   Therefore, this PR:
   
   - restores the previous order of the `lscpu` checks to the same behavior 
that existed before #12190;
   - exposes the maximum frequency of the CPU as a new host detail 
(`host.cpu.max.speed.mhz`), which is returned in the `details` of the 
`listHosts` API and shown in the details of the host in the UI as `CPU maximum 
frequency (turbo)`. This value is only informative; it is not used in capacity 
or CPU quota calculations.
   
   Operators that want a host to be registered with a specific CPU speed, such 
as the turbo frequency, can still do so through the `host.cpu.manual.speed.mhz` 
property in `agent.properties`.
   
   ### 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
   
   #### Bug Severity
   
   - [X] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   Tests are still pending.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to