Increase device discovery timeout to 30seconds/equal to checker_timeout.
At present, iscsi plugin wait for 10seconds for a path to appear for a multipath device, but at certain scenarios this may not be sufficient for device mapper to get the path. The default multipath configuration has a configuation called 'checker_timeout' which specify the timeout to user for path checkers that issue scsi commands with an explicit timeout, in seconds; default taken from /sys/block/sd*/device/timeout which is 30s. This patch lift the timeout value from 10s to 30s. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
		@@ -52,6 +52,9 @@ const (
 | 
			
		||||
	// How many seconds to wait for a multipath device if at least two paths are available.
 | 
			
		||||
	multipathDeviceTimeout = 10
 | 
			
		||||
 | 
			
		||||
	// How many seconds to wait for a device/path to appear before giving up.
 | 
			
		||||
	deviceDiscoveryTimeout = 30
 | 
			
		||||
 | 
			
		||||
	// 'iscsiadm' error code stating that a session is logged in
 | 
			
		||||
	// See https://github.com/open-iscsi/open-iscsi/blob/7d121d12ad6ba7783308c25ffd338a9fa0cc402b/include/iscsi_err.h#L37-L38
 | 
			
		||||
	iscsiadmErrorSessExists = 15
 | 
			
		||||
@@ -417,10 +420,10 @@ func (util *ISCSIUtil) AttachDisk(b iscsiDiskMounter) (string, error) {
 | 
			
		||||
				devicePath = strings.Join([]string{"/dev/disk/by-path/pci", "*", "ip", tp, "iscsi", b.Iqn, "lun", b.Lun}, "-")
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if exist := waitForPathToExist(&devicePath, multipathDeviceTimeout, iscsiTransport); !exist {
 | 
			
		||||
				klog.Errorf("Could not attach disk: Timeout after %ds", multipathDeviceTimeout)
 | 
			
		||||
			if exist := waitForPathToExist(&devicePath, deviceDiscoveryTimeout, iscsiTransport); !exist {
 | 
			
		||||
				klog.Errorf("Could not attach disk: Timeout after %ds", deviceDiscoveryTimeout)
 | 
			
		||||
				// update last error
 | 
			
		||||
				lastErr = fmt.Errorf("Could not attach disk: Timeout after %ds", multipathDeviceTimeout)
 | 
			
		||||
				lastErr = fmt.Errorf("Could not attach disk: Timeout after %ds", deviceDiscoveryTimeout)
 | 
			
		||||
				continue
 | 
			
		||||
			} else {
 | 
			
		||||
				devicePaths[tp] = devicePath
 | 
			
		||||
@@ -456,8 +459,8 @@ func (util *ISCSIUtil) AttachDisk(b iscsiDiskMounter) (string, error) {
 | 
			
		||||
	}
 | 
			
		||||
	// Try to find a multipath device for the volume
 | 
			
		||||
	if len(bkpPortal) > 1 {
 | 
			
		||||
		// Multipath volume was requested. Wait up to 10 seconds for the multipath device to appear.
 | 
			
		||||
		devicePath = waitForMultiPathToExist(devicePathList, 10, b.deviceUtil)
 | 
			
		||||
		// Multipath volume was requested. Wait up to multipathDeviceTimeout seconds for the multipath device to appear.
 | 
			
		||||
		devicePath = waitForMultiPathToExist(devicePathList, multipathDeviceTimeout, b.deviceUtil)
 | 
			
		||||
	} else {
 | 
			
		||||
		// For PVs with 1 portal, just try one time to find the multipath device. This
 | 
			
		||||
		// avoids a long pause when the multipath device will never get created, and
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user