-
Notifications
You must be signed in to change notification settings - Fork 231
[AI Generated] BugFix: Add retry loop for LUN detection in hot_add_disk_serial test #4436
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,7 @@ | |
| BadEnvironmentStateException, | ||
| LisaException, | ||
| SkippedException, | ||
| check_till_timeout, | ||
| constants, | ||
| generate_random_chars, | ||
| get_matched_str, | ||
|
|
@@ -846,11 +847,36 @@ def _hot_add_disk_serial( | |
| ).is_equal_to(size) | ||
|
|
||
| # verify the lun number from linux VM | ||
| # Retry to allow udev to create the LUN symlink after disk attach | ||
| linux_device_luns_after = disk.get_luns() | ||
| linux_device_lun_diff = [ | ||
| linux_device_luns_after[k] | ||
| for k in set(linux_device_luns_after) - set(linux_device_luns) | ||
| ][0] | ||
|
|
||
| def _new_lun_detected( | ||
| _baseline: dict[str, int] = linux_device_luns, | ||
| ) -> bool: | ||
| nonlocal linux_device_luns_after | ||
| linux_device_luns_after = disk.get_luns() | ||
| new_keys = set(linux_device_luns_after) - set(_baseline) | ||
| return len(new_keys) > 0 | ||
|
|
||
| # 30s matches the disk-detection timeout used in | ||
| # _hot_add_disk_parallel for partition appearance after attach. | ||
| check_till_timeout( | ||
| _new_lun_detected, | ||
| timeout_message=( | ||
| f"new LUN not detected after disk attach at lun {lun}, " | ||
| f"luns_before: {linux_device_luns}, " | ||
| f"luns_after: {linux_device_luns_after}" | ||
| ), | ||
| timeout=30, | ||
| interval=1, | ||
| ) | ||
|
Comment on lines
+863
to
+872
|
||
| new_lun_keys: list[str] = list( | ||
| set(linux_device_luns_after) - set(linux_device_luns) | ||
| ) | ||
|
Comment on lines
+853
to
+875
|
||
| assert_that(new_lun_keys, "Expected exactly one new LUN device").is_length( | ||
| 1 | ||
| ) | ||
| linux_device_lun_diff = linux_device_luns_after[new_lun_keys[0]] | ||
|
||
| log.debug(f"linux_device_luns: {linux_device_luns}") | ||
| log.debug(f"linux_device_luns_after: {linux_device_luns_after}") | ||
| log.debug(f"linux_device_lun_diff: {linux_device_lun_diff}") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider linking the related issue/bug for traceability, since this PR is a bug fix (helps future debugging and release notes).