diff --git a/pkg/infrastructure/vsphere/clusterapi/import.go b/pkg/infrastructure/vsphere/clusterapi/import.go index e83faf40682..2ee85de5913 100644 --- a/pkg/infrastructure/vsphere/clusterapi/import.go +++ b/pkg/infrastructure/vsphere/clusterapi/import.go @@ -58,9 +58,17 @@ func checkOvaSecureBoot(ovfEnvelope *ovf.Envelope) bool { } func importRhcosOva(ctx context.Context, session *session.Session, folder *object.Folder, cachedImage, clusterID, tagID, diskProvisioningType string, failureDomain vsphere.FailureDomain) error { - name := fmt.Sprintf("%s-rhcos-%s-%s", clusterID, failureDomain.Region, failureDomain.Zone) + // Name originally was cluster id + fd.region + fd.zone. This could cause length of ova to be longer than max allowed. + // So for now, we are going to make cluster id + fd.name + name := fmt.Sprintf("%s-rhcos-%s", clusterID, failureDomain.Name) logrus.Infof("Importing OVA %v into failure domain %v.", name, failureDomain.Name) + // OVA name must not exceed 80 characters + if len(name) > 80 { + logrus.Warningf("Unable to generate ova template name due to exceeding 80 characters. Cluster=\"%v\" Failure Domain=\"%v\" results in \"%v\"", clusterID, failureDomain.Name, name) + return fmt.Errorf("ova name length exceeed 80 characters. %v has length %d. ") + } + archive := &importer.TapeArchive{Path: cachedImage} ovfDescriptor, err := importer.ReadOvf("*.ovf", archive)