From 66a7aefa06f5968ab1ddc4093dca2edb72d91630 Mon Sep 17 00:00:00 2001 From: Johannes Scheuermann Date: Tue, 28 Feb 2017 15:33:39 +0100 Subject: [PATCH] Add more error logging --- .travis.yml | 1 - quobyte_driver.go | 5 +++++ util.go | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bc60b3f..64d59ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ env: install: - go fmt ./... - CGO_ENABLED=0 go build -ldflags "-s -w -X main.version=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match) -X main.revision=$(git log -1 --format=%h)" -a -installsuffix cgo -o bin/docker-quobyte-plugin - . before_deploy: - tar cfvz docker-quobyte-plugin.tar.gz bin systemd diff --git a/quobyte_driver.go b/quobyte_driver.go index 63e28f6..5c1eb7d 100644 --- a/quobyte_driver.go +++ b/quobyte_driver.go @@ -48,6 +48,7 @@ func (driver quobyteDriver) Create(request volume.Request) volume.Response { RootUserID: user, RootGroupID: group, }); err != nil { + log.Println(err) return volume.Response{Err: err.Error()} } @@ -60,6 +61,7 @@ func (driver quobyteDriver) Remove(request volume.Request) volume.Response { defer driver.m.Unlock() if err := driver.client.DeleteVolumeByName(request.Name, ""); err != nil { + log.Println(err) return volume.Response{Err: err.Error()} } @@ -72,6 +74,7 @@ func (driver quobyteDriver) Mount(request volume.MountRequest) volume.Response { mPoint := filepath.Join(driver.quobyteMount, request.Name) log.Printf("Mounting volume %s on %s\n", request.Name, mPoint) if fi, err := os.Lstat(mPoint); err != nil || !fi.IsDir() { + log.Println(err) return volume.Response{Err: fmt.Sprintf("%v not mounted", mPoint)} } @@ -93,6 +96,7 @@ func (driver quobyteDriver) Get(request volume.Request) volume.Response { mPoint := filepath.Join(driver.quobyteMount, request.Name) if fi, err := os.Lstat(mPoint); err != nil || !fi.IsDir() { + log.Println(err) return volume.Response{Err: fmt.Sprintf("%v not mounted", mPoint)} } @@ -106,6 +110,7 @@ func (driver quobyteDriver) List(request volume.Request) volume.Response { var vols []*volume.Volume files, err := ioutil.ReadDir(driver.quobyteMount) if err != nil { + log.Println(err) return volume.Response{Err: err.Error()} } diff --git a/util.go b/util.go index 1e0b4a9..7b5cc15 100644 --- a/util.go +++ b/util.go @@ -48,6 +48,7 @@ func isMounted(mountPath string) bool { func mountAll(mountQuobyteOptions, quobyteRegistry, mountQuobytePath string) { cmdStr := fmt.Sprintf("mount %s -t quobyte %s %s", mountQuobyteOptions, fmt.Sprintf("%s/", quobyteRegistry), mountQuobytePath) if out, err := exec.Command("/bin/sh", "-c", cmdStr).CombinedOutput(); err != nil { + log.Println(err) log.Fatalln(string(out)) } }