-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: 4.20
Are you sure you want to change the base?
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 15.80% 16.02% +0.22%
- Complexity 12586 12818 +232
============================================
Files 5627 5627
Lines 492343 492478 +135
Branches 59694 59682 -12
============================================
+ Hits 77828 78937 +1109
+ Misses 405992 404877 -1115
- Partials 8523 8664 +141
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.
This looks really good. I compared the original code and the refactored code line by line, and verified that their behavior is overall the same.
Also, I did some basic VM assign tests and verified that, before the patch, if an error occurred when updating the VM's network, the VM would be left in an inconsistent state (to result in an error, I passed the ID of a network that does not exist to the networkids
parameter). After the patch, a rollback is performed.
@stephankruggg @BryanMLima @DaanHoogland could someone change this PR to ready?
@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 11663 |
@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 11679 |
@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-11839)
|
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 ?
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.