From a317b5ffc8b3ec0151d1e49ea592f0fd4bcdf5da Mon Sep 17 00:00:00 2001 From: Sami Wagiaalla Date: Fri, 26 Jun 2015 14:46:41 -0400 Subject: [PATCH] iscsi plugin: print error messages not just exit status. Signed-off-by: Sami Wagiaalla --- pkg/volume/iscsi/iscsi_util.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/volume/iscsi/iscsi_util.go b/pkg/volume/iscsi/iscsi_util.go index 98d8cfeee53..bf890a1c46c 100644 --- a/pkg/volume/iscsi/iscsi_util.go +++ b/pkg/volume/iscsi/iscsi_util.go @@ -83,15 +83,15 @@ func (util *ISCSIUtil) AttachDisk(iscsi iscsiDisk) error { exist := waitForPathToExist(devicePath, 1) if exist == false { // discover iscsi target - _, err := iscsi.plugin.execCommand("iscsiadm", []string{"-m", "discovery", "-t", "sendtargets", "-p", iscsi.portal}) + out, err := iscsi.plugin.execCommand("iscsiadm", []string{"-m", "discovery", "-t", "sendtargets", "-p", iscsi.portal}) if err != nil { - glog.Errorf("iscsi: failed to sendtargets to portal %s error:%v", iscsi.portal, err) + glog.Errorf("iscsi: failed to sendtargets to portal %s error: %s", iscsi.portal, string(out)) return err } // login to iscsi target - _, err = iscsi.plugin.execCommand("iscsiadm", []string{"-m", "node", "-p", iscsi.portal, "-T", iscsi.iqn, "--login"}) + out, err = iscsi.plugin.execCommand("iscsiadm", []string{"-m", "node", "-p", iscsi.portal, "-T", iscsi.iqn, "--login"}) if err != nil { - glog.Errorf("iscsi: failed to attach disk:Error: %v", err) + glog.Errorf("iscsi: failed to attach disk:Error: %s (%v)", string(out), err) return err } exist = waitForPathToExist(devicePath, 10) @@ -146,9 +146,9 @@ func (util *ISCSIUtil) DetachDisk(iscsi iscsiDisk, mntPath string) error { iqn := device[ind1+len("-iscsi-") : ind] glog.Infof("iscsi: log out target %s iqn %s", portal, iqn) - _, err = iscsi.plugin.execCommand("iscsiadm", []string{"-m", "node", "-p", portal, "-T", iqn, "--logout"}) + out, err := iscsi.plugin.execCommand("iscsiadm", []string{"-m", "node", "-p", portal, "-T", iqn, "--logout"}) if err != nil { - glog.Errorf("iscsi: failed to detach disk Error: %v", err) + glog.Errorf("iscsi: failed to detach disk Error: %s", string(out)) } } }