Skip to content

Commit

Permalink
MGMT-19280: iSCSI colume should be eligible on day2 (#6999)
Browse files Browse the repository at this point in the history
Openshift version is empty when the cluster is day2.

This fix infer the openshift version from the infraenv when the cluster
is not available or is day2.

In this context, the only use of openshift version is to check if iSCSI
boot disk is supported (for OCP >= 4.15).
  • Loading branch information
adriengentil authored Nov 18, 2024
1 parent 2d6d787 commit d65b670
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion internal/hardware/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,14 @@ func (v *validator) DiskIsEligible(ctx context.Context, disk *models.Disk, infra
if cluster != nil {
requirements, err = v.GetClusterHostRequirements(ctx, cluster, host)
clusterVersion = cluster.OpenshiftVersion
if common.IsDay2Cluster(cluster) {
// infer Openshift version from the infraEnv is case of day2
// because cluster.OpenshiftVersion will be empty
clusterVersion = infraEnv.OpenshiftVersion
}
} else {
requirements, err = v.GetInfraEnvHostRequirements(ctx, infraEnv)
clusterVersion = ""
clusterVersion = infraEnv.OpenshiftVersion
}
if err != nil {
return nil, err
Expand Down
13 changes: 11 additions & 2 deletions internal/hardware/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,19 @@ var _ = Describe("Disk eligibility", func() {
Expect(err).ToNot(HaveOccurred())
Expect(eligible).To(ContainElement("Drive type is iSCSI, it must be one of HDD, SSD, Multipath."))

By("Check infra env iSCSI is not eligible")
By("Check iSCSI is eligible on day2 cluster")
testDisk.Iscsi = &models.Iscsi{HostIPAddress: "4.5.6.7"}
cluster.Kind = swag.String(models.ClusterKindAddHostsCluster)
cluster.OpenshiftVersion = ""
infraEnv.OpenshiftVersion = "4.16"
eligible, err = hwvalidator.DiskIsEligible(ctx, &testDisk, infraEnv, &cluster, &host, inventory)
Expect(err).ToNot(HaveOccurred())
Expect(eligible).To(BeEmpty())

By("Check infra env iSCSI is eligible")
eligible, err = hwvalidator.DiskIsEligible(ctx, &testDisk, infraEnv, nil, &host, inventory)
Expect(err).ToNot(HaveOccurred())
Expect(eligible).To(ContainElement("Drive type is iSCSI, it must be one of HDD, SSD, Multipath."))
Expect(eligible).To(BeEmpty())
})

It("Check that FC multipath is eligible", func() {
Expand Down

0 comments on commit d65b670

Please sign in to comment.