storage: refactor check for ext file systems

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
This commit is contained in:
Mark D Horn
2020-05-13 14:32:44 -07:00
committed by Mark Horn
parent 5f78e5cbd2
commit 33bae246b2
2 changed files with 12 additions and 7 deletions
+9
View File
@@ -740,3 +740,12 @@ func (bd *BlockDevice) isRaidType() bool {
}
return false
}
func (bd *BlockDevice) isExtFsType() bool {
if bd.FsType == "ext2" ||
bd.FsType == "ext3" ||
bd.FsType == "ext4" {
return true
}
return false
}
+3 -7
View File
@@ -2262,9 +2262,7 @@ func validateRoot(found *bool, bd *BlockDevice,
} else {
*found = true
rootBlockDevice = bd.Clone()
if !(bd.FsType == "ext2" || bd.FsType == "ext3" ||
bd.FsType == "ext4" || bd.FsType == "xfs" ||
bd.FsType == "f2fs") {
if !(bd.isExtFsType() || bd.FsType == "xfs" || bd.FsType == "f2fs") {
results = append(results, logPartitionMustBeWarning(bd, rootLabel, "ext*|xfs|f2fs"))
}
}
@@ -2310,8 +2308,7 @@ func validateBootLegacy(rootBlockDevice *BlockDevice, rootLabel, bootLabel strin
if mediaOpts.LegacyBios {
if rootBlockDevice != nil {
if !(rootBlockDevice.FsType == "ext2" || rootBlockDevice.FsType == "ext3" ||
rootBlockDevice.FsType == "ext4") {
if !(rootBlockDevice.isExtFsType()) {
// xfs currently not supported due to partition table of MBR requirement
log.Warning("validatePartitions: legacyMode, invalid fsType: %s", rootBlockDevice.FsType)
results = append(results,
@@ -2745,8 +2742,7 @@ func setBootPartition(medias []*BlockDevice, mediaOpts MediaOpts, dryRun *DryRun
// Need to disable the ext 64bit mode
// https://wiki.syslinux.org/wiki/index.php?title=Filesystem#ext
if bootBlockDevice.FsType == "ext2" ||
bootBlockDevice.FsType == "ext3" || bootBlockDevice.FsType == "ext4" {
if bootBlockDevice.isExtFsType() {
legacyExtFsOpt := "-O ^64bit"
if len(bootBlockDevice.Options) > 0 {
bootBlockDevice.Options = strings.TrimSpace(bootBlockDevice.Options) +