Skip to content

KVM VM migration log refactor - #14224

Open
erikbocks wants to merge 6 commits into
apache:mainfrom
scclouds:kvm-vm-migration-log-refactor
Open

erikbocks wants to merge 6 commits into
apache:mainfrom
scclouds:kvm-vm-migration-log-refactor

Conversation

@erikbocks

Copy link
Copy Markdown
Collaborator

Description

This PR focuses on improving the consistency and clarity of logging of the KVM VM migration process. The changes aim to improve the traceability of the process, by adding more context for the logs, helping future troubleshooting processes. It also standardizes log messages to use parametrized logging, instead of string concatenation.

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 compiled with Maven and installed to my local environment. Then, I migrated a VM from one of my hosts to another and verified that the new logs were displayed correctly.

@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 13.33333% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.39%. Comparing base (602d9ec) to head (7d743e2).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...resource/wrapper/LibvirtMigrateCommandWrapper.java 14.28% 24 Missing ⚠️
...n/java/com/cloud/vm/VirtualMachineManagerImpl.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14224      +/-   ##
============================================
+ Coverage     19.91%   20.39%   +0.47%     
- Complexity    20200    21280    +1080     
============================================
  Files          6373     6481     +108     
  Lines        577230   588037   +10807     
  Branches      70696    72016    +1320     
============================================
+ Hits         114974   119948    +4974     
- Misses       449690   455059    +5369     
- Partials      12566    13030     +464     
Flag Coverage Δ
uitests 3.70% <ø> (-0.01%) ⬇️
unittests 21.69% <13.33%> (+0.50%) ⬆️

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: 7 Medium severity · 3 Low severity

Open (10)
What changed in this PR

Refactors KVM VM migration logging to be more consistent and contextual, primarily by switching to parameterized logging and standardizing messages for troubleshooting.

Changes:

  • Replaced String.format/string concatenation with parameterized logging across KVM migration flow.
  • Expanded log context (destination host, XML retrieval flag, job stats) for better traceability.
  • Tweaked log levels/messages around migration timeouts and exception handling.
File Description
plugins/​hypervisors/​kvm/​src/​main/​java/​com/​cloud/​hypervisor/​kvm/​resource/​wrapper/​LibvirtMigrateCommandWrapper.java Standardizes and enriches migration logs; adjusts log levels and message structure.
engine/​orchestration/​src/​main/​java/​com/​cloud/​vm/​VirtualMachineManagerImpl.java Fixes/standardizes config-drive detach logging and improves message quality.

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

@erikbocks erikbocks changed the title Kvm vm migration log refactor KVM VM migration log refactor Oct 13, 2026
Copilot AI lite review requested due to automatic review settings October 13, 2026 13:32
@Damans227

Copy link
Copy Markdown
Collaborator

thanks @erikbocks, log changes look right. LGTM

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

4 open findings
10 resolved since last review

🧠 Review effort: Lite

Comment thread engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java Outdated
Copilot AI lite review requested due to automatic review settings October 13, 2026 13:57

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.

Comment thread engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 14, 2026 16:12

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.

Comment thread engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java Outdated
Copilot AI lite review requested due to automatic review settings October 19, 2026 13:25

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.

try {
_agentMgr.send(srcHost.getId(), dettachCommand);
logger.debug("Deleted config drive ISO for vm {} in host {}", vm.getInstanceName(), srcHost);
logger.debug("Deleted config drive ISO for VM {} in host {}.", vm.getInstanceName(), srcHost.getId());
}
}
logger.info(String.format("Migration thread of VM [%s] finished.", vmName));
logger.info("Migration thread of VM [{}] finished.", vmName);
result = e.getMessage();
if (result.startsWith("unable to connect to server") && result.endsWith("refused")) {
logger.debug("Migration failed as connection to destination [{}] was refused. Please check libvirt configuration compatibility and firewall rules on the source and destination hosts.", destinationUri);
logger.debug("Migration failed as connection to destination [{}] was refused. Please check Libvirt configuration compatibility and firewall rules on the source and destination hosts.", destinationUri);

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.

3 participants