Skip to content

Commit

Permalink
Merge pull request #41 from LBGarber/rm-container-mount
Browse files Browse the repository at this point in the history
Remove container mount checks
  • Loading branch information
LBGarber authored Oct 20, 2021
2 parents b8bc07b + be80fab commit ce7a6cc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
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

0 comments on commit ce7a6cc

Please sign in to comment.