Bug 1480244

Summary: discover-tempest-config fails with a "TypeError" message
Product: Red Hat OpenStack Reporter: Tejas <tchandra>
Component: python-tempestconfAssignee: Martin Kopec <mkopec>
Status: CLOSED ERRATA QA Contact: Chandan Kumar <chkumar>
Severity: medium Docs Contact:
Priority: medium    
Version: 11.0 (Ocata)CC: apevec, dmacpher, hnallurv, jjoyce, lhh, mbenjamin, mmagr, slinaber, smanjara, tchandra
Target Milestone: z4Keywords: Triaged, ZStream
Target Release: 11.0 (Ocata)   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: python-tempestconf-1.1.3-1.1.el7ost Doc Type: Bug Fix
Doc Text:
The discover-tempest-config command failed with a 'TypeError' message due to how it handled images. This fix corrects how the command obtains image information from OpenStack Image Storage (glance). The 'TypeError' no longer appears and the command runs successfully.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-13 16:38:01 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:
Attachments:
Description Flags
discover-tempest-config log none

Description Tejas 2017-08-10 13:23:21 UTC
Description of problem:
     I am trying to integrate keystone (OS11) with a Ceph RGW config. Seeing an error message in the discover-tempest-config command . The same command has worked in the past runs. This is the first time we are running with Ceph Luminous (12.1) build.

Version-Release number of selected component (if applicable):
openstack-tempest-16.0.0-1.el7ost.noarch

How reproducible:
Always

Steps to Reproduce:
1. Deploy OS11 overcloud, successful.
2. Authenticate keystone v3 to use Ceph RGW, container creation successful.
3. Tempest setup fails

Attached the full command log

Additional info:
   2017-08-10 12:10:32.836 22613 INFO tempest.lib.common.rest_client [req-396704ab-e4db-494a-88a1-d5e25bc0b092 ] Request (main): 201 POST http://10.8.131.19:9292/v2/images 0.083s
2017-08-10 12:10:33.805 22613 WARNING urllib3.connectionpool [-] Retrying (Retry(total=9, connect=None, read=None, redirect=5)) after connection broken by 'ProtocolError('Connection aborted.', error(32, 'Broken pipe'))': /v2/images/42973c51-768b-48f7-87ab-4a2c88e09aa8/file
2017-08-10 12:10:33.806 22613 CRITICAL tempest [-] TypeError: must be string or buffer, not callable-iterator
2017-08-10 12:10:33.806 22613 ERROR tempest Traceback (most recent call last):
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/bin/discover-tempest-config", line 10, in <module>
2017-08-10 12:10:33.806 22613 ERROR tempest     sys.exit(main())
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/config_tempest/config_tempest.py", line 191, in main
2017-08-10 12:10:33.806 22613 ERROR tempest     args.image_disk_format)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/config_tempest/config_tempest.py", line 791, in create_tempest_images
2017-08-10 12:10:33.806 22613 ERROR tempest     disk_format=disk_format)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/config_tempest/config_tempest.py", line 817, in find_or_upload_image
2017-08-10 12:10:33.806 22613 ERROR tempest     image = _upload_image(client, image_name, image_dest, disk_format)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/config_tempest/config_tempest.py", line 990, in _upload_image
2017-08-10 12:10:33.806 22613 ERROR tempest     client.store_image_file(image['id'], data)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/tempest/lib/services/image/v2/images_client.py", line 151, in store_image_file
2017-08-10 12:10:33.806 22613 ERROR tempest     body=data, chunked=True)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/tempest/lib/common/rest_client.py", line 651, in request
2017-08-10 12:10:33.806 22613 ERROR tempest     body=body, chunked=chunked)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/tempest/lib/common/rest_client.py", line 547, in _request
2017-08-10 12:10:33.806 22613 ERROR tempest     chunked=chunked
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/tempest/lib/common/rest_client.py", line 580, in raw_request
2017-08-10 12:10:33.806 22613 ERROR tempest     body=body, chunked=chunked)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/tempest/lib/common/http.py", line 60, in request
2017-08-10 12:10:33.806 22613 ERROR tempest     *args, **new_kwargs)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/urllib3/request.py", line 73, in request
2017-08-10 12:10:33.806 22613 ERROR tempest     **urlopen_kw)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/urllib3/request.py", line 151, in request_encode_body
2017-08-10 12:10:33.806 22613 ERROR tempest     return self.urlopen(method, url, **extra_kw)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/urllib3/poolmanager.py", line 248, in urlopen
2017-08-10 12:10:33.806 22613 ERROR tempest     response = conn.urlopen(method, u.request_uri, **kw)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 668, in urlopen
2017-08-10 12:10:33.806 22613 ERROR tempest     release_conn=release_conn, **response_kw)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 595, in urlopen
2017-08-10 12:10:33.806 22613 ERROR tempest     chunked=chunked)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib/python2.7/site-packages/urllib3/connectionpool.py", line 363, in _make_request
2017-08-10 12:10:33.806 22613 ERROR tempest     conn.request(method, url, **httplib_request_kw)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib64/python2.7/httplib.py", line 1017, in request
2017-08-10 12:10:33.806 22613 ERROR tempest     self._send_request(method, url, body, headers)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib64/python2.7/httplib.py", line 1051, in _send_request
2017-08-10 12:10:33.806 22613 ERROR tempest     self.endheaders(body)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib64/python2.7/httplib.py", line 1013, in endheaders
2017-08-10 12:10:33.806 22613 ERROR tempest     self._send_output(message_body)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib64/python2.7/httplib.py", line 868, in _send_output
2017-08-10 12:10:33.806 22613 ERROR tempest     self.send(message_body)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib64/python2.7/httplib.py", line 840, in send
2017-08-10 12:10:33.806 22613 ERROR tempest     self.sock.sendall(data)
2017-08-10 12:10:33.806 22613 ERROR tempest   File "/usr/lib64/python2.7/socket.py", line 224, in meth
2017-08-10 12:10:33.806 22613 ERROR tempest     return getattr(self._sock,name)(*args)
2017-08-10 12:10:33.806 22613 ERROR tempest TypeError: must be string or buffer, not callable-iterator
2017-08-10 12:10:33.806 22613 ERROR tempest

Comment 1 Tejas 2017-08-10 13:28:57 UTC
Created attachment 1311768 [details]
discover-tempest-config log

Comment 7 Martin Kopec 2017-08-15 07:49:45 UTC
I think I've found the problem. The problem seems to be a new image can't be uploaded and python-tempestconf fails on that. 

I've tried to upload an image to glance manually in your environment and it failed:

[stack@magna008 cloud01]$ openstack image create --public --disk-format raw 
--file etc/cirros-0.3.1-x86_64-disk.img cirros-0.3.4-x86_64 --unprotected
500 Internal Server Error
The server has either erred or is incapable of performing the requested operation.
    (HTTP 500)

python-tempestconf tries to upload the image to glance, but it can't be done, so it fails. Once you can upload an image manually, it will work.
However, it's possible to use already existing image by specifying compute.image_ref and compute.image_ref_alt like:

$ discover-tempest-config --deployer-input ~/tempest-deployer-input.conf --debug --create identity.uri $OS_AUTH_URL identity.admin_password $OS_PASSWORD compute.image_ref $IMAGE_ID compute.image_ref_alt $IMAGE_ID_ALT

($ openstack image list  # check existing images)

Comment 10 Chandan Kumar 2017-12-12 10:13:51 UTC
The new package python-tempestconf-1.1.3-1.1.el7ost.noarch contains the bug fixes with the 1.1.3 tag and it's available in RHOS repositories -> marking as verified

Comment 14 errata-xmlrpc 2018-02-13 16:38:01 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, 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-2018:0311