[openstack-dev] Troubleshooting the nova api extension

Trinath Somanchi trinath.somanchi at gmail.com
Mon Sep 24 09:39:53 UTC 2012


I'm trying to write an extension to the Openstack Nova API.

I have written the extension, for listing the servers based on the

I have written a client, which sends the URL,

Also, after writing the extension in nova api, I get the following debug
logs which confirm that, the extension is flawless.

INFO nova.api.openstack.wsgi [-]  Trinath LOG [ControllerMetaClass ::
__new__] CLS_dict  =>  {'__module__':
'wsgi_extensions': [('metadetail', None)], 'metadetail': <function
metadetail at 0x3828f50>, '__init__': <function __init__ at 0x3828ed8>,
'wsgi_actions': {}}
 DEBUG nova.api.openstack [-]   _setup_ext_routes() ==> {'member':
{'metadetail': 'GET'}, 'controller': <nova.api.openstack.wsgi.Resource
object at 0x4a33d90>, 'collection': {'metadetail': 'GET'}} from (pid=29146)
2012-09-24 12:34:22 DEBUG nova.api.openstack [-]ProjectMapper :: resource
:: Member Name = OS-SRVR-GRPBY-METADATA, Collection Name =
OS-SRVR-GRPBY-METADATA, kwargs = {'member': {'metadetail': 'GET'},
'controller': <nova.api.openstack.wsgi.Resource object at 0x4a33d90>,
'collection': {'metadetail': 'GET'}, 'path_prefix': '{project_id}/'} from
(pid=29146) resource

When I run the client program, I see the following info in the logs,

DEBUG nova.api.openstack.wsgi [req-320da182-509c-4a42-811a-16fdb42c9d2d
9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643] WSGI ::
request_environment :: {'HTTP_X_TENANT_NAME': u'admin', 'routes.route':
<routes.route.Route object at 0x4644e50>, 'HTTP_X_ROLE': u'admin',
'SCRIPT_NAME': '/v2', 'webob.adhoc_attrs': {'response': <Response at
0x51e8d50 200 OK>}, 'REQUEST_METHOD': 'GET', 'PATH_INFO':
'/e216fcb54dc944a8ab16e4e325299643/servers/metadetail', 'SERVER_PROTOCOL':
'HTTP_X_USER_ID': u'9e4a57c9e6a944de9404b963f260b464', 'HTTP_X_AUTH_TOKEN':
'9c9e3f0b06854befa3fa60914b6ab302', 'HTTP_USER_AGENT': 'python-novaclient',
'eventlet.posthooks': [], 'SERVER_NAME': '', 'REMOTE_ADDR':
'', 'eventlet.input': <eventlet.wsgi.Input object at
0x5325510>, 'HTTP_X_IDENTITY_STATUS': 'Confirmed', 'wsgi.url_scheme':
'http', 'wsgiorg.routing_args': (<routes.util.URLGenerator object at
0x36f64d0>, {'action': u'show', 'controller':
<nova.api.openstack.wsgi.Resource object at 0x4644750>, 'project_id':
u'e216fcb54dc944a8ab16e4e325299643', 'id': u'metadetail'}), 'SERVER_PORT':
'8774', 'HTTP_X_ROLES': u'admin', 'HTTP_X_TENANT_ID':
u'e216fcb54dc944a8ab16e4e325299643', 'HTTP_X_USER': u'admin',
'nova.context': <nova.context.RequestContext object at 0x5325650>,
'wsgi.input': <eventlet.wsgi.Input object at 0x5325510>, 'HTTP_HOST': '', 'HTTP_X_AUTH_PROJECT_ID': 'admin', 'wsgi.multithread':
True, 'routes.url': <routes.util.URLGenerator object at 0x36f64d0>,
'HTTP_ACCEPT': 'application/json', 'wsgi.version': (1, 0), 'HTTP_X_TENANT':
u'admin', 'GATEWAY_INTERFACE': 'CGI/1.1', 'wsgi.run_once': False,
'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f6f11540270>,
'wsgi.multiprocess': False, 'HTTP_X_USER_NAME': u'admin', 'CONTENT_TYPE':
'text/plain', 'nova.limits': [{'regex': '.*', 'resetTime': 1348470337,
'URI': '*', 'value': 10, 'verb': 'POST', 'remaining': 10, 'unit':
'MINUTE'}, {'regex': '^/servers', 'resetTime': 1348470337, 'URI':
'*/servers', 'value': 50, 'verb': 'POST', 'remaining': 50, 'unit': 'DAY'},
{'regex': '.*', 'resetTime': 1348470337, 'URI': '*', 'value': 10, 'verb':
'PUT', 'remaining': 10, 'unit': 'MINUTE'}, {'regex': '.*changes-since.*',
'resetTime': 1348470337, 'URI': '*changes-since*', 'value': 3, 'verb':
'GET', 'remaining': 3, 'unit': 'MINUTE'}, {'regex': '.*', 'resetTime':
1348470337, 'URI': '*', 'value': 100, 'verb': 'DELETE', 'remaining': 100,
'unit': 'MINUTE'}], 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
'nova.best_content_type': 'application/json'} from (pid=29146)

Here, The URI, /server/metadetail? is not being mapped to the method
"metadetail()" method present in the   extension.

Also, its that, the WSGI is mapping, the URI to "show" method rather than
the "metadetail" method.
 'wsgiorg.routing_args': (<routes.util.URLGenerator object at 0x36f64d0>,
{'action': u'show', 'controller': <nova.api.openstack.wsgi.Resource object
at 0x4644750>, 'project_id': u'e216fcb54dc944a8ab16e4e325299643', 'id':

Please guide me on how to fix the issue such that the URL with
"/server/metadetail" is mapped to the "metadetail" method in the new

Kindly, please help me in this regard.

Thanks in advance,

Trinath Somanchi,
+91 9866 235 130
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20120924/9a70e081/attachment.html>

More information about the OpenStack-dev mailing list