-
Notifications
You must be signed in to change notification settings - Fork 183
[rhcos-4.17] kola/testiso: Adapt test for mpath name variations #4356
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
[rhcos-4.17] kola/testiso: Adapt test for mpath name variations #4356
Conversation
We adjust test to be compatible with both mpath friendly and non-friendly names.
|
Hi @openshift-cherrypick-robot. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
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.
Code Review
This pull request aims to make the multipath root test more robust by dynamically detecting the device name. The approach is good, but the new shell command has a bug in its use of findmnt that makes the test incorrect. I've also suggested further improvements to make the command more robust against cases with multiple or no multipath devices.
| Type=oneshot | ||
| RemainAfterExit=yes | ||
| ExecStart=/bin/bash -c '[[ $(findmnt -nvro SOURCE /sysroot) == /dev/mapper/mpatha4 ]]' | ||
| ExecStart=/bin/bash -c 'lsblk -pno NAME "/dev/mapper/$(multipath -l -v 1)" | grep -qw "$(findmnt -nvr /sysroot -o SOURCE)"' |
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.
This command has a few issues that make it incorrect or fragile:
- The
-vflag tofindmntmeans--invert, which will cause it to list the sources for all mountpoints except/sysroot. This is not the intended behavior. Thevshould be removed. - The
$(multipath -l -v 1)is quoted. Ifmultipathwere to return multiple devices (one per line), command substitution would replace newlines with spaces, andlsblkwould receive a single invalid path like"/dev/mapper/mpatha mpathb". While the current test setup only creates one multipath device, it's more robust to not quote this to allow for word splitting. - If
multipath -l -v 1returns no devices,lsblkwill be called on/dev/mapper/which lists all devices under it. This could lead to false positives. It's better to check thatmultipathreturns at least one device.
I'd also recommend using -v1 instead of -v 1 for multipath for better compatibility.
Here is a more robust version of the command that addresses these points:
| ExecStart=/bin/bash -c 'lsblk -pno NAME "/dev/mapper/$(multipath -l -v 1)" | grep -qw "$(findmnt -nvr /sysroot -o SOURCE)"' | |
| ExecStart=/bin/bash -c 'MPATH_DEVS=$(multipath -l -v1); [ -n "$MPATH_DEVS" ] && lsblk -pno NAME /dev/mapper/$MPATH_DEVS | grep -qw "$(findmnt -nr /sysroot -o SOURCE)"' |
|
/override continuous-integration/jenkins/pr-merge For some reason the worker pod is terminated consistently when cheking format with gofmt |
|
@joelcapitao: Overrode contexts on behalf of joelcapitao: continuous-integration/jenkins/pr-merge In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
yasminvalim
left a comment
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.
/lgtm
This is an automated cherry-pick of #4151
/assign joelcapitao