Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ TEST_LABEL ?= xyz

GOPATH=$(shell go env GOPATH)

PLUGIN_VERSION=v0.15.0
PLUGIN_VERSION=v0.16.0

PLUGIN_NAME_ROOTFS=docker-volume-linode:rootfs.${PLUGIN_VERSION}
PLUGIN_NAME=${REPO_SLUG}:v0.15.0
PLUGIN_NAME=${REPO_SLUG}:${PLUGIN_VERSION}
PLUGIN_NAME_LATEST=${REPO_SLUG}:latest

PLUGIN_DIR=plugin-contents-dir
Expand Down
27 changes: 2 additions & 25 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import (
"strings"
"sync"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/client"

"golang.org/x/oauth2"

"github.com/docker/go-plugins-helpers/volume"
Expand Down Expand Up @@ -431,8 +427,9 @@ func attachAndWait(api *linodego.Client, volumeID int, linodeID int) error {
}

// ensureNotMounted returns an error if the specified volume is in use by a remote Linode
// or local container
func (driver *linodeVolumeDriver) ensureNotMounted(volumeID int) error {
// TODO: validate whether a volume is in use in a local container

api, err := driver.linodeAPI()
if err != nil {
return err
Expand All @@ -443,26 +440,6 @@ func (driver *linodeVolumeDriver) ensureNotMounted(volumeID int) error {
return err
}

cli, err := client.NewEnvClient()
if err != nil {
panic(err)
}

f := filters.NewArgs()
f.Add("volume", vol.Label)
listOpts := types.ContainerListOptions{
Filters: f,
}

containers, err := cli.ContainerList(context.Background(), listOpts)
if err != nil {
return fmt.Errorf("failed to list containers with specified volume: %v", err)
}

if len(containers) > 0 {
return fmt.Errorf("volume in use by %s", containers[0].ID)
}

// We should wait for the volume to be detached if it is in the process of detaching
if vol.LinodeID != nil {
volDetaching, err := checkVolumeDetaching(api, volumeID)
Expand Down