Bug 1879165

Summary: uploading image will fail, if connection to host is not possible. ovirt-imageio-proxy is not used
Product: Red Hat Enterprise Virtualization Manager Reporter: Steffen Froemer <sfroemer>
Component: ovirt-ansible-collectionAssignee: Martin Necas <mnecas>
Status: CLOSED ERRATA QA Contact: Pavol Brilla <pbrilla>
Severity: medium Docs Contact:
Priority: high    
Version: 4.3.10CC: ahadas, lleistne, mavital, michal.skrivanek, mnecas, mperina
Target Milestone: ovirt-4.4.3   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: ansible-2.9.14 or ovirt-ansible-collection-1.2.0 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-24 13:10:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Steffen Froemer 2020-09-15 15:03:08 UTC
Description of problem:


Version-Release number of selected component (if applicable):
ansible-playbook 2.9.10
  config file = /ansible/playbooks/ansible.cfg
  configured module search path = [u'/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Sep 26 2019, 13:23:47) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]


How reproducible:
100%

Steps to Reproduce:
1. prepare upload-iso.yml

       - name: upload ISO image                                                      
         ovirt_disk:                                                                 
             auth: "{{ ovirt_auth }}"                                                
             name: RHV-toolsSetup_4.3_10.iso                                         
             description: RHV-toolsSetup_4.3_10.iso                                  
             upload_image_path: /home/user1/Downloads/RHV-toolsSetup_4.3_10.iso   
             storage_domain: DEFAULT                                                     
             format: raw                                                             
             content_type: iso                                                       


2. block outgoing traffic to port 54322 (imageio-port on RHV-host)
   # sudo firewall-cmd --direct --add-rule ipv4 filter OUTPUT 0 -p tcp --dport=54322 -j DROP
3. 

Actual results:
Traceback (most recent call last):                                                                                                      
  File "/tmp/ansible_ovirt_disk_payload_flseXF/ansible_ovirt_disk_payload.zip/ansible/modules/ovirt_disk.py", line 759, in main                                                                                                                                                 
  File "/tmp/ansible_ovirt_disk_payload_flseXF/ansible_ovirt_disk_payload.zip/ansible/modules/ovirt_disk.py", line 494, in upload_disk_image                                                                                                                                    
  File "/tmp/ansible_ovirt_disk_payload_flseXF/ansible_ovirt_disk_payload.zip/ansible/modules/ovirt_disk.py", line 411, in transfer                                                                                                                                             
  File "/tmp/ansible_ovirt_disk_payload_flseXF/ansible_ovirt_disk_payload.zip/ansible/modules/ovirt_disk.py", line 358, in create_transfer_connection                                                                                                                           
  File "/usr/lib64/python2.7/httplib.py", line 1266, in connect                                                                                                                                                                                                                 
    HTTPConnection.connect(self)                                                                                                                                                                                                                                                
  File "/usr/lib64/python2.7/httplib.py", line 833, in connect                                                                          
    self.timeout, self.source_address)                                                                                                                                                                                                                                          
  File "/usr/lib64/python2.7/socket.py", line 571, in create_connection                                                                                                                                                                                                         
    raise err                                                                                                                           
timeout: timed out    

Expected results:
[WARNING]: Cannot connect to https://rhv-host-01.crazy.lab:54322/images/5f3cd817-e18c-4cbd-8a00-d78f22165ed4, trying    
https://rhv-m.crazy.lab:54323/images/5f3cd817-e18c-4cbd-8a00-d78f22165ed4: timed out                                    


Additional info:
It's possible to workaround this issue by applying following patch

diff -u /usr/lib/python3.8/site-packages/ansible/modules/cloud/ovirt/ovirt_disk.py library/ovirt_disk.py          
--- /usr/lib/python3.8/site-packages/ansible/modules/cloud/ovirt/ovirt_disk.py  2020-09-01 07:48:25.000000000 +0200
+++ library/ovirt_disk.py       2020-09-15 16:50:37.469676732 +0200
@@ -351,7 +351,7 @@
         url.netloc, context=context, timeout=connect_timeout)
     try:
         connection.connect()
-    except OSError as e:
+    except Exception as e:
         # Typically ConnectionRefusedError or socket.gaierror.
         module.warn("Cannot connect to %s, trying %s: %s" % (transfer.transfer_url, transfer.proxy_url, e))

Comment 1 Martin Necas 2020-09-29 09:15:24 UTC
Merged to ansible 2.9 and should be released in 2.9.14.

Comment 2 Martin Perina 2020-09-29 09:30:49 UTC
It will also be included in ovirt-ansible-collection-1.2.0

Comment 6 Pavol Brilla 2020-11-05 16:57:57 UTC
will need to discuss with developer I am hitting different timeout message:
The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_ovirt.ovirt.ovirt_disk_payload_hdwm4aha/ansible_ovirt.ovirt.ovirt_disk_payload.zip/ansible_collections/ovirt/ovirt/plugins/modules/ovirt_disk.py", line 802, in main
  File "/tmp/ansible_ovirt.ovirt.ovirt_disk_payload_hdwm4aha/ansible_ovirt.ovirt.ovirt_disk_payload.zip/ansible_collections/redhat/rhv/plugins/module_utils/ovirt.py", line 652, in create
    poll_interval=self._module.params['poll_interval'],
  File "/tmp/ansible_ovirt.ovirt.ovirt_disk_payload_hdwm4aha/ansible_ovirt.ovirt.ovirt_disk_payload.zip/ansible_collections/redhat/rhv/plugins/module_utils/ovirt.py", line 370, in wait
    raise Exception("Timeout exceed while waiting on result state of the entity.")
Exception: Timeout exceed while waiting on result state of the entity.

Comment 7 Lucie Leistnerova 2020-11-23 16:24:16 UTC
running module from collections
- name: upload ISO image
  redhat.rhv.ovirt_disk:
  ...
did not fail, showed warning and uses installed proxy

[WARNING]: Cannot connect to
https://<host>:54322/images/ee269118-22b6-4f62-839c-f180d78ba3af, trying
https://<engine>:54323/images/ee269118-22b6-4f62-839c-f180d78ba3af: timed out
changed: [localhost]

verified with ovirt-ansible-collection-1.2.2-1.el8ev.noarch, ansible 2.9.14

Comment 11 errata-xmlrpc 2020-11-24 13:10: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 (RHV Engine and Host Common Packages 4.4.z [ovirt-4.4.3]), 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/RHBA-2020:5212

Comment 12 meital avital 2022-07-28 13:42:58 UTC
Due to QE capacity, we are not going to cover this issue in our automation