check state instead of power state on change offering for ROOT volume#13271
Open
DaanHoogland wants to merge 2 commits into
Open
check state instead of power state on change offering for ROOT volume#13271DaanHoogland wants to merge 2 commits into
DaanHoogland wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
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()touserVm.getState()inresizeVolumeInternal. - Apply the same state-based validation in
validateVolumeReadyStateAndHypervisorChecks. - Update corresponding log/error messages to reference
Stoppedstate.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2319
to
2324
| if (Volume.Type.ROOT.equals(volume.getVolumeType()) | ||
| && ! State.Stopped.equals(userVm.getState()) | ||
| && HypervisorType.VMware.equals(hypervisorType)) { | ||
| logger.error("For ROOT volume resize VM should be in Stopped state."); | ||
| throw new InvalidParameterValueException("VM current state is : " + userVm.getState() + ". But VM should be in " + State.Stopped + " state."); | ||
| } |
| logger.error(" For ROOT volume resize VM should be in Power Off state."); | ||
| throw new InvalidParameterValueException("VM current state is : " + userVm.getPowerState() + ". But VM should be in " + VirtualMachine.PowerState.PowerOff + " state."); | ||
| if (Volume.Type.ROOT.equals(volume.getVolumeType()) | ||
| && ! State.Stopped.equals(userVm.getState()) |
| && ! State.Stopped.equals(userVm.getState()) | ||
| && HypervisorType.VMware.equals(hypervisorType)) { | ||
| logger.error("For ROOT volume resize VM should be in Stopped state."); | ||
| throw new InvalidParameterValueException("VM current state is : " + userVm.getState() + ". But VM should be in " + State.Stopped + " state."); |
| && !State.Stopped.equals(userVm.getState()) | ||
| && hypervisorType == HypervisorType.VMware) { | ||
| logger.error("For ROOT volume resize VM should be in Stopped state."); | ||
| throw new InvalidParameterValueException("VM current state is : " + userVm.getState() + ". But VM should be in " + State.Stopped + " state."); |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #13271 +/- ##
=========================================
Coverage 17.67% 17.68%
- Complexity 15792 15797 +5
=========================================
Files 5922 5922
Lines 533165 533169 +4
Branches 65208 65212 +4
=========================================
+ Hits 94242 94291 +49
+ Misses 428276 428219 -57
- Partials 10647 10659 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR...
Fixes: #13261
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?