Skip to content

Commit ce7a6cc

Browse files
authored
Merge pull request #41 from LBGarber/rm-container-mount
Remove container mount checks
2 parents b8bc07b + be80fab commit ce7a6cc

2 files changed

Lines changed: 4 additions & 27 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ TEST_LABEL ?= xyz
1212

1313
GOPATH=$(shell go env GOPATH)
1414

15-
PLUGIN_VERSION=v0.15.0
15+
PLUGIN_VERSION=v0.16.0
1616

1717
PLUGIN_NAME_ROOTFS=docker-volume-linode:rootfs.${PLUGIN_VERSION}
18-
PLUGIN_NAME=${REPO_SLUG}:v0.15.0
18+
PLUGIN_NAME=${REPO_SLUG}:${PLUGIN_VERSION}
1919
PLUGIN_NAME_LATEST=${REPO_SLUG}:latest
2020

2121
PLUGIN_DIR=plugin-contents-dir

driver.go

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import (
1111
"strings"
1212
"sync"
1313

14-
"github.com/docker/docker/api/types"
15-
"github.com/docker/docker/api/types/filters"
16-
"github.com/docker/docker/client"
17-
1814
"golang.org/x/oauth2"
1915

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

433429
// ensureNotMounted returns an error if the specified volume is in use by a remote Linode
434-
// or local container
435430
func (driver *linodeVolumeDriver) ensureNotMounted(volumeID int) error {
431+
// TODO: validate whether a volume is in use in a local container
432+
436433
api, err := driver.linodeAPI()
437434
if err != nil {
438435
return err
@@ -443,26 +440,6 @@ func (driver *linodeVolumeDriver) ensureNotMounted(volumeID int) error {
443440
return err
444441
}
445442

446-
cli, err := client.NewEnvClient()
447-
if err != nil {
448-
panic(err)
449-
}
450-
451-
f := filters.NewArgs()
452-
f.Add("volume", vol.Label)
453-
listOpts := types.ContainerListOptions{
454-
Filters: f,
455-
}
456-
457-
containers, err := cli.ContainerList(context.Background(), listOpts)
458-
if err != nil {
459-
return fmt.Errorf("failed to list containers with specified volume: %v", err)
460-
}
461-
462-
if len(containers) > 0 {
463-
return fmt.Errorf("volume in use by %s", containers[0].ID)
464-
}
465-
466443
// We should wait for the volume to be detached if it is in the process of detaching
467444
if vol.LinodeID != nil {
468445
volDetaching, err := checkVolumeDetaching(api, volumeID)

0 commit comments

Comments
 (0)