Requesting application/xml on return for extensions returns cloudServersFault 500

Bug #852141 reported by Anne Gentle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Kevin L. Mitchell

Bug Description

When I try to get responses in XML from extensions (specifically os_keypairs) I get an error.

curl -D - -H "X-Auth-Token: 999888777666" -H "Accept: application/xml" -G http://50.56.12.212:8774/v1.1/admin/os-keypairs

HTTP/1.1 500 Internal Server Error
Content-Length: 153
Content-Type: application/xml; charset=UTF-8
Date: Fri, 16 Sep 2011 19:31:53 GMT

<cloudServersFault code="500" xmlns="http://docs.openstack.org/compute/api/v1.1">
    <message>
        'extensions'
    </message>
</cloudServersFault>

also tried it with os_keypairs.xml with the same results.

Doing the same thing on /servers/ works.

curl -v 'http://dev2.rcb.me:8774/v1.1/admin/servers' -H 'X-Auth-Token: 999888777666' -H 'Accept: application/xml'
* About to connect() to dev2.rcb.me port 8774 (#0)
* Trying 50.56.12.212... connected
* Connected to dev2.rcb.me (50.56.12.212) port 8774 (#0)
> GET /v1.1/admin/servers HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
> Host: dev2.rcb.me:8774
> X-Auth-Token: 999888777666
> Accept: application/xml
>
< HTTP/1.1 200 OK
< Content-Type: application/xml
< Content-Length: 1425
< Date: Fri, 16 Sep 2011 19:34:55 GMT
<
<servers xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom">
    <server id="47" name="dt-qcow2">
        <atom:link href="http://dev2.rcb.me:8774/v1.1/admin/servers/47" rel="self"/>
        <atom:link href="http://dev2.rcb.me:8774/admin/servers/47" rel="bookmark"/>
    </server>
    <server id="46" name="dt-vmdk">
        <atom:link href="http://dev2.rcb.me:8774/v1.1/admin/servers/46" rel="self"/>
        <atom:link href="http://dev2.rcb.me:8774/admin/servers/46" rel="bookmark"/>
    </server>
    <server id="42" name="jakedevstack">
        <atom:link href="http://dev2.rcb.me:8774/v1.1/admin/servers/42" rel="self"/>
        <atom:link href="http://dev2.rcb.me:8774/admin/servers/42" rel="bookmark"/>
    </server>
    <server id="41" name="test">
        <atom:link href="http://dev2.rcb.me:8774/v1.1/admin/servers/41" rel="self"/>
        <atom:link href="http://dev2.rcb.me:8774/admin/servers/41" rel="bookmark"/>
    </server>
    <server id="40" name="somkinda">
        <atom:link href="http://dev2.rcb.me:8774/v1.1/admin/servers/40" rel="self"/>
        <atom:link href="http://dev2.rcb.me:8774/admin/servers/40" rel="bookmark"/>
    </server>
    <server id="39" name="x">
        <atom:link href="http://dev2.rcb.me:8774/v1.1/admin/servers/39" rel="self"/>
        <atom:link href="http://dev2.rcb.me:8774/admin/servers/39" rel="bookmark"/>
    </server>
</servers>
* Connection #0 to host dev2.rcb.me left intact
* Closing connection #0

Tags: osapi
Anne Gentle (annegentle)
description: updated
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
status: New → Confirmed
tags: added: osapi
Revision history for this message
Kevin L. Mitchell (klmitch) wrote :

For reference, I can confirm that this is still an issue. Here's the stack trace:

2011-11-21 23:54:41,344 ERROR nova.api.openstack.v2 [48dce693-00f1-4b78-9e86-4b05fec1af77 3 admin] Caught error: 'extensions'
(nova.api.openstack.v2): TRACE: Traceback (most recent call last):
(nova.api.openstack.v2): TRACE: File "/home/klmitch/devel/src/nova/nova/api/openstack/v2/__init__.py", line 61, in __call__
(nova.api.openstack.v2): TRACE: return req.get_response(self.application)
(nova.api.openstack.v2): TRACE: File "/usr/lib/pymodules/python2.6/webob/request.py", line 1053, in get_response
(nova.api.openstack.v2): TRACE: application, catch_exc_info=False)
(nova.api.openstack.v2): TRACE: File "/usr/lib/pymodules/python2.6/webob/request.py", line 1022, in call_application
(nova.api.openstack.v2): TRACE: app_iter = application(self.environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/local/lib/python2.6/dist-packages/keystone-2012.1-py2.6.egg/keystone/middleware/auth_token.py", line 267, in __call__
(nova.api.openstack.v2): TRACE: return self._forward_request(env, start_response, proxy_headers)
(nova.api.openstack.v2): TRACE: File "/usr/local/lib/python2.6/dist-packages/keystone-2012.1-py2.6.egg/keystone/middleware/auth_token.py", line 361, in _forward_request
(nova.api.openstack.v2): TRACE: return self.app(env, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
(nova.api.openstack.v2): TRACE: return resp(environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 159, in __call__
(nova.api.openstack.v2): TRACE: return resp(environ, start_response)
(nova.api.openstack.v2): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 147, in __call__
(nova.api.openstack.v2): TRACE: resp = self.call_func(req, *args, **self.kwargs)
(nova.api.openstack.v2): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 208, in call_func
(nova.api.openstack.v2): TRACE: return self.func(req, *args, **kwargs)
(nova.api.openstack.v2): TRACE: File "/home/klmitch/devel/src/nova/nova/api/openstack/wsgi.py", line 513, in __call__
(nova.api.openstack.v2): TRACE: **kwargs)
(nova.api.openstack.v2): TRACE: File "/home/klmitch/devel/src/nova/nova/api/openstack/wsgi.py", line 310, in serialize
(nova.api.openstack.v2): TRACE: return self.dispatch(data, action=action)
(nova.api.openstack.v2): TRACE: File "/home/klmitch/devel/src/nova/nova/api/openstack/wsgi.py", line 101, in dispatch
(nova.api.openstack.v2): TRACE: return action_method(*args, **kwargs)
(nova.api.openstack.v2): TRACE: File "/home/klmitch/devel/src/nova/nova/api/openstack/v2/extensions.py", line 506, in index
(nova.api.openstack.v2): TRACE: for ext_dict in exts_dict['extensions']:
(nova.api.openstack.v2): TRACE: KeyError: 'extensions'

Revision history for this message
Kevin L. Mitchell (klmitch) wrote :

This appears to be due to using the ExtensionsXMLSerializer for XML data returned by individual extensions, and was likely missed when I went through and templatized all the XML generation code. I'll see if I can fix this...

Changed in nova:
assignee: nobody → Kevin L. Mitchell (klmitch)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/1850
Committed: http://github.com/openstack/nova/commit/b74dee50e72fa8e22b8731db6468513473db9253
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit b74dee50e72fa8e22b8731db6468513473db9253
Author: Kevin L. Mitchell <email address hidden>
Date: Tue Nov 22 12:25:21 2011 -0600

    Use XMLDictSerializer for resource extensions.

    Patches around bug 852141 by using the XMLDictSerializer instead of
    the ExtensionsXMLSerializer for XML serialization of resource
    extensions. This will allow XML to be emitted, but does not correct
    the underlying problem: many existing resource extensions do not
    have defined XML serializers. (Additionally, existing serializers,
    including ExtensionsXMLSerializer, should be converted to
    templates.)

    Change-Id: If0fb0603920d04834368ed654f2a71d3e5300f7f

Changed in nova:
status: Confirmed → Fix Committed
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote :

Reviewed: https://review.openstack.org/1925
Committed: http://github.com/openstack/nova/commit/fde2bc5fdf585fc44d142b48d4ff5fca317bbc84
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit fde2bc5fdf585fc44d142b48d4ff5fca317bbc84
Author: Kevin L. Mitchell <email address hidden>
Date: Mon Nov 28 15:11:04 2011 -0600

    Templatize extension handling.

    Related to bug 852141: Converts extensions.py to using XML templates
    instead of the classic XML serializer.

    Change-Id: I41c9db8eb984f06222e7b42d5040afdf1e1101e8

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote :

Reviewed: https://review.openstack.org/2015
Committed: http://github.com/openstack/nova/commit/1598696554bd89ed1a51d7851bde48e03608a845
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit 1598696554bd89ed1a51d7851bde48e03608a845
Author: Kevin L. Mitchell <email address hidden>
Date: Fri Dec 2 11:27:29 2011 -0600

    Add templates for selected resource extensions.

    Related to bug 852141; adds XML serialization and deserialization for
    the following extensions:

    * FlavorExtraSpecs (os-flavor-extra-specs)
    * Floating_ips (os-floating-ips)
    * Hosts (os-hosts)
    * Keypairs (os-keypairs)
    * Quotas (os-quota-sets)

    Change-Id: I96ace8252f8f77612ab8c866e03eff8faee2c12b

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote :

Reviewed: https://review.openstack.org/2214
Committed: http://github.com/openstack/nova/commit/f7df18f22715e958510805db42df818ac0f0d243
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit f7df18f22715e958510805db42df818ac0f0d243
Author: Kevin L. Mitchell <email address hidden>
Date: Fri Dec 9 10:45:27 2011 -0600

    Add templates for selected resource extensions.

    Related to bug 852141; adds XML serialization and deserialization for
    the following extensions:

    * SecurityGroups (security_groups)
    * SimpleTenantUsage (os-simple-tenant-usage)
    * VirtualInterfaces (virtual_interfaces)
    * Volumes (os-volumes)
    * VolumeTypes (os-volume-types)

    Change-Id: Ia3aef79c1912d3df14ab72bbdda3768ae131a19e

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote :

Reviewed: https://review.openstack.org/2243
Committed: http://github.com/openstack/nova/commit/a33b4d616d8bb877f295383e8649df14c1e19b3c
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit a33b4d616d8bb877f295383e8649df14c1e19b3c
Author: Kevin L. Mitchell <email address hidden>
Date: Fri Dec 9 15:53:58 2011 -0600

    Add templates for selected resource extensions.

    Related to bug 852141; adds XML serialization and deserialization for
    the following extensions:

    * VSAs (zadr-vsa)

    Change-Id: Id9e9888758d02085a603fccfba1987a624da55c9

Revision history for this message
Kevin L. Mitchell (klmitch) wrote :

This bug should be fully fixed by now...

Thierry Carrez (ttx)
Changed in nova:
milestone: none → essex-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: essex-2 → 2012.1
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.