Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Commit

Permalink
Disabled volume discovery and added env var to enable it if needed
Browse files Browse the repository at this point in the history
Volume discovery was written to address challenges with docker/plugin startup order,
and as potential auto-recovery for plugin crashes.

* We do not see crashes often (as a matter of fact, only once so far , with VMCI memory issues  - and
it' fixed).
* Docker now manages the order of plugin invocation/startup with
Managed Plugins.
* and, the last but not the least, during the discovery we make assumption about Docker API availability,
but Docker makes API available only AFTER full startup including plugin initialization, so it could lead to
bug like #1039, where docker either hangs for 15-20 sec (like with legacy plugin) or steps on it's own
bugs and crash (like with managed plugin)

In the spirit of taking care of the "sunny day" first, when everything works OK and our code does not crash,
this commit turns off discovery on startup.

Managed plugin handles all restarts and remounts fine. Legacy plugin may have issues if we crash, but first of all
we never crash :-) and second legacy plugins are getting depreciated anyways
  • Loading branch information
Mark Sterin committed Mar 20, 2017
1 parent 1445f96 commit 3cd5450
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugin/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
"description": "Log level - info, warn, error or debug",
"value": "info",
"Settable": [ "value"]
}
]
},
{"name": "VDVS_DISCOVER_VOLUMES",
"description": "non-empty if pre-existing volumes need to be discovered ",
"value": "",
"Settable": [ "value"]
}]
}

6 changes: 6 additions & 0 deletions vmdk_plugin/utils/refcount/refcnt.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ package refcount
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"sync"
Expand Down Expand Up @@ -152,6 +153,11 @@ func newRefCount() *refCount {
// This functions does not sync with mount/unmount handlers and should be called
// and completed BEFORE we start accepting Mount/unmount requests.
func (r RefCountsMap) Init(d drivers.VolumeDriver, mountDir string, name string) {
e := os.Getenv("VDVS_DISCOVER_VOLUMES")
if e == "" {
log.Debug("RefCountsMap.Init: Skipping Docker volumes discovery - VDVS_DISCOVER_VOLUMES not set")
return
}
c, err := client.NewClient(DockerUSocket, ApiVersion, nil, defaultHeaders)
if err != nil {
log.Panicf("Failed to create client for Docker at %s.( %v)",
Expand Down

0 comments on commit 3cd5450

Please sign in to comment.