mirror of https://github.com/k3s-io/k3s
fix some typos in /pkg/volume
parent
8b98e802ed
commit
4b25a4fd93
|
@ -319,7 +319,7 @@ func (util *fcUtil) DetachBlockFCDisk(c fcDiskUnmapper, mapPath, devicePath stri
|
||||||
}
|
}
|
||||||
volumeInfo := arr[len(arr)-1]
|
volumeInfo := arr[len(arr)-1]
|
||||||
|
|
||||||
// Search symbolick link which matches volumeInfo under /dev/disk/by-path or /dev/disk/by-id
|
// Search symbolic link which matches volumeInfo under /dev/disk/by-path or /dev/disk/by-id
|
||||||
// then find destination device path from the link
|
// then find destination device path from the link
|
||||||
searchPath := byID
|
searchPath := byID
|
||||||
if strings.Contains(volumeInfo, "-lun-") {
|
if strings.Contains(volumeInfo, "-lun-") {
|
||||||
|
|
|
@ -803,7 +803,7 @@ func (og *operationGenerator) GenerateUnmountDeviceFunc(
|
||||||
// After setup is done, create symbolic links on both global map path and pod
|
// After setup is done, create symbolic links on both global map path and pod
|
||||||
// device map path. Once symbolic links are created, take fd lock by
|
// device map path. Once symbolic links are created, take fd lock by
|
||||||
// loopback for the device to avoid silent volume replacement. This lock
|
// loopback for the device to avoid silent volume replacement. This lock
|
||||||
// will be realased once no one uses the device.
|
// will be released once no one uses the device.
|
||||||
// If all steps are completed, the volume is marked as mounted.
|
// If all steps are completed, the volume is marked as mounted.
|
||||||
func (og *operationGenerator) GenerateMapVolumeFunc(
|
func (og *operationGenerator) GenerateMapVolumeFunc(
|
||||||
waitForAttachTimeout time.Duration,
|
waitForAttachTimeout time.Duration,
|
||||||
|
@ -1033,7 +1033,7 @@ func (og *operationGenerator) GenerateUnmapVolumeFunc(
|
||||||
|
|
||||||
// GenerateUnmapDeviceFunc marks device as unmounted based on following steps.
|
// GenerateUnmapDeviceFunc marks device as unmounted based on following steps.
|
||||||
// Check under globalMapPath dir if there isn't pod's symbolic links in it.
|
// Check under globalMapPath dir if there isn't pod's symbolic links in it.
|
||||||
// If symbolick link isn't there, the device isn't referenced from Pods.
|
// If symbolic link isn't there, the device isn't referenced from Pods.
|
||||||
// Call plugin TearDownDevice to clean-up device connection, stored data under
|
// Call plugin TearDownDevice to clean-up device connection, stored data under
|
||||||
// globalMapPath, these operations depend on plugin implementation.
|
// globalMapPath, these operations depend on plugin implementation.
|
||||||
// Once TearDownDevice is completed, remove globalMapPath dir.
|
// Once TearDownDevice is completed, remove globalMapPath dir.
|
||||||
|
@ -1064,7 +1064,7 @@ func (og *operationGenerator) GenerateUnmapDeviceFunc(
|
||||||
|
|
||||||
unmapDeviceFunc := func() (error, error) {
|
unmapDeviceFunc := func() (error, error) {
|
||||||
// Search under globalMapPath dir if all symbolic links from pods have been removed already.
|
// Search under globalMapPath dir if all symbolic links from pods have been removed already.
|
||||||
// If symbolick links are there, pods may still refer the volume.
|
// If symbolic links are there, pods may still refer the volume.
|
||||||
globalMapPath := deviceToDetach.DeviceMountPath
|
globalMapPath := deviceToDetach.DeviceMountPath
|
||||||
refs, err := og.blkUtil.GetDeviceSymlinkRefs(deviceToDetach.DevicePath, globalMapPath)
|
refs, err := og.blkUtil.GetDeviceSymlinkRefs(deviceToDetach.DevicePath, globalMapPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -144,16 +144,16 @@ func (v VolumePathHandler) RemoveMapPath(mapPath string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsSymlinkExist returns true if specified file exists and the type is symbolik link.
|
// IsSymlinkExist returns true if specified file exists and the type is symbolik link.
|
||||||
// If file doesn't exist, or file exists but not symbolick link, return false with no error.
|
// If file doesn't exist, or file exists but not symbolic link, return false with no error.
|
||||||
// On other cases, return false with error from Lstat().
|
// On other cases, return false with error from Lstat().
|
||||||
func (v VolumePathHandler) IsSymlinkExist(mapPath string) (bool, error) {
|
func (v VolumePathHandler) IsSymlinkExist(mapPath string) (bool, error) {
|
||||||
fi, err := os.Lstat(mapPath)
|
fi, err := os.Lstat(mapPath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// If file exits and it's symbolick link, return true and no error
|
// If file exits and it's symbolic link, return true and no error
|
||||||
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
|
if fi.Mode()&os.ModeSymlink == os.ModeSymlink {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
// If file exits but it's not symbolick link, return fale and no error
|
// If file exits but it's not symbolic link, return fale and no error
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
// If file doesn't exist, return false and no error
|
// If file doesn't exist, return false and no error
|
||||||
|
|
Loading…
Reference in New Issue