-
Notifications
You must be signed in to change notification settings - Fork 316
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
[Driver] Enhancement for concurrency #1195
base: development
Are you sure you want to change the base?
[Driver] Enhancement for concurrency #1195
Conversation
@@ -419,16 +464,21 @@ func (ds *dockServer) UpdateVolumeGroup(ctx context.Context, opt *pb.UpdateVolum | |||
|
|||
func (ds *dockServer) DeleteVolumeGroup(ctx context.Context, opt *pb.DeleteVolumeGroupOpts) (*pb.GenericResponse, error) { | |||
// Get the storage drivers and do some initializations. | |||
ds.Driver = drivers.Init(opt.GetDriverName()) | |||
defer drivers.Clean(ds.Driver) | |||
driver, err := drivers.Init(opt.GetDriverName()) |
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.
Why cannot be this part of the code moved to a new func, say init() and called everywhere? It is repetition of code
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.
I just followed the original code logic, however, yes it is repeated.
I'd rather leave this improvement to another pr.
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.
The issue of concurrency happens just because there is no proper error handling? |
@@ -102,7 +107,7 @@ func Init(resourceType string) VolumeDriver { | |||
d = &spectrumscale.Driver{} | |||
break | |||
case config.HuaweiOceanStorBlockDriverType: | |||
d = &oceanstor.Driver{} | |||
d = &OceanStorDriver |
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.
Any Specific reason to change this format of calling (drivername.Driver{}). I saw above is declared same as variable.
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.
OceanStorDriver is defined as a global variable, so each time we call Init for Huawei OceanStor driver, we can get the same driver object, not create a new one as before.
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's also for the concurrency circumstance, because each oceanstor driver maintains a connect to OceanStor storage, if there are big concurrency invokes, the connection number may exceed the limit of OceanStor.
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
@@ -136,7 +146,7 @@ func Clean(d VolumeDriver) VolumeDriver { | |||
case *spectrumscale.Driver: | |||
break | |||
case *oceanstor.Driver: | |||
break | |||
return // No need to clean anything for oceanstor |
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.
What happen, if i really mean to unset/clean the driver??
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.
oceanstor driver's unset operation just close the connection to back storage, cause we use the same global oceanstor driver for each call now, so there's no need to unset anymore. Instead, we want to keep the connection session active consistently.
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
@@ -148,10 +158,9 @@ func Clean(d VolumeDriver) VolumeDriver { | |||
default: | |||
break | |||
} | |||
|
|||
d.Unset() |
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.
It's better to handle Unset error also. I have seen you have handled the error in Setup()
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 the old code's implementation, I think the unset error is ignorable, so I didn't change here.
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
Can you please check CI issues |
@sushanthakumar Please check the CI issue |
Codecov Report
@@ Coverage Diff @@
## development #1195 +/- ##
===============================================
- Coverage 34.82% 34.66% -0.17%
===============================================
Files 97 97
Lines 17622 17705 +83
===============================================
Hits 6137 6137
- Misses 10614 10688 +74
- Partials 871 880 +9
|
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.
Is it possble to get test report from one more driver(say LVM). Since the changes are impacted in core driver code. It would be better to test at least with 2 drivers.
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
What this PR does / why we need it:
This PR is for enhancement for concurrency scenarios at driver side
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #This PR fixes attach part of the issue : #1197
Special notes for your reviewer:
Test Steps:
Create multiple attachments through multiple pod creation simultaneously
Verify the volume and attachments states
Release note: