Skip to content
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

blockdev: use --nodeps when querying single device #453

Merged
merged 2 commits into from Jan 15, 2021
Merged

blockdev: use --nodeps when querying single device #453

merged 2 commits into from Jan 15, 2021

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Jan 15, 2021

lsblk by default outputs the target device followed by all its reverse
dependencies. But interestingly, when using --pairs, the lsblk in
RHCOS seems to output the reverse dependency first before the target
device.

We were relying on correct ordering in lsblk_single, where all we care
about is the target device. Instead, explicitly use --nodeps in that
case so that lsblk knows to only print the target device. (The
lsblk() helper actually used to support that, but it was removed in
88de4fc.)

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1916502

src/blockdev.rs Outdated Show resolved Hide resolved
`lsblk` by default outputs the target device followed by all its reverse
dependencies. But interestingly, when using `--pairs`, the `lsblk` in
RHCOS seems to output the reverse dependency first before the target
device.

We were relying on correct ordering in `lsblk_single`, where all we care
about is the target device. Instead, explicitly use `--nodeps` in that
case so that `lsblk` knows to only print the target device. (The
`lsblk()` helper actually used to support that, but it was removed in
88de4fc.)

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1916502
Copy link
Contributor

@bgilbert bgilbert left a comment

Choose a reason for hiding this comment

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

@arithx confirmed that this fixes 1916502.

@bgilbert bgilbert merged commit 535f01a into coreos:master Jan 15, 2021
@jlebon
Copy link
Member Author

jlebon commented Mar 17, 2021

But interestingly, when using --pairs, the lsblk in
RHCOS seems to output the reverse dependency first before the target
device.

One clarification on this: it seems like in some cases, RHEL's lsblk does output things in the right order, which makes it all the more confusing. I think it may be dependent on the type of block devices involved.

jlebon added a commit to jlebon/fedora-coreos-config that referenced this pull request Mar 18, 2021
Sometimes `lsblk` returns devices in the wrong order, so we can't rely
on it to iterate over the devices in hierarchical order. Instead, use
the `holders/` directory ourselves directly and use `--nodeps` when
calling `lsblk`.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1934174#c4
See: https://bugzilla.redhat.com/show_bug.cgi?id=1940607
See: coreos/coreos-installer#453
jlebon added a commit to jlebon/fedora-coreos-config that referenced this pull request Mar 18, 2021
Sometimes `lsblk` returns devices in the wrong order, so we can't rely
on it to iterate over the devices in hierarchical order. Instead, use
the `holders/` directory ourselves directly and use `--nodeps` when
calling `lsblk`.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1934174#c4
See: https://bugzilla.redhat.com/show_bug.cgi?id=1940607
See: coreos/coreos-installer#453
jlebon added a commit to coreos/fedora-coreos-config that referenced this pull request Mar 19, 2021
Sometimes `lsblk` returns devices in the wrong order, so we can't rely
on it to iterate over the devices in hierarchical order. Instead, use
the `holders/` directory ourselves directly and use `--nodeps` when
calling `lsblk`.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1934174#c4
See: https://bugzilla.redhat.com/show_bug.cgi?id=1940607
See: coreos/coreos-installer#453
jlebon added a commit to jlebon/fedora-coreos-config that referenced this pull request Mar 19, 2021
Sometimes `lsblk` returns devices in the wrong order, so we can't rely
on it to iterate over the devices in hierarchical order. Instead, use
the `holders/` directory ourselves directly and use `--nodeps` when
calling `lsblk`.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1934174#c4
See: https://bugzilla.redhat.com/show_bug.cgi?id=1940607
See: coreos/coreos-installer#453
(cherry picked from commit 5228316)
miabbott pushed a commit to coreos/fedora-coreos-config that referenced this pull request Mar 22, 2021
Sometimes `lsblk` returns devices in the wrong order, so we can't rely
on it to iterate over the devices in hierarchical order. Instead, use
the `holders/` directory ourselves directly and use `--nodeps` when
calling `lsblk`.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1934174#c4
See: https://bugzilla.redhat.com/show_bug.cgi?id=1940607
See: coreos/coreos-installer#453
(cherry picked from commit 5228316)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants