Skip to content

check state instead of power state on change offering for ROOT volume#13271

Open
DaanHoogland wants to merge 5 commits into
apache:4.22from
shapeblue:ghi13261-changeOffering
Open

check state instead of power state on change offering for ROOT volume#13271
DaanHoogland wants to merge 5 commits into
apache:4.22from
shapeblue:ghi13261-changeOffering

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR...

Fixes: #13261

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 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code 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.

Pull request overview

Updates ROOT volume resize/offering-change validation for VMware to use the VM state (e.g., Stopped) instead of the VM power_state (e.g., PowerOff), addressing cases where VMware power state lags and incorrectly blocks disk offering changes.

Changes:

  • Switch VMware ROOT-volume validation from userVm.getPowerState() to userVm.getState() in resizeVolumeInternal.
  • Apply the same state-based validation in validateVolumeReadyStateAndHypervisorChecks.
  • Update corresponding log/error messages to reference Stopped state.

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

Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java
Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Outdated
Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Outdated
Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Outdated
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.53846% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.67%. Comparing base (21b2025) to head (4f36ed6).
⚠️ Report is 37 commits behind head on 4.22.

Files with missing lines Patch % Lines
...n/java/com/cloud/storage/VolumeApiServiceImpl.java 61.53% 1 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #13271      +/-   ##
============================================
- Coverage     17.67%   17.67%   -0.01%     
- Complexity    15792    15796       +4     
============================================
  Files          5922     5923       +1     
  Lines        533165   533313     +148     
  Branches      65208    65242      +34     
============================================
+ Hits          94242    94256      +14     
- Misses       428276   428395     +119     
- Partials      10647    10662      +15     
Flag Coverage Δ
uitests 3.69% <ø> (-0.01%) ⬇️
unittests 18.74% <61.53%> (-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.

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test ol9 vmware-80u3

@DaanHoogland DaanHoogland requested a review from winterhazel June 21, 2026 11:29
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

test_01_vpn_usage Error 1.07 test_usage.py

seems the only consistent error. checking latest main...

@winterhazel winterhazel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I did not test, but it looks ok.

Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Outdated
Comment thread server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java Outdated
Comment thread server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java Outdated
Comment thread server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java Outdated
Comment thread server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java Outdated
Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Outdated
Comment thread server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java Outdated
Comment thread server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java Outdated
Comment thread server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java Outdated
Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Outdated
Comment thread server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java Outdated
Co-authored-by: Fabricio Duarte <fabricio.duarte.jr@gmail.com>
Co-authored-by: dahn <daan.hoogland@gmail.com>
Comment thread server/src/test/java/com/cloud/storage/VolumeApiServiceImplTest.java Outdated
@apache apache deleted a comment from blueorangutan Jul 2, 2026
@apache apache deleted a comment from blueorangutan Jul 2, 2026
@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 18445

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan test ol9 vmware-80u3

@apache apache deleted a comment from blueorangutan Jul 3, 2026
@apache apache deleted a comment from blueorangutan Jul 3, 2026
@apache apache deleted a comment from blueorangutan Jul 3, 2026
@apache apache deleted a comment from blueorangutan Jul 3, 2026
@apache apache deleted a comment from blueorangutan Jul 3, 2026
@apache apache deleted a comment from blueorangutan Jul 3, 2026
@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (ol9 mgmt + vmware-80u3) has been kicked to run smoke tests

@apache apache deleted a comment from blueorangutan Jul 3, 2026
@apache apache deleted a comment from blueorangutan Jul 3, 2026
@apache apache deleted a comment from blueorangutan Jul 3, 2026
@apache apache deleted a comment from blueorangutan Jul 3, 2026
@DaanHoogland DaanHoogland requested a review from Copilot July 3, 2026 14:27

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 4 comments.

Comment on lines +2363 to +2365
// snapshotDaoMock returns an empty list by default (Mockito default behaviour)
when(volumeDaoMock.getHypervisorType(volumeId)).thenReturn(HypervisorType.VMware);

Comment on lines +2397 to +2398
when(volumeDaoMock.getHypervisorType(volumeId)).thenReturn(HypervisorType.VMware);

Comment on lines +2375 to +2377
// Must complete without throwing any exception
volumeApiServiceImpl.validateVolumeReadyStateAndHypervisorChecks(volume, currentSizeBytes, newSizeBytes);
}
&& !State.Stopped.equals(userVm.getState())
&& HypervisorType.VMware.equals(hypervisorType)) {
logger.error("For ROOT volume resize VM should be in Stopped state.");
throw new InvalidParameterValueException("The current VM state is '" + userVm.getState() + "'. But VM should be in " + State.Stopped + " state.");
@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-16475)
Environment: vmware-80u3 (x2), zone: Advanced Networking with Mgmt server ol9
Total time taken: 63441 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr13271-t16475-vmware-80u3.zip
Smoke tests completed. 147 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_08_arping_in_ssvm Failure 5.21 test_diagnostics.py
ContextSuite context=TestISOUsage>:setup Error 0.00 test_usage.py
test_01_vpn_usage Error 1.09 test_usage.py

@DaanHoogland

Copy link
Copy Markdown
Contributor Author

All co-pilot comments are about unit tests that are passing, so they make no sense to me.

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-16479)
Environment: vmware-80u3 (x2), zone: Advanced Networking with Mgmt server ol9
Total time taken: 74503 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr13271-t16479-vmware-80u3.zip
Smoke tests completed. 146 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_08_upgrade_kubernetes_ha_cluster Failure 3674.80 test_kubernetes_clusters.py
test_02_list_cpvm_vm Failure 0.03 test_ssvm.py
test_04_cpvm_internals Failure 0.04 test_ssvm.py
test_01_vpn_usage Error 1.10 test_usage.py

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.

Failed to change offering of ROOT volume on VMware

5 participants