Skip to content

Fixup some issues with plugin refcounting#35265

Merged
vieux merged 1 commit into
moby:masterfrom
cpuguy83:32609_defreference_voldriver_on_error
Nov 7, 2017
Merged

Fixup some issues with plugin refcounting#35265
vieux merged 1 commit into
moby:masterfrom
cpuguy83:32609_defreference_voldriver_on_error

Conversation

@cpuguy83
Copy link
Copy Markdown
Member

In some circumstances we were not properly releasing plugin references,
leading to failures in removing a plugin with no way to recover other
than restarting the daemon.

  1. If volume create fails (in the driver)
  2. If a driver validation fails (should be rare)
  3. If trying to get a plugin that does not match the passed in capability

Ideally the test for 1 and 2 would just be a unit test, however the
plugin interfaces are too complicated as plugingetter relies on
github.com/pkg/plugin/Client (a concrete type), which will require
spinning up services from within the unit test... it just wouldn't be a
unit test at this point.
I attempted to refactor this a bit, but since both libnetwork and
swarmkit are reliant on plugingetter as well, this would not work.
This really requires a re-write of the lower-level plugin management to
decouple these pieces.

Fixes #32609

@cpuguy83 cpuguy83 force-pushed the 32609_defreference_voldriver_on_error branch 4 times, most recently from e043e01 to f22eb1a Compare October 20, 2017 23:06
@cpuguy83
Copy link
Copy Markdown
Member Author

For some reason tests work fine running manually but when run from the makefile it's not.

@cpuguy83 cpuguy83 force-pushed the 32609_defreference_voldriver_on_error branch 2 times, most recently from b1c6b50 to b26e068 Compare October 21, 2017 18:38
In some circumstances we were not properly releasing plugin references,
leading to failures in removing a plugin with no way to recover other
than restarting the daemon.

1. If volume create fails (in the driver)
2. If a driver validation fails (should be rare)
3. If trying to get a plugin that does not match the passed in capability

Ideally the test for 1 and 2 would just be a unit test, however the
plugin interfaces are too complicated as `plugingetter` relies on
github.com/pkg/plugin/Client (a concrete type), which will require
spinning up services from within the unit test... it just wouldn't be a
unit test at this point.
I attempted to refactor this a bit, but since both libnetwork and
swarmkit are reliant on `plugingetter` as well, this would not work.
This really requires a re-write of the lower-level plugin management to
decouple these pieces.

Signed-off-by: Brian Goff <[email protected]>
@cpuguy83
Copy link
Copy Markdown
Member Author

Good to go now.


import "github.com/docker/docker/pkg/plugins"
import (
"github.com/docker/docker/pkg/plugins"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for this change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just that goimports changed it.

return installPath
}

func asVolumeDriver(cfg *plugin.Config) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this idea, learned something new! 👍 💯

@vieux vieux self-assigned this Nov 2, 2017
@thaJeztah
Copy link
Copy Markdown
Member

ping @vieux @tiborvass PTAL ❤️

Copy link
Copy Markdown
Contributor

@vieux vieux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐮

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants