kvm: get ip address of Windows vms via virsh domifaddr by weizhouapache · Pull Request #12651 · apache/cloudstack · GitHub
Skip to content

kvm: get ip address of Windows vms via virsh domifaddr#12651

Open
weizhouapache wants to merge 2 commits into
apache:4.22from
weizhouapache:4.22-fix-ip-addr-of-windows-vm
Open

kvm: get ip address of Windows vms via virsh domifaddr#12651
weizhouapache wants to merge 2 commits into
apache:4.22from
weizhouapache:4.22-fix-ip-addr-of-windows-vm

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

Description

This PR fixes #12649

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@weizhouapache weizhouapache added this to the 4.22.1 milestone Feb 16, 2026
@codecov

codecov Bot commented Feb 16, 2026

Copy link
Copy Markdown

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.

Pull request overview

This PR fixes issue #12649 where KVM IP autodiscovery failed for Windows VMs due to multi-word interface names like "Ethernet Instance 0". The fix changes the parsing logic in getIpAddresses to parse virsh domifaddr output from the end of each line rather than from fixed positions, making it compatible with both single-word Linux interface names and multi-word Windows interface names.

Changes:

  • Modified parsing logic to use relative positions from end of line (parts.length - 3, parts.length - 2, parts.length - 1) instead of fixed positions
  • Added test data constant VIRSH_DOMIF_OUTPUT_WINDOWS with realistic Windows virsh output
  • Updated testExecuteWithWindowsVm to test parsing of Windows interface names with spaces

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
LibvirtGetVmIpAddressCommandWrapper.java Changed parsing to use relative positions from end of line to handle multi-word interface names
LibvirtGetVmIpAddressCommandWrapperTest.java Added Windows-specific test data and updated/added tests for Windows VM IP discovery

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@weizhouapache

Copy link
Copy Markdown
Member Author

for anyone who use 4.22.0.0, please rename the .jar.zip file to .jar, and replace /usr/share/cloudstack-agent/lib/cloud-plugin-hypervisor-kvm-4.22.0.0.jar with it on kvm hosts.

cloud-plugin-hypervisor-kvm-4.22.0.0.jar.zip

@sureshanaparti

Copy link
Copy Markdown
Contributor

@weizhouapache is it ready for review and testing?

@weizhouapache weizhouapache marked this pull request as ready for review February 26, 2026 12:56
@weizhouapache

Copy link
Copy Markdown
Member Author

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

lgtm, confirmed by myself as well as a 3rd party

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.

KVM IP autodiscovery not working with Windows interface names

4 participants