From 52c9a3abe2d24a56d5785a4fc70c876ed67d8907 Mon Sep 17 00:00:00 2001 From: Sami Wagiaalla Date: Wed, 13 Jan 2016 15:57:36 -0500 Subject: [PATCH] RBD return output in error case --- pkg/volume/rbd/rbd_util.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/volume/rbd/rbd_util.go b/pkg/volume/rbd/rbd_util.go index 9c5ea5bcd6b..23b42ba159e 100644 --- a/pkg/volume/rbd/rbd_util.go +++ b/pkg/volume/rbd/rbd_util.go @@ -210,6 +210,7 @@ func (util *RBDUtil) defencing(c rbdCleaner) error { func (util *RBDUtil) AttachDisk(b rbdBuilder) error { var err error + var output []byte devicePath, found := waitForPath(b.Pool, b.Image, 1) if !found { @@ -227,18 +228,19 @@ func (util *RBDUtil) AttachDisk(b rbdBuilder) error { mon := b.Mon[i%l] glog.V(1).Infof("rbd: map mon %s", mon) if b.Secret != "" { - _, err = b.plugin.execCommand("rbd", + output, err = b.plugin.execCommand("rbd", []string{"map", b.Image, "--pool", b.Pool, "--id", b.Id, "-m", mon, "--key=" + b.Secret}) } else { - _, err = b.plugin.execCommand("rbd", + output, err = b.plugin.execCommand("rbd", []string{"map", b.Image, "--pool", b.Pool, "--id", b.Id, "-m", mon, "-k", b.Keyring}) } if err == nil { break } + glog.V(1).Infof("rbd: map error %v %s", err, string(output)) } if err != nil { - return err + return fmt.Errorf("rbd: map failed %v %s", err, string(output)) } devicePath, found = waitForPath(b.Pool, b.Image, 10) if !found {