diff --git a/pkg/rbd/rbd_util.go b/pkg/rbd/rbd_util.go index 83b5c13f2..aeaa62435 100644 --- a/pkg/rbd/rbd_util.go +++ b/pkg/rbd/rbd_util.go @@ -620,7 +620,7 @@ func getImageInfo(monitors string, cr *util.Credentials, poolName, imageName str var imgInfo imageInfo - stdout, _, err := util.ExecCommand( + stdout, stderr, err := util.ExecCommand( "rbd", "-m", monitors, "--id", cr.ID, @@ -630,7 +630,7 @@ func getImageInfo(monitors string, cr *util.Credentials, poolName, imageName str "info", poolName+"/"+imageName) if err != nil { klog.Errorf("failed getting information for image (%s): (%s)", poolName+"/"+imageName, err) - if strings.Contains(string(stdout), "rbd: error opening image "+imageName+ + if strings.Contains(string(stderr), "rbd: error opening image "+imageName+ ": (2) No such file or directory") { return imgInfo, ErrImageNotFound{imageName, err} } @@ -669,7 +669,7 @@ func getSnapInfo(monitors string, cr *util.Credentials, poolName, imageName, sna snaps []snapInfo ) - stdout, _, err := util.ExecCommand( + stdout, stderr, err := util.ExecCommand( "rbd", "-m", monitors, "--id", cr.ID, @@ -680,7 +680,7 @@ func getSnapInfo(monitors string, cr *util.Credentials, poolName, imageName, sna if err != nil { klog.Errorf("failed getting snap (%s) information from image (%s): (%s)", snapName, poolName+"/"+imageName, err) - if strings.Contains(string(stdout), "rbd: error opening image "+imageName+ + if strings.Contains(string(stderr), "rbd: error opening image "+imageName+ ": (2) No such file or directory") { return snpInfo, ErrImageNotFound{imageName, err} } diff --git a/pkg/util/cephcmds.go b/pkg/util/cephcmds.go index eb61f6f44..452fd7ac5 100644 --- a/pkg/util/cephcmds.go +++ b/pkg/util/cephcmds.go @@ -237,10 +237,10 @@ func CreateObject(monitors string, cr *Credentials, poolName, namespace, objectN args = append(args, "--namespace="+namespace) } - stdout, _, err := ExecCommand("rados", args[:]...) + _, stderr, err := ExecCommand("rados", args[:]...) if err != nil { klog.Errorf("failed creating omap (%s) in pool (%s): (%v)", objectName, poolName, err) - if strings.Contains(string(stdout), "error creating "+poolName+"/"+objectName+ + if strings.Contains(string(stderr), "error creating "+poolName+"/"+objectName+ ": (17) File exists") { return ErrObjectExists{objectName, err} } @@ -267,10 +267,10 @@ func RemoveObject(monitors string, cr *Credentials, poolName, namespace, oMapNam args = append(args, "--namespace="+namespace) } - stdout, _, err := ExecCommand("rados", args[:]...) + _, stderr, err := ExecCommand("rados", args[:]...) if err != nil { klog.Errorf("failed removing omap (%s) in pool (%s): (%v)", oMapName, poolName, err) - if strings.Contains(string(stdout), "error removing "+poolName+">"+oMapName+ + if strings.Contains(string(stderr), "error removing "+poolName+">"+oMapName+ ": (2) No such file or directory") { return ErrObjectNotFound{oMapName, err} }