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

tests/raid: support mountpoints for lsblk --json #244

Merged
merged 1 commit into from
Oct 15, 2021
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
18 changes: 14 additions & 4 deletions kola/tests/misc/raid.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,13 @@ type lsblkOutput struct {
}

type blockdevice struct {
Name string `json:"name"`
Type string `json:"type"`
Mountpoint *string `json:"mountpoint"`
Children []blockdevice `json:"children"`
Name string `json:"name"`
Type string `json:"type"`
Mountpoint *string `json:"mountpoint"`
// Mountpoints holds all mountpoints relevant for the device
// it aims to replace `Mountpoint` from util-linux-2.37.
Mountpoints []string `json:"mountpoints"`
Children []blockdevice `json:"children"`
}

// checkIfMountpointIsRaid will check if a given machine has a device of type
Expand All @@ -218,6 +221,13 @@ func checkIfMountpointIsRaid(c cluster.TestCluster, m platform.Machine, mountpoi
// is found to be mounted at /.
func checkIfMountpointIsRaidWalker(c cluster.TestCluster, bs []blockdevice, mountpoint string) bool {
for _, b := range bs {
// >= util-linux-2.37
for _, mnt := range b.Mountpoints {
if mnt == mountpoint && b.Type == "raid1" {
return true
}
}

if b.Mountpoint != nil && *b.Mountpoint == mountpoint {
if b.Type != "raid1" {
c.Fatalf("device %q is mounted at %q with type %q (was expecting raid1)", b.Name, mountpoint, b.Type)
Expand Down