Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #74306: Fix scanning of failed targets #74589

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 14 additions & 7 deletions pkg/volume/util/device_util_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ package util
import (
"errors"
"fmt"
"k8s.io/klog"
"path"
"strconv"
"strings"

"k8s.io/klog"
)

// FindMultipathDeviceForDevice given a device name like /dev/sdx, find the devicemapper parent
Expand Down Expand Up @@ -135,7 +136,8 @@ func (handler *deviceHandler) GetISCSIPortalHostMapForTarget(targetIqn string) (
targetNamePath := sessionPath + "/iscsi_session/" + sessionName + "/targetname"
targetName, err := io.ReadFile(targetNamePath)
if err != nil {
return nil, err
klog.Infof("Failed to process session %s, assuming this session is unavailable: %s", sessionName, err)
continue
}

// Ignore hosts that don't matchthe target we were looking for.
Expand All @@ -147,7 +149,8 @@ func (handler *deviceHandler) GetISCSIPortalHostMapForTarget(targetIqn string) (
// for the iSCSI connection.
dirs2, err := io.ReadDir(sessionPath)
if err != nil {
return nil, err
klog.Infof("Failed to process session %s, assuming this session is unavailable: %s", sessionName, err)
continue
}
for _, dir2 := range dirs2 {
// Skip over files that aren't the connection
Expand All @@ -164,25 +167,29 @@ func (handler *deviceHandler) GetISCSIPortalHostMapForTarget(targetIqn string) (
addrPath := connectionPath + "/address"
addr, err := io.ReadFile(addrPath)
if err != nil {
return nil, err
klog.Infof("Failed to process connection %s, assuming this connection is unavailable: %s", dirName, err)
continue
}

portPath := connectionPath + "/port"
port, err := io.ReadFile(portPath)
if err != nil {
return nil, err
klog.Infof("Failed to process connection %s, assuming this connection is unavailable: %s", dirName, err)
continue
}

persistentAddrPath := connectionPath + "/persistent_address"
persistentAddr, err := io.ReadFile(persistentAddrPath)
if err != nil {
return nil, err
klog.Infof("Failed to process connection %s, assuming this connection is unavailable: %s", dirName, err)
continue
}

persistentPortPath := connectionPath + "/persistent_port"
persistentPort, err := io.ReadFile(persistentPortPath)
if err != nil {
return nil, err
klog.Infof("Failed to process connection %s, assuming this connection is unavailable: %s", dirName, err)
continue
}

// Add entries to the map for both the current and persistent portals
Expand Down