From ab01a22fef0ae4981af7b3ceb433c33a1e032386 Mon Sep 17 00:00:00 2001 From: Suhas Date: Thu, 12 Nov 2015 16:32:10 -0800 Subject: [PATCH] rdb util: AttachDisk: Skip unnecessary call for waitforpath Skip unnecessary call to waitforpath if found = true during the first call. --- pkg/volume/rbd/rbd_util.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/volume/rbd/rbd_util.go b/pkg/volume/rbd/rbd_util.go index 3b2c66cec42..0928b3203b7 100644 --- a/pkg/volume/rbd/rbd_util.go +++ b/pkg/volume/rbd/rbd_util.go @@ -237,13 +237,13 @@ func (util *RBDUtil) AttachDisk(b rbdBuilder) error { break } } - } - if err != nil { - return err - } - devicePath, found = waitForPath(b.Pool, b.Image, 10) - if !found { - return errors.New("Could not map image: Timeout after 10s") + if err != nil { + return err + } + devicePath, found = waitForPath(b.Pool, b.Image, 10) + if !found { + return errors.New("Could not map image: Timeout after 10s") + } } // mount it globalPDPath := b.manager.MakeGlobalPDName(*b.rbd)