Skip to content

Conversation

@openshift-cherrypick-robot

This is an automated cherry-pick of #4113

/assign joelcapitao

The test needs to be adapted so it doesn't verify that we're on
multipath based on whether the device is `/dev/mapper/mpath` or not,
but instead based on udevadm output.
This verification works whether or not the `user_friendly_names`
option is used while configuring multipath.
In order to have a more generic test, let's not use user-friendly names
while configuring multipath and specify instead a World Wide ID to the
stub device. We also adapt the systemd units accordingly.
@openshift-ci
Copy link

openshift-ci bot commented Nov 4, 2025

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 adapts the multipath tests to support configurations where user-friendly multipath device names are disabled. The changes correctly update the Butane configuration to use deterministic device paths based on WWID and modify the test verification logic accordingly. My review focuses on the correctness and efficiency of the updated test logic. I've identified a bug in handling command output and an opportunity to improve efficiency in the verifyMultipath function, providing a single suggestion that addresses both issues.

Comment on lines 153 to 157
srcdev := string(c.MustSSHf(m, "findmnt -nvr %s -o SOURCE", path))
if !strings.HasPrefix(srcdev, "/dev/mapper/mpath") {
udevinfo := string(c.MustSSHf(m, "udevadm info %s", srcdev))
if !strings.Contains(udevinfo, "/dev/disk/by-id/dm-uuid-mpath-") && !strings.Contains(udevinfo, "DM_MPATH") {
c.Fatalf("mount %s has non-multipath source %s", path, srcdev)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

There are a couple of issues in this function:

  1. Bug: The output from c.MustSSHf can include a trailing newline. When srcdev is passed to the udevadm info command, this newline is included, which will likely cause the command to fail because the path is incorrect (e.g., /dev/dm-0\n).
  2. Efficiency: The function makes two separate SSH calls. These can be combined into a single call to improve test efficiency by reducing network round-trips.

The suggested change below addresses both points by combining the commands into a single shell command and parsing the output in Go. The $(...) command substitution in the shell correctly handles stripping the newline from findmnt's output.

Suggested change
srcdev := string(c.MustSSHf(m, "findmnt -nvr %s -o SOURCE", path))
if !strings.HasPrefix(srcdev, "/dev/mapper/mpath") {
udevinfo := string(c.MustSSHf(m, "udevadm info %s", srcdev))
if !strings.Contains(udevinfo, "/dev/disk/by-id/dm-uuid-mpath-") && !strings.Contains(udevinfo, "DM_MPATH") {
c.Fatalf("mount %s has non-multipath source %s", path, srcdev)
}
out := string(c.MustSSHf(m, "srcdev=$(findmnt -nvr %s -o SOURCE) && echo \"$srcdev\" && udevadm info \"$srcdev\"", path))
parts := strings.SplitN(out, "\n", 2)
if len(parts) < 2 {
c.Fatalf("could not get device and udev info for mount %s: %s", path, out)
}
srcdev, udevinfo := parts[0], parts[1]
if !strings.Contains(udevinfo, "/dev/disk/by-id/dm-uuid-mpath-") && !strings.Contains(udevinfo, "DM_MPATH") {
c.Fatalf("mount %s has non-multipath source %s", path, srcdev)
}

@joelcapitao
Copy link
Member

/ok-to-test

Copy link
Contributor

@yasminvalim yasminvalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/LGTM

@joelcapitao joelcapitao merged commit e1ab85d into coreos:rhcos-4.17 Nov 4, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants