-
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
Fix for race when automatically assigning IP to Vms #9240
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.19 #9240 +/- ##
============================================
+ Coverage 14.96% 14.98% +0.01%
- Complexity 11013 11048 +35
============================================
Files 5377 5389 +12
Lines 469567 470615 +1048
Branches 60162 57503 -2659
============================================
+ Hits 70285 70517 +232
- Misses 391498 392263 +765
- Partials 7784 7835 +51
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
...hestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
Outdated
Show resolved
Hide resolved
right now, this means when allocating for the GuestNetworkGuru. Can you look at @hsato03 's implementation (together with him) to see if it can be unified? |
@abh1sar can you review and address outstanding comments? And, can you care to run packaging and smoketests for your own PRs that are ready for review. |
@rohityadavcloud 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]: ✖️ el7 ✔️ el8 ✔️ el9 ✖️ debian ✔️ suse15. SL-JID 10097 |
@blueorangutan package |
@sureshanaparti 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]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10101 |
@blueorangutan package |
@abh1sar 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]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10135 |
@blueorangutan test |
@abh1sar a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
[SF] Trillian test result (tid-10631)
|
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.
lgtm
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
* Fix for race when automatically assigning IP to Vms * code refactor
This code snippet has been removed in the merge forward of PR apache#9240 in commit 90fe1d5
This code snippet has been removed in the merge forward of PR apache#9240 in commit 90fe1d5
Description
Fixes: #7907
This PR fixes the issue where two VMs can be assigned the same IP if they are created at the same time.
NetworkOrchestrator.allocateNic()
callsguru.alocate()
which returns a free IP address.NetworkOrchestrator.allocateNic()
then calls_nicDao.persists()
But
guru.allocate()
can return same IPs to two VMs if the first VM hasn't persisted the nic to the DB yet.Doing the whole thing in a transaction might be costly.
So the fix is to check if the IP returned by guru.allocate is already assigned just before persisting the NicVO in a transaction.
Check will be done only for cases where Ipv4 allocation might race.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Wasn't possible to reproduce the actual race, but I tested by manually setting values with debugger and verifying that the code does what it is supposed to.
How did you try to break this feature and the system with this change?