<p>Hi-</p>
<p>Can any one help me out on this please.....<br></p>
<p>Thanking u all</p>
<p>--<br>
Trinath</p>
<div class="gmail_quote">On Sep 17, 2012 1:42 PM, "Trinath Somanchi" <<a href="mailto:trinath.somanchi@gmail.com">trinath.somanchi@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Stackers-<div><br></div><div>I'm working on currently adding an additional method to the NOVA API.</div><div><br></div><div>The new method groups the servers based on the metadata. It returns a group of server UUIDs based on the Metadata information in the URL from client.</div>

<div><br></div><div>For the same I have modified the following files.</div><div><br></div><div>[1] update the nova.api.openstack.compute.__init__.py with the following mapper.resource.</div><div><br></div><div>      mapper.resource("server","servers",</div>

<div>                        controller = self.resources['servers'],</div><div>                        collection={'metadetail':'GET'},</div><div>                        member={'action':'POST'})</div>

<div><br></div><div>[2] Update the <a href="http://nova.api.openstack.compute.servers.py" target="_blank">nova.api.openstack.compute.servers.py</a> with the following function</div><div><br></div><div>     @wsgi.serializers(xml=ServerTemplate)<div>

     def metadetail(self,req):</div><div>        """ Return the servers UUIDs based on the META data infortmation """</div><div>        return;</div><div><br></div><div>Being a newbee to understand the code well, I have updated the novaclient api, to redirect the request to /server/metadetail/{metadata_details}</div>

<div><br></div><div>But the approach was unsuccessful. </div><div><br></div><div><div>2012-09-17 13:27:11 INFO nova.api.openstack.wsgi [req-e9c7c50e-6f71-4757-bb69-7971ab81a8a7 9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643] GET <a href="http://10.232.90.82:8774/v2/e216fcb54dc944a8ab16e4e325299643/servers/metadetail?instance_metadata.key=Server+Group&instance_metadata.value=DOM1" target="_blank">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><br></div><div>Trinath> My request went, good</div><div><br></div><div><br></div><div>2012-09-17 13:27:11 DEBUG nova.api.openstack.wsgi [req-e9c7c50e-6f71-4757-bb69-7971ab81a8a7 9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643]  WSGI :: get_action_args :: {'action': u'show', 'project_id': u'e216fcb54dc944a8ab16e4e325299643', 'id': u'metadetail'} from (pid=24295) get_action_args /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:700</div>

<div><br></div><div>Trinath>> Why is that the actions in "show" here with a ID "metadetail".? Where did I go wrong.</div><div><br></div><div>2012-09-17 13:27:11 DEBUG nova.api.openstack.wsgi [req-e9c7c50e-6f71-4757-bb69-7971ab81a8a7 9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643] Unrecognized Content-Type provided in request from (pid=24295) get_body /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:708</div>

<div>2012-09-17 13:27:11 INFO nova.api.openstack.wsgi [req-e9c7c50e-6f71-4757-bb69-7971ab81a8a7 9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643]  Trinath LOG ****** [_process_stack] contents =>  {}</div>

<div>2012-09-17 13:27:11 INFO nova.api.openstack.wsgi [req-e9c7c50e-6f71-4757-bb69-7971ab81a8a7 9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643]  Trinath LOG ****** [_process_stack] action_args => {'project_id': u'e216fcb54dc944a8ab16e4e325299643', 'id': u'metadetail'}</div>

<div>2012-09-17 13:27:11 INFO nova.api.openstack.wsgi [req-e9c7c50e-6f71-4757-bb69-7971ab81a8a7 9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643]  Trinath LOG ****** [pre_process_extension] extensions => [<bound method ServerDiskConfigController.show of <nova.api.openstack.compute.contrib.disk_config.ServerDiskConfigController object at 0x3836890>>, <bound method ExtendedStatusController.show of <nova.api.openstack.compute.contrib.extended_status.ExtendedStatusController object at 0x39d3f10>>, <bound method ExtendedServerAttributesController.show of <nova.api.openstack.compute.contrib.extended_server_attributes.ExtendedServerAttributesController object at 0x3d0bf50>>]</div>

<div>2012-09-17 13:27:11 INFO nova.api.openstack.wsgi [req-e9c7c50e-6f71-4757-bb69-7971ab81a8a7 9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643] HTTP exception thrown: The resource could not be found.</div>

<div>2012-09-17 13:27:11 INFO nova.api.openstack.wsgi [req-e9c7c50e-6f71-4757-bb69-7971ab81a8a7 9e4a57c9e6a944de9404b963f260b464 e216fcb54dc944a8ab16e4e325299643] <a href="http://10.232.90.82:8774/v2/e216fcb54dc944a8ab16e4e325299643/servers/metadetail?instance_metadata.key=Server+Group&instance_metadata.value=DOM1" target="_blank">http://10.232.90.82:8774/v2/e216fcb54dc944a8ab16e4e325299643/servers/metadetail?instance_metadata.key=Server+Group&instance_metadata.value=DOM1</a> returned with HTTP 404</div>

</div><div><br></div><div><br></div><div>Can any one help me on Where did I go wrong? </div><div><br></div><div>How to integrate new methods into the API (I know via Extensions we can make it but Now testing this kind of approach)?</div>

<div><br></div><div>Please help me find a solution / path way to integrate new methods into the API.</div><div><br></div><div>Thanks in advance.</div><div><br></div>-- <br>Regards,<br>----------------------------------------------<br>

Trinath Somanchi,<div><a href="tel:%2B91%209866%20235%20130" value="+919866235130" target="_blank">+91 9866 235 130</a></div><br>
</div>
</blockquote></div>