<div>Hi-</div><div><br></div><div>I'm trying to write an extension to the Openstack Nova API. </div><div><br></div><div>I have written the extension, for listing the servers based on the Metadata. </div><div><br></div>
<div>I have written a client, which sends the URL, </div><div>GET <a href="http://10.232.90.82:8774/v2/e216fcb54dc944a8ab16e4e325299643/servers/metadetail?instance_metadata.key=Server+Group&instance_metadata.value=DOM1">http://10.232.90.82:8774/v2/e216fcb54dc944a8ab16e4e325299643/servers/metadetail?instance_metadata.key=Server+Group&instance_metadata.value=DOM1</a></div>
<div><br></div><div>Also, after writing the extension in nova api, I get the following debug logs which confirm that, the extension is flawless.</div><div><br></div><div>INFO nova.api.openstack.wsgi [-]  Trinath LOG [ControllerMetaClass :: __new__] CLS_dict  =>  {'__module__': 'nova.api.openstack.compute.contrib.server_groupby_metadata', 'wsgi_extensions': [('metadetail', None)], 'metadetail': <function metadetail at 0x3828f50>, '__init__': <function __init__ at 0x3828ed8>, 'wsgi_actions': {}}</div>
<div> 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) _setup_ext_routes /usr/lib/python2.7/dist-packages/nova/api/openstack/__init__.py:118</div>
<div>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 /usr/lib/python2.7/dist-packages/nova/api/openstack/__init__.py:74</div>
<div><br></div><div><br></div><div>When I run the client program, I see the following info in the logs,</div><div><br></div><div>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/1.0', 'QUERY_STRING': 'instance_metadata.key=Server+Group&instance_metadata.value=DOM1', 'HTTP_X_USER_ID': u'9e4a57c9e6a944de9404b963f260b464', 'HTTP_X_AUTH_TOKEN': '9c9e3f0b06854befa3fa60914b6ab302', 'HTTP_USER_AGENT': 'python-novaclient', 'eventlet.posthooks': [], 'SERVER_NAME': '10.232.90.82', 'REMOTE_ADDR': '10.232.90.82', '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': '<a href="http://10.232.90.82:8774">10.232.90.82:8774</a>', '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) get_action_args /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:681</div>
<div><br></div><div>Here, The URI, /server/metadetail? is not being mapped to the method "metadetail()" method present in the   extension.</div><div><br></div><div>Also, its that, the WSGI is mapping, the URI to "show" method rather than the "metadetail" method.</div>
<div> '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'})</div>
<div><br></div><div>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 extension.</div><div><br></div><div>Kindly, please help me in this regard.</div>
<div><br></div><div>Thanks in advance,</div><div><br></div><div><br></div>-- <br>Regards,<br>----------------------------------------------<br>Trinath Somanchi,<div>+91 9866 235 130</div><br>