diff --git a/README.md b/README.md index 5da76d6..5b5689d 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,7 @@ $ docker run --rm -v "$GOPATH":/work -e "GOPATH=/work" -w /work/src/github.com/q Common issues or pitfalls. -#### Plugin creates volumes but shows 'no such file or directory' error +#### Plugin creates volumes but shows 'no such file or directory' or 'operation not permitted' error ##### Reason The Docker Quobyte plugin can successfully access the backend and create the volume but the new volume is not shown in the plugins mount point. diff --git a/quobyte_driver.go b/quobyte_driver.go index bbfe3f6..acae40b 100644 --- a/quobyte_driver.go +++ b/quobyte_driver.go @@ -8,7 +8,6 @@ import ( "path/filepath" "strings" "sync" - "time" "github.com/docker/go-plugins-helpers/volume" quobyte_api "github.com/quobyte/api" @@ -86,30 +85,19 @@ func (driver quobyteDriver) Create(request volume.Request) volume.Response { } func (driver quobyteDriver) checkMountPoint(mPoint string) error { - start := time.Now() - - backoff := 1 - tries := 0 - var mountError error - for tries <= driver.maxFSChecks { - mountError = nil - if fi, err := os.Lstat(mPoint); err != nil || !fi.IsDir() { - log.Printf("Unsuccessful Filesystem Check for %s after %d tries", mPoint, tries) - mountError = err - } else { - return nil - } - - time.Sleep(time.Duration(backoff) * time.Second) - if time.Since(start).Seconds() > driver.maxWaitTime { - log.Printf("Abort checking mount point do to time out after %f\n", driver.maxWaitTime) - return mountError - } - - backoff *= 2 + // Trigger volume list refresh + mkdErr := os.Mkdir(mPoint, 0755) + if !os.IsExist(mkdErr) { + // we expected ErrExist, everything else is an error + return mkdErr } - - return mountError + // Verify volume is available + _, statErr := os.Stat(mPoint) + if statErr != nil { + return statErr + } + log.Printf("Validated new volume ok: %s\n", mPoint) + return nil } func (driver quobyteDriver) Remove(request volume.Request) volume.Response {