Skip to content

Commit

Permalink
OCPBUGS-20350: vSphere,segfaul on version check
Browse files Browse the repository at this point in the history
In some scenario vCenter does not have defined
the `HostSystem.Config.Product.Version`
This causes a segfault in the installer.
If `Config` is unavailable emit error and fail.
  • Loading branch information
jcpowermac committed Oct 12, 2023
1 parent d4ebae5 commit 3cdd2c3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/asset/installconfig/vsphere/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,20 @@ func validateESXiVersion(validationCtx *validationContext, clusterPath string, v
}

for _, h := range hosts {
var esxiHostVersion *version.Version
var mh mo.HostSystem
err := h.Properties(context.TODO(), h.Reference(), []string{"config.product"}, &mh)
if err != nil {
return append(allErrs, field.InternalError(vSphereFldPath, err))
}

esxiHostVersion, err := version.NewVersion(mh.Config.Product.Version)
if err != nil {
return append(allErrs, field.InternalError(vSphereFldPath, err))
if mh.Config != nil {
esxiHostVersion, err = version.NewVersion(mh.Config.Product.Version)
if err != nil {
return append(allErrs, field.InternalError(vSphereFldPath, err))
}
} else {
return append(allErrs, field.InternalError(vSphereFldPath, errors.Errorf("vCenter is failing to retrieve config product version information for the ESXi host: %s", h.Name())))
}

detail := fmt.Sprintf("The vSphere storage driver requires a minimum of vSphere 7 Update 2. The ESXi host: %s is version: %s and build: %s",
Expand Down

0 comments on commit 3cdd2c3

Please sign in to comment.