mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 12:07:47 +00:00
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/<wwn>-lun-0: no such file or directory We should create dir first to avoid the error. Fixes: #52674
This commit is contained in:
parent
00c1ec5201
commit
9e83cc78e6
@ -219,6 +219,10 @@ func (util *FCUtil) AttachDisk(b fcDiskMounter) (string, error) {
|
|||||||
}
|
}
|
||||||
// mount it
|
// mount it
|
||||||
globalPDPath := util.MakeGlobalPDName(*b.fcDisk)
|
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)
|
noMnt, err := b.mounter.IsLikelyNotMountPoint(globalPDPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return devicePath, fmt.Errorf("Heuristic determination of mount point failed:%v", err)
|
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
|
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)
|
err = b.mounter.FormatAndMount(devicePath, globalPDPath, b.fsType, nil)
|
||||||
if err != 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)
|
return devicePath, fmt.Errorf("fc: failed to mount fc volume %s [%s] to %s, error %v", devicePath, b.fsType, globalPDPath, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user