Tests failing: Malformed request url

Bug #920782 reported by Adam Gandelman
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tempest
Fix Released
Critical
Jay Pipes

Bug Description

Note: https://review.openstack.org/#change,3330

Tests fail against trunk with a common error across all tests.

root@ip-10-252-4-120:~/tempest# nosetests -xvd -s tempest/tests/test_flavors.py
The expected flavor details should be returned ... ERROR

======================================================================
ERROR: The expected flavor details should be returned
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/tempest/tempest/tests/test_flavors.py", line 40, in test_get_flavor
    resp, flavor = self.client.get_flavor_details(self.flavor_id)
  File "/root/tempest/tempest/services/nova/json/flavors_client.py", line 39, in get_flavor_details
    resp, body = self.client.get("flavors/%s" % str(flavor_id))
  File "/root/tempest/tempest/common/rest_client.py", line 89, in get
    return self.request('GET', url)
  File "/root/tempest/tempest/common/rest_client.py", line 114, in request
    raise exceptions.BadRequest(body['badRequest']['message'])
BadRequest: Bad request
Details: Malformed request url

For GET requests like this, nova-api.log shows:

2012-01-24 02:17:32,128 INFO nova.api.openstack.wsgi [req-dd51dd4f-58c9-4e95-a2df-25eb0b331004 8b6167e7166143abb335182e3f97d007 d32213f4fa104b02924c151e0b131082] GET http://ip-10-252-4-120.us-west-2.compute.internal:8774/v1.1/admin/flavors/1
2012-01-24 02:17:32,128 DEBUG nova.api.openstack.wsgi [req-dd51dd4f-58c9-4e95-a2df-25eb0b331004 8b6167e7166143abb335182e3f97d007 d32213f4fa104b02924c151e0b131082] Unrecognized Content-Type provided in request from (pid=7315) debug /usr/lib/python2.7/dist-packages/nova/log.py:175

I'm not sure if something has changed in the recent API V2 changes. This is against a mult-node deployment but I've confirmed the same failures against a devstack deploy.

Note: https://review.openstack.org/#change,3330 needs merging before Tempest can configure its RestClient services without failure.

Revision history for this message
Jay Pipes (jaypipes) wrote :

Yeah, I'm getting similar errors in a bunch of tests:

======================================================================
ERROR: test suite for <class 'tempest.tests.test_extensions.ExtentionsTest'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/pymodules/python2.7/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/pymodules/python2.7/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/lib/pymodules/python2.7/nose/util.py", line 478, in try_run
    return func()
  File "/home/jpipes/repos/tempest/tempest/tests/test_extensions.py", line 11, in setUpClass
    cls.os = openstack.Manager()
  File "/home/jpipes/repos/tempest/tempest/openstack.py", line 27, in __init__
    self.config.nova.tenant_name)
  File "/home/jpipes/repos/tempest/tempest/services/nova/json/servers_client.py", line 12, in __init__
    auth_url, 'nova', tenant_name)
  File "/home/jpipes/repos/tempest/tempest/common/rest_client.py", line 17, in __init__
    tenant_name)
TypeError: 'NoneType' object is not iterable

Here is the tempest.conf I'm using:

[nova]
host=192.168.1.98
port=5000
apiVer=v2
path=tokens
user=admin
api_key=pass
tenant_name=admin
ssh_timeout=300
build_interval=10
build_timeout=600

[environment]
image_ref=72b2793d-45d6-4ee4-8732-1ea29d102561
image_ref_alt=72b2793d-45d6-4ee4-8732-1ea29d102561
flavor_ref=1
flavor_ref_alt=2
create_image_enabled=true
resize_available=true
authentication=keystone_v2

[image]
host = 192.168.1.98
port = 9292
service_token = servicetoken

Changed in tempest:
status: New → Confirmed
importance: Undecided → Critical
milestone: none → essex-3
Revision history for this message
Daryl Walleck (dwalleck) wrote :

You'll get this if you're using a current Essex version of Nova. I have this fix in my dev branch, but haven't decided best how to add this in for compatibility purposes for folks using Diablo. Perhaps a nova version flag?

Revision history for this message
Jay Pipes (jaypipes) wrote :

Ignore my previous comment... I hadn't set up my multi-node config properly in devstack...

I am now seeing your message too:

======================================================================
ERROR: List of all extensions
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jpipes/repos/tempest/tempest/tests/test_extensions.py", line 18, in test_list_extensions
    resp, extensions = self.client.list_extensions()
  File "/home/jpipes/repos/tempest/tempest/services/nova/json/extensions_client.py", line 14, in list_extensions
    resp, body = self.client.get(url)
  File "/home/jpipes/repos/tempest/tempest/common/rest_client.py", line 89, in get
    return self.request('GET', url)
  File "/home/jpipes/repos/tempest/tempest/common/rest_client.py", line 114, in request
    raise exceptions.BadRequest(body['badRequest']['message'])
BadRequest: Bad request
Details: Malformed request url

Changed in tempest:
assignee: nobody → Jay Pipes (jaypipes)
Revision history for this message
Daryl Walleck (dwalleck) wrote :

Using Tempest trunk I see this:

Daryls-MacBook-Pro:tempest dwalleck$ nosetests -sv tempest/tests/test_flavors.py
The expected flavor details should be returned ... ERROR
flavor details are not returned for non existant flavors ... ERROR
List of all flavors should contain the expected flavor ... ERROR
The detailed list of flavors should be filtered by disk space ... ERROR
The detailed list of flavors should be filtered by RAM ... ERROR
Only the expected number of flavors (detailed) should be returned ... ok
The list of flavors should start from the provided marker ... ok
The list of flavors should be filtered by disk space ... ERROR
The list of flavors should be filtered by RAM ... ERROR
Only the expected number of flavors should be returned ... ok
The list of flavors should start from the provided marker ... ok
Detailed list of all flavors should contain the expected flavor ... ERROR

...but if I remove lines 76-80 and change the return to return back mgmt_url, then everything passes. Unfortunately, there's no direct way to tell from authenticating if you should be using the tenant name or tenant id in the URL. I really wish there was, else we may need another feature flag for this.

Revision history for this message
Jay Pipes (jaypipes) wrote :

OK, I believe I have figured this out... I compared the nova-api log output from during a simple tempest run to the output after I clicked the Flavors tab in Horizon.

Turns out the difference is that the tenant ID is used in the URLs in Horizon and we are using the tenant name in our URLs...

Jay Pipes (jaypipes)
Changed in tempest:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.openstack.org/3340

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/3340
Committed: http://github.com/openstack/tempest/commit/745259cba52a80fec4c42484bc6d3b79b0a41eda
Submitter: Jenkins
Branch: master

commit 745259cba52a80fec4c42484bc6d3b79b0a41eda
Author: Jay Pipes <email address hidden>
Date: Mon Jan 23 23:24:54 2012 -0500

    Fixes LP #920782 - Malformed request URL

    Sometime recently, the tenant ID instead of the tenant Name
    was used in Compute URLs, and we were appending the tenant Name
    to the management URL returned from Keystone improperly.

    This patch grabs the tenant ID from the returned management URl
    and appends the tenant ID instead of the tenant Name.

    Change-Id: I4d4d23b3722c5c67463592397c5b23c5f3281c30

Changed in tempest:
status: In Progress → Fix Committed
Jay Pipes (jaypipes)
Changed in tempest:
status: Fix Committed → Fix Released
Revision history for this message
xu hongna (hongnax-xu) wrote :

the issue comes back, i encounter it on ubuntu 12.10 with the latest master branch ce4e43fe6fcba0e85d143363ef6d9e4d4719b051
======================================================================
22:27:42 ERROR: test suite for <module 'tempest.tests.compute' from '/opt/stack/tempest/tempest/tests/compute/__init__.py'>
22:27:42 ----------------------------------------------------------------------
22:27:42 Traceback (most recent call last):
22:27:42 File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 208, in run
22:27:42 self.setUp()
22:27:42 File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 291, in setUp
22:27:42 self.setupContext(ancestor)
22:27:42 File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 314, in setupContext
22:27:42 try_run(context, names)
22:27:42 File "/usr/lib/python2.7/dist-packages/nose/util.py", line 478, in try_run
22:27:42 return func()
22:27:42 File "/opt/stack/tempest/tempest/tests/compute/__init__.py", line 49, in setup_package
22:27:42 extensions_client.is_enabled('DiskConfig'))
22:27:42 File "/opt/stack/tempest/tempest/services/compute/json/extensions_client.py", line 37, in is_enabled
22:27:42 _, extensions = self.list_extensions()
22:27:42 File "/opt/stack/tempest/tempest/services/compute/json/extensions_client.py", line 32, in list_extensions
22:27:42 resp, body = self.get(url)
22:27:42 File "/opt/stack/tempest/tempest/common/rest_client.py", line 173, in get
22:27:42 return self.request('GET', url, headers, wait=wait)
22:27:42 File "/opt/stack/tempest/tempest/common/rest_client.py", line 201, in request
22:27:42 self._set_auth()
22:27:42 File "/opt/stack/tempest/tempest/common/rest_client.py", line 73, in _set_auth
22:27:42 self.tenant_name)
22:27:42 TypeError: 'NoneType' object is not iterable

Revision history for this message
Jay Pipes (jaypipes) wrote :

Hi Xu,

Are you using devstack? If not, do you have SSL enabled endpoints?

Thanks!
-jay

Sean Dague (sdague)
Changed in tempest:
milestone: none → havana-3
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.