From 9e83cc78e65f7fc63c00ceff5d9230663c0f31af Mon Sep 17 00:00:00 2001 From: mtanino Date: Mon, 18 Sep 2017 17:12:20 -0400 Subject: [PATCH] Fix FC WaitForAttach not mounting a volume WaitForAttach failed consistently with this error: Heuristic determination of mount point failed:stat /var/lib/kubelet/plugins/kubernetes.io/fc/-lun-0: no such file or directory We should create dir first to avoid the error. Fixes: #52674 --- pkg/volume/fc/fc_util.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/volume/fc/fc_util.go b/pkg/volume/fc/fc_util.go index f229d5700d6..050785c4221 100644 --- a/pkg/volume/fc/fc_util.go +++ b/pkg/volume/fc/fc_util.go @@ -219,6 +219,10 @@ func (util *FCUtil) AttachDisk(b fcDiskMounter) (string, error) { } // mount it globalPDPath := util.MakeGlobalPDName(*b.fcDisk) + if err := os.MkdirAll(globalPDPath, 0750); err != nil { + return devicePath, fmt.Errorf("fc: failed to mkdir %s, error", globalPDPath) + } + noMnt, err := b.mounter.IsLikelyNotMountPoint(globalPDPath) if err != nil { return devicePath, fmt.Errorf("Heuristic determination of mount point failed:%v", err) @@ -228,10 +232,6 @@ func (util *FCUtil) AttachDisk(b fcDiskMounter) (string, error) { return devicePath, nil } - if err := os.MkdirAll(globalPDPath, 0750); err != nil { - return devicePath, fmt.Errorf("fc: failed to mkdir %s, error", globalPDPath) - } - err = b.mounter.FormatAndMount(devicePath, globalPDPath, b.fsType, nil) if err != nil { return devicePath, fmt.Errorf("fc: failed to mount fc volume %s [%s] to %s, error %v", devicePath, b.fsType, globalPDPath, err)