Skip to content

Commit

Permalink
MGMT-14750: Allow FC, ECKD, FBA drive types on s390x (openshift#5269)
Browse files Browse the repository at this point in the history
Multipath cannot be enabled in day1 on s390x, so we will allow
installing directly on an FC path only for this arch.  In addition,
there are two new drive types for IBM DASDs (direct access storage
devices).
  • Loading branch information
avishayt authored and danielerez committed Oct 15, 2023
1 parent 46ac8ce commit 4f6d164
Show file tree
Hide file tree
Showing 15 changed files with 210 additions and 74 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions internal/common/test_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ func IncrementCidrMask(subnet string) string {

func GenerateTestDefaultInventory() string {
inventory := &models.Inventory{
CPU: &models.CPU{
Architecture: models.ClusterCPUArchitectureX8664,
},
Interfaces: []*models.Interface{
{
Name: "eth0",
Expand Down Expand Up @@ -363,6 +366,9 @@ func GenerateTestInventoryWithVirtualInterface(physicalInterfaces, virtualInterf
interfaces := generateInterfaces(physicalInterfaces, "physical")
interfaces = append(interfaces, generateInterfaces(virtualInterfaces, "device")...)
inventory := &models.Inventory{
CPU: &models.CPU{
Architecture: models.ClusterCPUArchitectureX8664,
},
Interfaces: interfaces,
Disks: []*models.Disk{
TestDefaultConfig.Disks,
Expand Down
16 changes: 8 additions & 8 deletions internal/hardware/mock_validator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions internal/hardware/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ type Validator interface {
GetHostInstallationPath(host *models.Host) string
GetClusterHostRequirements(ctx context.Context, cluster *common.Cluster, host *models.Host) (*models.ClusterHostRequirements, error)
GetInfraEnvHostRequirements(ctx context.Context, infraEnv *common.InfraEnv) (*models.ClusterHostRequirements, error)
DiskIsEligible(ctx context.Context, disk *models.Disk, infraEnv *common.InfraEnv, cluster *common.Cluster, host *models.Host, allDisks []*models.Disk) ([]string, error)
DiskIsEligible(ctx context.Context, disk *models.Disk, infraEnv *common.InfraEnv, cluster *common.Cluster, host *models.Host, hostArchitecture string, allDisks []*models.Disk) ([]string, error)
ListEligibleDisks(inventory *models.Inventory) []*models.Disk
IsValidStorageDeviceType(disk *models.Disk) bool
IsValidStorageDeviceType(disk *models.Disk, hostArchitecture string) bool
GetInstallationDiskSpeedThresholdMs(ctx context.Context, cluster *common.Cluster, host *models.Host) (int64, error)
// GetPreflightHardwareRequirements provides hardware (host) requirements that can be calculated only using cluster information.
// Returned information describe requirements coming from OCP and OLM operators.
Expand Down Expand Up @@ -104,7 +104,7 @@ func isNvme(name string) bool {
// it against a list of predicates. Returns all the reasons the disk
// was found to be not eligible, or an empty slice if it was found to
// be eligible
func (v *validator) DiskIsEligible(ctx context.Context, disk *models.Disk, infraEnv *common.InfraEnv, cluster *common.Cluster, host *models.Host, allDisks []*models.Disk) ([]string, error) {
func (v *validator) DiskIsEligible(ctx context.Context, disk *models.Disk, infraEnv *common.InfraEnv, cluster *common.Cluster, host *models.Host, hostArchitecture string, allDisks []*models.Disk) ([]string, error) {
var requirements *models.ClusterHostRequirements
var err error
if cluster != nil {
Expand All @@ -126,9 +126,9 @@ func (v *validator) DiskIsEligible(ctx context.Context, disk *models.Disk, infra
humanize.Bytes(uint64(disk.SizeBytes)), humanize.Bytes(uint64(minSizeBytes))))
}

if !v.IsValidStorageDeviceType(disk) {
if !v.IsValidStorageDeviceType(disk, hostArchitecture) {
notEligibleReasons = append(notEligibleReasons,
fmt.Sprintf(wrongDriveTypeTemplate, disk.DriveType, strings.Join(v.getValidDeviceStorageTypes(), ", ")))
fmt.Sprintf(wrongDriveTypeTemplate, disk.DriveType, strings.Join(v.getValidDeviceStorageTypes(hostArchitecture), ", ")))
}

// We only allow multipath if all paths are FC
Expand All @@ -147,8 +147,8 @@ func (v *validator) DiskIsEligible(ctx context.Context, disk *models.Disk, infra
return notEligibleReasons, nil
}

func (v *validator) IsValidStorageDeviceType(disk *models.Disk) bool {
return funk.ContainsString(v.getValidDeviceStorageTypes(), string(disk.DriveType))
func (v *validator) IsValidStorageDeviceType(disk *models.Disk, hostArchitecture string) bool {
return funk.ContainsString(v.getValidDeviceStorageTypes(hostArchitecture), string(disk.DriveType))
}

func (v *validator) purgeServiceReasons(reasons []string) []string {
Expand Down Expand Up @@ -411,8 +411,12 @@ func (v *validator) getOCPRequirementsForVersion(openshiftVersion string) (*mode
return v.VersionedRequirements.GetVersionedHostRequirements(openshiftVersion)
}

func (v *validator) getValidDeviceStorageTypes() []string {
return []string{string(models.DriveTypeHDD), string(models.DriveTypeSSD), string(models.DriveTypeMultipath)}
func (v *validator) getValidDeviceStorageTypes(hostArchitecture string) []string {
validTypes := []string{string(models.DriveTypeHDD), string(models.DriveTypeSSD), string(models.DriveTypeMultipath)}
if hostArchitecture == models.ClusterCPUArchitectureS390x {
validTypes = append(validTypes, string(models.DriveTypeFC), string(models.DriveTypeECKDESE), string(models.DriveTypeECKD), string(models.DriveTypeFBA))
}
return validTypes
}

func compileDiskReasonTemplate(template string, wildcards ...interface{}) *regexp.Regexp {
Expand Down

0 comments on commit 4f6d164

Please sign in to comment.