Commit b6e8f71f authored by root's avatar root

fix bug iscsi volume attach failed of /sys/class/iscsi_host dir not exist

parent 983cf51c
...@@ -21,6 +21,7 @@ package util ...@@ -21,6 +21,7 @@ package util
import ( import (
"errors" "errors"
"fmt" "fmt"
"os"
"path" "path"
"strconv" "strconv"
"strings" "strings"
...@@ -99,6 +100,9 @@ func (handler *deviceHandler) GetISCSIPortalHostMapForTarget(targetIqn string) ( ...@@ -99,6 +100,9 @@ func (handler *deviceHandler) GetISCSIPortalHostMapForTarget(targetIqn string) (
sysPath := "/sys/class/iscsi_host" sysPath := "/sys/class/iscsi_host"
hostDirs, err := io.ReadDir(sysPath) hostDirs, err := io.ReadDir(sysPath)
if err != nil { if err != nil {
if os.IsNotExist(err) {
return portalHostMap, nil
}
return nil, err return nil, err
} }
for _, hostDir := range hostDirs { for _, hostDir := range hostDirs {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment