Merge pull request #78475 from humblec/iscsi-higher-timeout
Increase device discovery timeout to 30seconds/equal to checker_timeout
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.
 | 
						// How many seconds to wait for a multipath device if at least two paths are available.
 | 
				
			||||||
	multipathDeviceTimeout = 10
 | 
						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
 | 
						// '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
 | 
						// See https://github.com/open-iscsi/open-iscsi/blob/7d121d12ad6ba7783308c25ffd338a9fa0cc402b/include/iscsi_err.h#L37-L38
 | 
				
			||||||
	iscsiadmErrorSessExists = 15
 | 
						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}, "-")
 | 
									devicePath = strings.Join([]string{"/dev/disk/by-path/pci", "*", "ip", tp, "iscsi", b.Iqn, "lun", b.Lun}, "-")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if exist := waitForPathToExist(&devicePath, multipathDeviceTimeout, iscsiTransport); !exist {
 | 
								if exist := waitForPathToExist(&devicePath, deviceDiscoveryTimeout, iscsiTransport); !exist {
 | 
				
			||||||
				klog.Errorf("Could not attach disk: Timeout after %ds", multipathDeviceTimeout)
 | 
									klog.Errorf("Could not attach disk: Timeout after %ds", deviceDiscoveryTimeout)
 | 
				
			||||||
				// update last error
 | 
									// 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
 | 
									continue
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				devicePaths[tp] = devicePath
 | 
									devicePaths[tp] = devicePath
 | 
				
			||||||
@@ -456,8 +459,8 @@ func (util *ISCSIUtil) AttachDisk(b iscsiDiskMounter) (string, error) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	// Try to find a multipath device for the volume
 | 
						// Try to find a multipath device for the volume
 | 
				
			||||||
	if len(bkpPortal) > 1 {
 | 
						if len(bkpPortal) > 1 {
 | 
				
			||||||
		// Multipath volume was requested. Wait up to 10 seconds for the multipath device to appear.
 | 
							// Multipath volume was requested. Wait up to multipathDeviceTimeout seconds for the multipath device to appear.
 | 
				
			||||||
		devicePath = waitForMultiPathToExist(devicePathList, 10, b.deviceUtil)
 | 
							devicePath = waitForMultiPathToExist(devicePathList, multipathDeviceTimeout, b.deviceUtil)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// For PVs with 1 portal, just try one time to find the multipath device. This
 | 
							// 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
 | 
							// avoids a long pause when the multipath device will never get created, and
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user