-
Notifications
You must be signed in to change notification settings - Fork 944
feature: support to choose storage driver #2525
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
feature: support to choose storage driver #2525
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2525 +/- ##
==========================================
- Coverage 69.17% 54.77% -14.4%
==========================================
Files 278 276 -2
Lines 18623 18655 +32
==========================================
- Hits 12883 10219 -2664
- Misses 4268 7329 +3061
+ Partials 1472 1107 -365
|
7f317c6 to
b3a71b5
Compare
b3a71b5 to
bc8ce30
Compare
|
Thanks for your work, @wangforthinker . I am afraid that there are still a few things you need to do:
|
6a53a15 to
37a4dda
Compare
2761ba9 to
efffb26
Compare
vendor/github.com/containerd/containerd/image.go
Outdated
Show resolved
Hide resolved
c0f9863 to
70d59e0
Compare
4f8f093 to
047ca07
Compare
|
I have some confusions: @wangforthinker
In addition, I would like to invite @Ace-Tang @fuweid to take a look at of the feature. |
daemon/daemon_utils.go
Outdated
| } | ||
|
|
||
| if found { | ||
| driverFound = found |
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 think it should break loop at here.
And no need to add more found, just use driverFound, like this:
for _, info := range infos {
var err error
driverFound, err = checkSnapshotterDir(snapshotter, containerdRootDir, info)
if err != nil {
return err
}
if driverFound {
return nil
}
}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.
If a driver is found in containerd snapshotter, we also need to check other snapshotter dir whether it exists snapshots. If another snapshotter has snapshots, another snapshotter may be set last startup by pouchd. @rudyfly
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.
Not followed what you say, why should check other snapshotter after found
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.
For example, We start pouchd with overlayfs and then pull some images and create containers. Then we restart pouchd with brtfs. Overlayfs and btrfs are all supported by containerd, but the startup with btrfs should fail, otherwise previous images and containers may be in wrong use. It is important to make sure snapshotter to be consistent, except snapshots have been removed. @Ace-Tang
047ca07 to
057a7e1
Compare
Yes, we vendor some update from aliababa/containerd. @allencloud |
| "revision": "773c489c9c1b21a6d78b5c538cd395416ec50f88", | ||
| "revisionTime": "2018-04-02T20:34:37Z", | ||
| "revision": "8d8f780274f3fcf2efb5d21c25569b6fc3bb08fb", | ||
| "revisionTime": "2018-12-05T03:53:22Z", |
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.
could you mind to provide the method about how to update vendor? Thanks
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.
govendor update github.com/containerd/containerd
这个是在更新到本地的containerd版本。
d558714 to
058c5d8
Compare
df0c310 to
ba7fa51
Compare
ctrd/snapshot.go
Outdated
| service := wrapperCli.client.SnapshotService(defaultSnapshotterName) | ||
| // Allow user to walk snapshots of specific snapshotter | ||
| snapshotter := CurrentSnapshotterName() | ||
| if sn, ok := ctx.Value(SnapshotterKey).(string); ok { |
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 don't think that the change is reasonable. I think we should change the interface so that the user can pass the specific snapshoter type for walk.
WalkSnapshot(ctx context.Context, snapshot string, fn func(context.Context, snapshots.Info) error) error
WDYT?
daemon/daemon_utils.go
Outdated
| } | ||
|
|
||
| // checkSnapshotter checks whether the given snapshotter is valid | ||
| func checkSnapshotter(snapshotter string, ctrdClient ctrd.APIClient) error { |
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.
how about checkConflictSnapshotter? I think the function name should be more specific. WDYT?
daemon/daemon_utils.go
Outdated
| return nil | ||
| } | ||
|
|
||
| func checkSnapshots(snapshotter string, ctrdClient ctrd.APIClient) (existSnapshot bool, err error) { |
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.
like the last comment. the developer will care about checking for what.
|
We got different user cases, that means we may not always allow one graphdriver. Like kata want use one which not suit for runc, but we should always allow different runtimes. So maybe pouch will allow different snapshotters simultaneously in the feature. |
|
CI failure is unrelated: |
Yes, If different snapshotters is needed to be supportted, we should reconstruct containerd and pouch which need more relations between snapshots and image(or containers) . We may consider it in the feature. |
Signed-off-by: allen.wang <[email protected]>
d96cfbb to
163c665
Compare
|
@wangforthinker , no, we do not need to change containerd but only pouch, containerd no need to know these informations |
|
Overall the PR looks good to me. |
Signed-off-by: allen.wang [email protected]
Ⅰ. Describe what this PR did
This PR is supported to choose storage driver to start pouchd. Before this PR, pouchd only supports tp start with overlayfs.
for the containerd part, add a pr of #2525
Ⅱ. Does this pull request fix one issue?
fixes one part of #2486
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
add test cli_stroage_driver_test.
After containerd merge overlay1fs storage driver, I will add tests for overlay1fs.
Ⅳ. Describe how to verify it
add tests.
Ⅴ. Special notes for reviews
Where pouchd connects with containerd, I changed defaultSnapshotterName(overlayfs) to CurrentSnapshotterName().
Considered to that storage driver should be consistent once pouchd started, I add a check to verify the validity of given storage driver. And storage driver could be changed only after old snapshots are entirely removed.