Skip to content

make updating the vmdk descriptor optional - #13773

Draft
DaanHoogland wants to merge 3 commits into
apache:4.20from
shapeblue:ghi13249-vmwareAttachVolume
Draft

make updating the vmdk descriptor optional#13773
DaanHoogland wants to merge 3 commits into
apache:4.20from
shapeblue:ghi13249-vmwareAttachVolume

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR...

Fixes: #13249

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?

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 adjusts VMware volume attach behavior so that failures while verifying/updating a VMDK’s descriptor (adapter type) no longer prevent attachDisk from proceeding, addressing attach failures seen when vCenter datastore browser access returns HTTP 500 (issue #13249). It also adds a unit test to ensure attachDisk succeeds even when the adapter-type update step fails.

Changes:

  • Make updateVmdkAdapter(...) best-effort during VirtualMachineMO.attachDisk(...) by catching and logging failures, then continuing the attach.
  • Add a unit test covering the “adapter update fails but attach continues” scenario.

Reviewed changes

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

File Description
vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java Wraps updateVmdkAdapter in a try/catch so attach can proceed when descriptor update/verification fails.
vmware-base/src/test/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMOTest.java Adds a test validating attachDisk does not fail when updateVmdkAdapter throws.

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

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.27%. Comparing base (549daae) to head (55c3888).

Files with missing lines Patch % Lines
...m/cloud/hypervisor/vmware/mo/VirtualMachineMO.java 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #13773   +/-   ##
=========================================
  Coverage     16.26%   16.27%           
- Complexity    13434    13439    +5     
=========================================
  Files          5667     5667           
  Lines        500731   500735    +4     
  Branches      60803    60803           
=========================================
+ Hits          81455    81477   +22     
+ Misses       410172   410135   -37     
- Partials       9104     9123   +19     
Flag Coverage Δ
uitests 4.14% <ø> (ø)
unittests 17.12% <60.00%> (+<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.

@DaanHoogland
DaanHoogland requested a review from Copilot August 3, 2026 09:50

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

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

Suppressed comments (2)

vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java:1474

  • The PR title says making descriptor updates optional, but the code only treats IOException as non-fatal. If updateVmdkAdapter(...) can fail with non-IO exceptions (e.g., runtime parsing/format issues), disk attach would still fail. Either broaden the handled failure modes (if the intent is truly optional) or clarify scope in the PR description/title (e.g., 'optional on datastore browser I/O errors') so behavior matches the stated intent.
                try {
                    updateVmdkAdapter(vmdkFileName, diskController);
                } catch (IOException e) {
                    logger.warn("Unable to verify/update adapter type for VMDK file " + vmdkFileName + " due to a datastore browser I/O failure, proceeding with disk attach: " + e.getMessage(), e);
                }

vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java:1473

  • This log line uses string concatenation and appends e.getMessage() while also passing e as the throwable. Consider using parameterized logging (placeholders) and omit e.getMessage() since the stack trace already contains it; this avoids unnecessary string building when warn logging is disabled and prevents duplicated error text.
                    logger.warn("Unable to verify/update adapter type for VMDK file " + vmdkFileName + " due to a datastore browser I/O failure, proceeding with disk attach: " + e.getMessage(), e);

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18747

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