From 4eaa5337774f6287625653ff74a9c018d5bef91d Mon Sep 17 00:00:00 2001 From: Nikhil Sharma Date: Fri, 7 Jan 2022 20:10:03 +0530 Subject: [PATCH] added devicePath check for fcDisk --- pkg/volume/fc/fc_util.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/volume/fc/fc_util.go b/pkg/volume/fc/fc_util.go index 94f5c7a9452..a8a99a45e90 100644 --- a/pkg/volume/fc/fc_util.go +++ b/pkg/volume/fc/fc_util.go @@ -254,7 +254,15 @@ func (util *fcUtil) AttachDisk(b fcDiskMounter) (string, error) { return "", err } - return devicePath, nil + exists, err := mount.PathExists(devicePath) + if exists && err == nil { + return devicePath, nil + } + if exists == false { + return "", fmt.Errorf("device %s does not exist", devicePath) + } else { + return "", err + } } // DetachDisk removes scsi device file such as /dev/sdX from the node.