-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixup vm powerstate update #8545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DaanHoogland
merged 7 commits into
apache:4.19
from
shapeblue:fixup-vm-powerstate-update
Feb 19, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c9ef2a5
Update VM's state if powerstate & state are not in sync
vishesh92 2c383a6
Add unit tests
vishesh92 3437f5c
some code improvements for instacne / power state check
sureshanaparti 17ea9e7
Update power state after vm stop confirmation (as power state 'PowerO…
sureshanaparti b3580ba
Reset the power state update counter before migrate, to allow power s…
sureshanaparti 007b0a8
Do not consider transitional states (Starting, Stopping) to check pow…
sureshanaparti cc8bd7b
set powerstate to off for all vm types
vishesh92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the database these fields are nullable. Are we sure these are not potential NPE´s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code below gets cpu/ram from user_vm_details if it is null in service offering.
ServiceOfferingVO offering = _offeringDao.findById(vm.getId(), vm.getServiceOfferingId());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Wei said, it's handled in
OfferingDao'sfindById.cloudstack/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDaoImpl.java
Lines 171 to 182 in a31449b
cloudstack/engine/schema/src/main/java/com/cloud/service/dao/ServiceOfferingDaoImpl.java
Lines 205 to 219 in a31449b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Long(null)also throws a NPE. So, this is not really relevant to this PR but a minor code improvement.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the method has been used in many places, it works well.
No need to add a null check I think.
anyway , good question @DaanHoogland
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, guys, I agree i think, if we get an NPE a check would not help us take measure against it. decreasing by 0 (zero) does not make sense either.
Any improvement on this would be out of scope for this PR and I think it might not be high prio (just good to keep in mind)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah
A check can be added in the code Vishesh shared above.
For example
return validateOfferingParameters(offering)