-
Notifications
You must be signed in to change notification settings - Fork 20
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
Refactor Subnet lock for SubnetPort creation #974
Conversation
dc0b2c3
to
f78aabf
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #974 +/- ##
==========================================
- Coverage 73.37% 73.29% -0.08%
==========================================
Files 118 118
Lines 16394 16397 +3
==========================================
- Hits 12029 12019 -10
- Misses 3581 3591 +10
- Partials 784 787 +3
|
3637eec
to
e0ad08b
Compare
e0ad08b
to
590b20d
Compare
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.
a general comment: for the new introduced functions, could you add some docs to explain what the func is for? including the struct, import fields like "dirtyCounts" etc, it would be helpful for reviewer and other members to understand.
Signed-off-by: Yanjun Zhou <[email protected]>
590b20d
to
8494fed
Compare
Instead of using lock for Subnet, this PR adds a cache in SubnetPort service to record the number of SubnetPorts on each Subnet. Read/Write operation for this cache is protected by lock to avoid race condition and ensure the number of SubnetPort on the Subnet will be controlled below the Subnet capacity. Testing done: - Create 16 Pods on default SubnetSet with size 16 (capacity 12), got all Pods ready; delete all Pods and observe the Subnets under the SubnetSet will be deleted by GC. - Create 16 VMs on DHCPServer SubnetSet with size 16 (capacity 12), all Vms can get IP; delete all VMs and observe the Subnet under the SubnetSet will be deleted by GC. - Create 16 VMs on DHCPServer Subnet with size 16 (capacity 12), only 12 VMs can PowerOn and get IP. The remainings will have `VirtualMachineNetworkReady` as `NotReady` and Message like `network interface "eth0" error: subnetPort is not ready: SubnetPortNotReady - error occurred while processing the SubnetPort CR. Error: no valid IP in Subnet /orgs/default/projects/project-quality/vpcs/ns-1_7fcad11c-da38-4137-96ec-f0f80ae8d96b/subnets/subnet-test-1_60ebfa36-bbe2-4e6e-85df-8228be4e190a` Signed-off-by: Yanjun Zhou <[email protected]>
Instead of using lock for Subnet, this PR adds a cache in SubnetPort service to record the number of SubnetPorts on each Subnet. Read/Write operation for this cache is protected by lock to avoid race condition and ensure the number of SubnetPort on the Subnet will be controlled below the Subnet capacity. Testing done: - Create 16 Pods on default SubnetSet with size 16 (capacity 12), got all Pods ready; delete all Pods and observe the Subnets under the SubnetSet will be deleted by GC. - Create 16 VMs on DHCPServer SubnetSet with size 16 (capacity 12), all Vms can get IP; delete all VMs and observe the Subnet under the SubnetSet will be deleted by GC. - Create 16 VMs on DHCPServer Subnet with size 16 (capacity 12), only 12 VMs can PowerOn and get IP. The remainings will have `VirtualMachineNetworkReady` as `NotReady` and Message like `network interface "eth0" error: subnetPort is not ready: SubnetPortNotReady - error occurred while processing the SubnetPort CR. Error: no valid IP in Subnet /orgs/default/projects/project-quality/vpcs/ns-1_7fcad11c-da38-4137-96ec-f0f80ae8d96b/subnets/subnet-test-1_60ebfa36-bbe2-4e6e-85df-8228be4e190a` Signed-off-by: Yanjun Zhou <[email protected]>
Instead of using lock for Subnet, this PR adds a cache in SubnetPort service
to record the number of SubnetPorts on each Subnet.
Read/Write operation for this cache is protected by lock to avoid race condition
and ensure the number of SubnetPort on the Subnet will be controlled below
the Subnet capacity.
Testing done:
delete all Pods and observe the Subnets under the SubnetSet will be deleted by GC.
delete all VMs and observe the Subnet under the SubnetSet will be deleted by GC.
and get IP. The remainings will have
VirtualMachineNetworkReady
asNotReady
andMessage like
network interface "eth0" error: subnetPort is not ready: SubnetPortNotReady - error occurred while processing the SubnetPort CR. Error: no valid IP in Subnet /orgs/default/projects/project-quality/vpcs/ns-1_7fcad11c-da38-4137-96ec-f0f80ae8d96b/subnets/subnet-test-1_60ebfa36-bbe2-4e6e-85df-8228be4e190a