kola/tests/misc: add Mountpoints member to blockdevice struct
This change addresses the issue with the `boot-mirror` kola test
that's failing on a rawhide-based FCOS (which is on
Note:
In Fedora-35,`lsblk --json` outputs `mountpoints`(slice) by default
instead of `mountpoint`, so we need to handle to both.
Closes
@@ -147,6 +147,9 @@ type blockdevice struct {
Name string `json:"name"`
Type string `json:"type"`
Mountpoint *string `json:"mountpoint"`
+ // new lsblk outputs `mountpoints` instead of
+ // `mountpoint`; we handle both
+ Mountpoints []string `json:"mountpoints"`
Children []blockdevice `json:"children"`
}
@@ -173,7 +176,7 @@ 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 {
- if b.Mountpoint != nil && *b.Mountpoint == mountpoint {
+ if checkIfBlockdevHasMountPoint(b, mountpoint) {
if b.Type != "raid1" {
c.Fatalf("device %q is mounted at %q with type %q (was expecting raid1)", b.Name, mountpoint, b.Type)
}
@@ -186,3 +189,18 @@ func checkIfMountpointIsRaidWalker(c cluster.TestCluster, bs []blockdevice, moun
}
return false
}
+
+// checkIfBlockdevHasMountPoint checks if a given block device has the
+// required mountpoint.
+func checkIfBlockdevHasMountPoint(b blockdevice, mountpoint string) bool {
+ if b.Mountpoint != nil && *b.Mountpoint == mountpoint {
+ return true
+ } else if len(b.Mountpoints) != 0 {
+ for _, mnt := range b.Mountpoints {
+ if mnt != "" && mnt == mountpoint {
+ return true
+ }
+ }
+ }
+ return false
+}
