-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Rollback of changes with errors during the VM assign #7061
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
Rollback of changes with errors during the VM assign #7061
Conversation
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.
lots of refactoring.
I am not sure if the code is good or not. Maybe others can check.
@stephankruggg
can you point out the key point of your change ?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.20 #7061 +/- ##
============================================
+ Coverage 16.07% 16.13% +0.06%
- Complexity 12883 12965 +82
============================================
Files 5639 5639
Lines 494193 494241 +48
Branches 59925 59896 -29
============================================
+ Hits 79419 79753 +334
+ Misses 405944 405667 -277
+ Partials 8830 8821 -9
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@weizhouapache, when assigning a VM to another account ( The refactoring is intended to make the code more testable, readable, and easier to maintain. |
@stephankruggg it seems the key block is
|
@blueorangutan package |
@rohityadavcloud a Jenkins job has been kicked to build packages. It will be bundled with SystemVM template(s). I'll keep you posted as I make progress. |
Packaging result: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 5302 |
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.
overall code lgtm.
left 2 minor comments.
@stephankruggg
can you ask your team to test this and share the testing result as a comment ?
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
8ecc838
to
5a23d33
Compare
Kudos, SonarCloud Quality Gate passed! |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
@stephankruggg can you look at the conflicts? (cc @BryanMLima ) |
@stephankruggg is anybody looking at this (or should we postpone)? |
@GaOrtiga can you take at this one, please? |
Hi guys, sorry for the delay.
Yes.
I have fixed the conflicts and will run some tests in the next few days before pushing the changes. |
5a23d33
to
125353b
Compare
@blueorangutan package |
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.
clgtm, though a lot of changes there are unit tests to support those. I don't think there is an integration test supporting this scenario, but as it is a bit niche I think we can risk merging. Do you agree @weizhouapache ?
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
@blueorangutan package |
@winterhazel 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. |
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 12014 |
@blueorangutan package |
@winterhazel 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. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12016 |
@blueorangutan test |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-12067)
|
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.
CLGTM
these are a generic issue on 4.20 and not specific to this PR. Is there any more testing required for this @stephankruggg ? |
I don't think we require more testing. I already validated that it fixed the original issue, and took a good look at the code comparing it with the current version to ensure that the behavior is the same. |
Co-authored-by: Stephan Krug <[email protected]> Co-authored-by: Gabriel <[email protected]> Co-authored-by: Fabricio Duarte <[email protected]>
Description
When assigning a VM to another account (
assignVirtualMachine API
), if a network error happens during the process, no rollback is executed; thus, leaving the DB in an inconsistent state.This PR fixes this by processing all steps to change the ownership of a VM inside the transaction. It also refactors code related to this procedure.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
In a local lab, I created a VM and an account of user type. I then attempted to assign the admin's VM to the user by using a network not accessible to the user.
Before applying the changes, an error was raised, but the VM was listed as belonging to the user.
After applying the changes, an error was raised, and the VM was listed as belonging to the admin - no changes occurred.