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

GetUsrDeviceNode: Use rootdev tool to resolve backing blockdev #453

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions kola/tests/util/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package util

import (
"fmt"
"strings"

"github.com/flatcar/mantle/kola/cluster"
"github.com/flatcar/mantle/platform"
Expand All @@ -31,14 +30,9 @@ func AssertBootedUsr(c cluster.TestCluster, m platform.Machine, usr string) {
}

func GetUsrDeviceNode(c cluster.TestCluster, m platform.Machine) string {
// find /usr dev (-f to see the first mount, not the sysext overlay mount)
usrdev := c.MustSSH(m, "findmnt -fno SOURCE /usr")

// XXX: if the /usr dev is /dev/mapper/usr, we're on a verity enabled
// image, so use dmsetup to find the real device.
if strings.TrimSpace(string(usrdev)) == "/dev/mapper/usr" {
usrdev = c.MustSSH(m, "echo -n /dev/$(sudo dmsetup info --noheadings -Co blkdevs_used usr)")
}
// The rootdev tool finds the backing block dev better than, e.g.,
// findmnt -fno SOURCE /usr and/or dmsetup info --noheadings -Co blkdevs_used usr
usrdev := c.MustSSH(m, "rootdev -s /usr")

return string(usrdev)
}
Expand Down