Bug 1972582

Summary: [oVirt] Installing with an oVirt network with 2 vnics on the same network causes the installer to not create tfvars and fail with terraform error
Product: OpenShift Container Platform Reporter: Gal Zaidman <gzaidman>
Component: InstallerAssignee: Gal Zaidman <gzaidman>
Installer sub component: OpenShift on RHV QA Contact: Michael Burman <mburman>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: unspecified    
Version: 4.9   
Target Milestone: ---   
Target Release: 4.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-18 17:34:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gal Zaidman 2021-06-16 09:26:26 UTC
When running the installer with an install config that contains a network name but no VNic profile, and on the oVirt side there is more then one VNIC profile attached to the network then the installer will fail with error on missing tfvars.
The missing tfvars are all the oVirt specific vars and the tfvarts.json file is never written.

Example of the error:
```
....

ERROR Error: No value for required variable        
ERROR                                              
ERROR   on ../../../openshift-install-948796804/variables-ovirt.tf line 111: 
ERROR  111: variable "ovirt_master_affinity_groups" { 
ERROR                                              
ERROR The root module input variable "ovirt_master_affinity_groups" is not set, and 
ERROR has no default value. Use a -var or -var-file command line argument to provide 
ERROR a value for this variable.                   
ERROR                                              
ERROR Failed to read tfstate: open /tmp/openshift-install-948796804/terraform.tfstate: no such file or directory 
FATAL failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: failed to apply Terraform: failed to complete the change 
```

When looking into the code we do check that and should return a good error message[1], but since this is a custom error and the err var is actually nil then we return with nil which causes the installation to continue and fail when it can't start terraform.

How to test:
Try to install openshift on oVirt with a network that has 2 VNICs attached and expect to get a clear error message:

"failed to compute values for Engine platform, there are multiple vNIC profiles. found 2 vNIC profiles for network _______"

[1] https://github.com/openshift/installer/blob/master/pkg/asset/cluster/tfvars.go#L534

Comment 7 Michael Burman 2021-07-18 08:52:21 UTC
Verified on - openshift-install-linux-4.9.0-0.nightly-2021-07-17-212317 with
rhvm-4.4.7.6-0.11.el8ev.noarch

The installer fails now with more meaningful error message to the user:

"DEBUG Generating Terraform Variables...            
FATAL failed to fetch Terraform Variables: failed to generate asset "Terraform Variables": failed to compute values for Engine platform, there are multiple vNIC profiles. found 2 vNIC profiles for network ovirtmgmt "

Comment 10 errata-xmlrpc 2021-10-18 17:34:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:3759