update static check failed from pkg/volume/rbd

remove field from staticcheck_failures
This commit is contained in:
haleygo
2020-06-24 15:48:00 +08:00
parent c90427d42e
commit d6cf8d3e57
5 changed files with 24 additions and 26 deletions

View File

@@ -373,7 +373,7 @@ func (util *rbdUtil) AttachDisk(b rbdMounter) (string, error) {
globalPDPath := util.MakeGlobalPDName(*b.rbd)
if pathExists, pathErr := mount.PathExists(globalPDPath); pathErr != nil {
return "", fmt.Errorf("Error checking if path exists: %v", pathErr)
return "", fmt.Errorf("error checking if path exists: %v", pathErr)
} else if !pathExists {
if err := os.MkdirAll(globalPDPath, 0750); err != nil {
return "", err
@@ -459,7 +459,7 @@ func (util *rbdUtil) AttachDisk(b rbdMounter) (string, error) {
devicePath, mapped = waitForPath(b.Pool, b.Image, 10 /*maxRetries*/, false /*useNbdDriver*/)
}
if !mapped {
return "", fmt.Errorf("Could not map image %s/%s, Timeout after 10s", b.Pool, b.Image)
return "", fmt.Errorf("could not map image %s/%s, Timeout after 10s", b.Pool, b.Image)
}
}
return devicePath, nil
@@ -515,7 +515,7 @@ func (util *rbdUtil) DetachDisk(plugin *rbdPlugin, deviceMountPath string, devic
func (util *rbdUtil) DetachBlockDisk(disk rbdDiskUnmapper, mapPath string) error {
if pathExists, pathErr := mount.PathExists(mapPath); pathErr != nil {
return fmt.Errorf("Error checking if path exists: %v", pathErr)
return fmt.Errorf("error checking if path exists: %v", pathErr)
} else if !pathExists {
klog.Warningf("Warning: Unmap skipped because path does not exist: %v", mapPath)
return nil
@@ -803,7 +803,7 @@ func (util *rbdUtil) rbdStatus(b *rbdMounter) (bool, string, error) {
func getRbdImageInfo(deviceMountPath string) (*rbdImageInfo, error) {
deviceMountedPathSeps := strings.Split(filepath.Base(deviceMountPath), "-image-")
if len(deviceMountedPathSeps) != 2 {
return nil, fmt.Errorf("Can't found devicePath for %s ", deviceMountPath)
return nil, fmt.Errorf("can't found devicePath for %s ", deviceMountPath)
}
return &rbdImageInfo{
pool: deviceMountedPathSeps[0],