Skip to content

Commit 52c573c

Browse files
committed
fix multipath detection on device lost
1 parent fb3c9e1 commit 52c573c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

iscsi/iscsi.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ func (c *Connector) DisconnectVolume() error {
433433

434434
// getMountTargetDevice returns the device to be mounted among the configured devices
435435
func (c *Connector) getMountTargetDevice() (*Device, error) {
436-
if c.IsMultipathEnabled() {
436+
if len(c.Devices) > 1 {
437437
multipathDevice, err := getMultipathDevice(c.Devices)
438438
if err != nil {
439439
debug.Printf("mount target is not a multipath device: %v", err)
@@ -452,7 +452,7 @@ func (c *Connector) getMountTargetDevice() (*Device, error) {
452452

453453
// IsMultipathEnabled check if multipath is enabled on devices handled by this connector
454454
func (c *Connector) IsMultipathEnabled() bool {
455-
return len(c.Devices) > 1
455+
return c.MountTargetDevice.Type == "mpath"
456456
}
457457

458458
// GetSCSIDevices get SCSI devices from device paths
@@ -499,7 +499,7 @@ func lsblk(devicePaths []string, strict bool) (*deviceInfo, error) {
499499
if strict || ee.ExitCode() != 64 { // ignore the error if some devices have been found when not strict
500500
return nil, err
501501
}
502-
debug.Printf("lsblk could find only some devices: %v", err)
502+
debug.Printf("Could find only some devices: %v", err)
503503
} else {
504504
return nil, err
505505
}

0 commit comments

Comments
 (0)