@@ -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
435430func (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