Bug 1973076

Summary: [oVirt] CSI driver is not waiting for disk to be OK on creation
Product: OpenShift Container Platform Reporter: Gal Zaidman <gzaidman>
Component: StorageAssignee: Gal Zaidman <gzaidman>
Storage sub component: oVirt CSI Driver QA Contact: Gal Zaidman <gzaidman>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: aos-bugs, mburman
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:57 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-17 08:38:31 UTC
Description of problem:

When we create a PVC the driver will create the disk but not wait for it to reach OK state, meaning it will remain in LOCKED state for a couple of minutes.
After the PVC is created CSI is trying to attach it, so "ControllerPublishVolume" will be called and will fail as long as the disk is on locked state.
It will keep retrying and succeed at the end, but the retries and failure just spam the logs and cause unneccecry operations and API calls.
Instead the driver should wait till the disk reaches OK state and only when the disk is OK approve that create is done.

How to test:
Look at the logs of:
- oc logs -c csi-driver ovirt-csi-driver-controller-xxxxxxxxxxxxxxxxx
  And see that there are no repeating errors like:
```
2021-06-17T06:24:54.414993681Z E0617 06:24:54.414934       1 server.go:125] /csi.v1.Controller/ControllerPublishVolume returned with error: Fault reason is "Operation Failed". Fault detail is "[Cannot attach Virtual Disk: The following disks are locked: pvc-6d4bc473-2ef3-4d35-8576-7bc0de9319a9. Please try again in a few minutes.]". HTTP response code is "409". HTTP response message is "409 Conflict".
```
- oc logs -c csi-attacher ovirt-csi-driver-controller-xxxxxxxxxxxxxxxxx
  And see that there are no repeating errors like:
```
2021-06-17T06:24:49.251515656Z I0617 06:24:49.251476       1 csi_handler.go:228] Error processing "csi-a156309f8e7277790123d7202198dd5e5bd966a38d1294eb50d5f363221e9ff9": failed to attach: rpc error: code = Unknown desc = Fault reason is "Operation Failed". Fault detail is "[Cannot attach Virtual Disk: The following disks are locked: pvc-516274d5-e4c3-48a6-8aa9-73a10f098e25. Please try again in a few minutes.]". HTTP response code is "409". HTTP response message is "409 Conflict".
```

Comment 4 errata-xmlrpc 2021-10-18 17:34:57 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