Skip to content

Commit

Permalink
Merge pull request #453 from flatcar/kai/find-usr
Browse files Browse the repository at this point in the history
GetUsrDeviceNode: Use rootdev tool to resolve backing blockdev
  • Loading branch information
pothos authored Sep 25, 2023
2 parents 7d8aac2 + 9b6a737 commit 1c50b2c
Showing 1 changed file with 3 additions and 9 deletions.
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

0 comments on commit 1c50b2c

Please sign in to comment.