|
@@ -6,11 +6,13 @@ import (
|
|
"io"
|
|
"io"
|
|
|
|
|
|
"github.com/docker/docker/pkg/archive"
|
|
"github.com/docker/docker/pkg/archive"
|
|
|
|
+ "github.com/docker/docker/pkg/plugingetter"
|
|
)
|
|
)
|
|
|
|
|
|
type graphDriverProxy struct {
|
|
type graphDriverProxy struct {
|
|
name string
|
|
name string
|
|
client pluginClient
|
|
client pluginClient
|
|
|
|
+ p plugingetter.CompatPlugin
|
|
}
|
|
}
|
|
|
|
|
|
type graphDriverRequest struct {
|
|
type graphDriverRequest struct {
|
|
@@ -35,6 +37,12 @@ type graphDriverInitRequest struct {
|
|
}
|
|
}
|
|
|
|
|
|
func (d *graphDriverProxy) Init(home string, opts []string) error {
|
|
func (d *graphDriverProxy) Init(home string, opts []string) error {
|
|
|
|
+ if !d.p.IsV1() {
|
|
|
|
+ if cp, ok := d.p.(plugingetter.CountedPlugin); ok {
|
|
|
|
+ // always acquire here, it will be cleaned up on daemon shutdown
|
|
|
|
+ cp.Acquire()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
args := &graphDriverInitRequest{
|
|
args := &graphDriverInitRequest{
|
|
Home: home,
|
|
Home: home,
|
|
Opts: opts,
|
|
Opts: opts,
|
|
@@ -167,6 +175,13 @@ func (d *graphDriverProxy) GetMetadata(id string) (map[string]string, error) {
|
|
}
|
|
}
|
|
|
|
|
|
func (d *graphDriverProxy) Cleanup() error {
|
|
func (d *graphDriverProxy) Cleanup() error {
|
|
|
|
+ if !d.p.IsV1() {
|
|
|
|
+ if cp, ok := d.p.(plugingetter.CountedPlugin); ok {
|
|
|
|
+ // always release
|
|
|
|
+ defer cp.Release()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
args := &graphDriverRequest{}
|
|
args := &graphDriverRequest{}
|
|
var ret graphDriverResponse
|
|
var ret graphDriverResponse
|
|
if err := d.client.Call("GraphDriver.Cleanup", args, &ret); err != nil {
|
|
if err := d.client.Call("GraphDriver.Cleanup", args, &ret); err != nil {
|