Skip to content

Standardize and improve KVMHostInfo class logging - #14226

Open
erikbocks wants to merge 2 commits into
apache:mainfrom
scclouds:standardize-kvmhostinfo-class-logs
Open

erikbocks wants to merge 2 commits into
apache:mainfrom
scclouds:standardize-kvmhostinfo-class-logs

Conversation

@erikbocks

Copy link
Copy Markdown
Collaborator

Description

The KVMHostInfo class used formatted strings for its logs and displayed an ERROR level log for a normal operation. This PR standardizes the class logging to use parametrized logging, and also fixes some typos in variable names

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

Screenshots (if appropriate):

How Has This Been Tested?

The code was built with Maven.

Copilot AI lite review requested due to automatic review settings September 22, 2026 19:04
@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.91%. Comparing base (602d9ec) to head (4b53ca8).

Files with missing lines Patch % Lines
...org/apache/cloudstack/utils/linux/KVMHostInfo.java 66.66% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14226      +/-   ##
============================================
- Coverage     19.91%   19.91%   -0.01%     
+ Complexity    20200    20198       -2     
============================================
  Files          6373     6373              
  Lines        577230   577238       +8     
  Branches      70696    70696              
============================================
- Hits         114974   114949      -25     
- Misses       449690   449725      +35     
+ Partials      12566    12564       -2     
Flag Coverage Δ
uitests 3.71% <ø> (ø)
unittests 21.18% <66.66%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 2 Medium severity · 1 Low severity

Open (3)
What changed in this PR

This PR standardizes KVMHostInfo logging to use parameterized logging (instead of String.format) and fixes a couple of typos/inconsistent names.

Changes:

  • Replace formatted-string logs with parameterized logs across CPU/memory discovery paths
  • Fix typos/inconsistent naming (cpabilities → capabilities, cpusockets → cpuSockets)
  • Add helper methods to centralize CPU-speed command logging and failure logging
File Description
plugins/​hypervisors/​kvm/​src/​main/​java/​org/​apache/​cloudstack/​utils/​linux/​KVMHostInfo.java Refactors logging to parameterized form, fixes naming/typos, and adds helper logging methods for CPU-speed retrieval

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +270 to +271
LOGGER.debug("Unable to retrieve the CPU speed from command [{}]. Trying another way to retrieve the CPU speed.", command);
LOGGER.trace(e);

private static void logFailureToGetCpuSpeedAndException(String command, Exception e) {
LOGGER.debug("Unable to retrieve the CPU speed from command [{}]. Trying another way to retrieve the CPU speed.", command);
LOGGER.trace(e);
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 23, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

Review effort: Lite
Findings: 3 Medium severity

Open (3)
Resolved since last review (1)


private static void logFailureToGetCpuSpeedAndException(String command, Exception e) {
LOGGER.debug("Unable to retrieve the CPU speed from command [{}]. Trying another way to retrieve the CPU speed.", command);
LOGGER.trace(e);

This branch has not been deployed

No deployments
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.

2 participants