Bug 1917898

Summary: [ovirt] install fails: due to terraform error "Tag not matched: expect <fault> but got <html>" on vm resource
Product: OpenShift Container Platform Reporter: Gal Zaidman <gzaidman>
Component: InstallerAssignee: Janos Bonic <jpasztor>
Installer sub component: OpenShift on RHV QA Contact: Michael Burman <mburman>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: mburman
Version: 4.8   
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 10:35:38 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:
Bug Depends On: 2082283    
Bug Blocks:    

Description Gal Zaidman 2021-01-19 15:53:03 UTC
Description:

Sometimes on CI we see the installtion fails due to:

level=error msg=Error: Tag not matched: expect <fault> but got <html>
level=error
level=error msg=  on ../tmp/openshift-install-310882907/masters/main.tf line 1, in resource "ovirt_vm" "master":
level=error msg=   1: resource "ovirt_vm" "master" {
level=error
level=error
level=fatal msg=failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: failed to apply Terraform: failed to complete the change

On the logs you can see:

Failed to wait for VM to become down: Tag not matched: expect <fault> but got <html>

On:
https://github.com/oVirt/terraform-provider-ovirt/blob/master/ovirt/resource_ovirt_vm.go#L573-L576

For example:
1. https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/release-openshift-ocp-installer-e2e-ovirt-4.7/1351398049187893248
2. https://prow.ci.openshift.org/view/gs/origin-ci-test/logs/release-openshift-ocp-installer-e2e-ovirt-4.7/1351180036639559680
3. https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/openshift_installer/4551/pull-ci-openshift-installer-master-e2e-ovirt/1351284354667515904

Comment 1 Janos Bonic 2021-03-11 17:55:33 UTC
A little bit of an update on this one, I managed to reproduce this one using the test suite from the Terraform plugin. Here's what I did:

```
export OVIRT_URL=https://engine-host-name-here
export OVIRT_USER=admin@internal
export OVIRT_PASSWORD=ovirt-password-here
make testacc TEST=./ovirt TESTARGS='-run=TestAccOvirtDataCenter_'
```

The result is the following:

```
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./ovirt -v -run=TestAccOvirtDataCenter_ -timeout 180m
=== RUN   TestAccOvirtDataCenter_basic
    testing.go:654: Step 0 error: errors during apply:

        Error: Tag not matched: expect <fault> but got <html>

          on /tmp/tf-test321684631/main.tf line 2:
          (source code not available)


--- FAIL: TestAccOvirtDataCenter_basic (0.78s)
FAIL
FAIL    github.com/ovirt/terraform-provider-ovirt/ovirt 0.789s
FAIL
make: *** [GNUmakefile:24: testacc] Error 1
```

If I remove "https://" from the URL I get this:

```
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./ovirt -v -run=TestAccOvirtDataCenter_ -timeout 180m
=== RUN   TestAccOvirtDataCenter_basic
    testing.go:654: Step 0 error: errors during apply:

        Error: Post "/ovirt-engine/sso/oauth/token": unsupported protocol scheme ""

          on /tmp/tf-test464444622/main.tf line 2:
          (source code not available)


--- FAIL: TestAccOvirtDataCenter_basic (0.03s)
FAIL
FAIL    github.com/ovirt/terraform-provider-ovirt/ovirt 0.042s
FAIL
make: *** [GNUmakefile:24: testacc] Error 1
```

Comment 2 Janos Bonic 2021-03-11 17:58:58 UTC
Update, if I enter export `OVIRT_URL=https://engine-host-name-here/ovirt-engine/api/`

Comment 3 Janos Bonic 2021-03-11 18:01:28 UTC
Gal, could you please post the ovirt-config.yaml file (with the credentials redacted)? It seems as if the ovirt-config was incorrect and the ovirt_url field is set incorrectly.

Comment 4 Gal Zaidman 2021-03-30 14:09:31 UTC
It is the CI ovirt config so it is OK...
It is being used for each job

due to capacity constraints, we will be revisiting this bug in the upcoming sprint

Comment 5 Janos Bonic 2021-07-01 11:58:08 UTC
This will hopefully be fixed when we switch to the new client library.

Comment 7 Janos Bonic 2022-06-21 07:08:45 UTC
Fixed in 2082283

Comment 8 Michael Burman 2022-06-21 08:31:00 UTC
(In reply to Janos Bonic from comment #7)
> Fixed in 2082283

Fixed in bz 2082283

Comment 9 Michael Burman 2022-06-23 12:37:57 UTC
The issue is gone.
Such terraform errors no longer visible in the installer.

Verified on - 4.11.0-0.nightly-2022-06-22-235234 and rhvm-4.5.1.2-0.11.el8ev.noarch

Comment 11 errata-xmlrpc 2022-08-10 10:35:38 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 (Important: OpenShift Container Platform 4.11.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-2022:5069