winterhazel opened a new pull request, #14384: URL: https://github.com/apache/cloudstack/pull/14384
### Description This is a breaking change, so additional discussion may be required. It also contains the changes of #14383, so please review and merge the latter previously. Many CPUs (notably AMD EPYC) do not advertise a frequency in the model name, so those hosts fell back to `CPU max MHz`, which can include the turbo frequency. Since the host CPU speed is used to compute host capacity (`cpus * speed`) and the CPU quota of VMs with CPU cap enabled, using a turbo value is not correct because it is not a frequency the CPU can actually sustain. This PR inserts the CPU frequency sysfs files (`/sys/devices/system/cpu/cpu0/cpufreq/base_frequency`, then `scaling_max_freq`) before the `lscpu` maximum frequency fallback, so the resolution order becomes: 1. base frequency advertised in the `lscpu` `Model name` field (x86) or `CPU dynamic MHz` (s390x) 2. CPU frequency sysfs file (`base_frequency`, then `scaling_max_freq`) 3. `lscpu` `CPU max MHz` 4. `lscpu` host capabilities 5. libvirt `NodeInfo.mhz` Behaviour for Intel hosts (whose model name carries `@ x.xxGHz`) is unchanged. Additionally, I made a few refactorings throughout the `KVMHostInfo` file. ### Types of changes - [X] 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 ### 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]
