<div dir="ltr"><div><div><div><div><div>Hi Drew,<br><br></div>Unfortunately there's not much up to date documentation on how to write an api extension (its on the TODO list), but as Phil mentioned looking at existing extensions like scheduler_hints is a good place to start.<br>
<br></div>You'll need to decide whether you want to write a V2 and V3 API version of your extension or only V3. V3 is currently marked experimental but should (hopefully!) become the default API with the release of Icehouse. So if you submit a V2 extension you will have to also submit a V3 version.<br>
<br></div>As Phil mentioned, for V2 you'll need to add both a new extension file, plus modify nova/api/openstack/compute/servers.py to look for an pass the new parameter to compute_api.create. For V2 all parameters have to be explicitly handled in servers.py<br>
<br></div>For V3 (see nova/api/openstack/compute/plugins/v3/) you will only need to add a new extension with no modifications to servers.py. access_ips.py is probably a good example for V3 to see how parameters can be passed to compute_api.create by an extension. In access_ips, see the create function in AccessIPsController and server_create in AccessIPs. Note that you will need to add some entries in setup.cfg for the V3 plugin to be detected.<br>
<br></div><div>Depending on how your extension works you may also need to add entries to nova/etc/policy.json as well.<br><br></div><div>Regards,<br><br>Chris<br></div><div><br><br></div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Sat, Oct 26, 2013 at 7:04 AM, Day, Phil <span dir="ltr"><<a href="mailto:philip.day@hp.com" target="_blank">philip.day@hp.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Drew,<br>
<br>
Generally you need to create a new api extention and make some changes in the main servers.py<br>
<br>
The scheduler-hints API extension does this kind of thing, so if you look at:  api/openstack/compute/contrib/scheduler_hints.py for how the extension is defined, and look  in api/poenstack/compute/servers.py code for "scheduler_hints"   (e.g. _extract_scheduler_hints()  ) then that should point you in the right direction.<br>

<br>
Hope that helps,<br>
Phil<br>
<div class="HOEnZb"><div class="h5"><br>
> -----Original Message-----<br>
> From: Drew Fisher [mailto:<a href="mailto:drew.fisher@oracle.com">drew.fisher@oracle.com</a>]<br>
> Sent: 25 October 2013 16:34<br>
> To: <a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a><br>
> Subject: [openstack-dev] extending nova boot<br>
><br>
> Good morning!<br>
><br>
> I am looking at extending nova boot with a few new flags.  I've found enough<br>
> examples online that I have a working extension to novaclient (I can see the<br>
> new flags in `nova help boot` and if I run with the --debug flag I can see the<br>
> curl requests to the API have the data.<br>
><br>
> What I can't seem to figure out is how nova-api processes these extra<br>
> arguments.  With stable/grizzly bits, in<br>
> nova/api/openstack/compute/servers.py, I can see where that data is<br>
> processed (in Controller.create()) but it doesn't appear to me that any<br>
> leftover flags are handled.<br>
><br>
> What do I need to do to get these new flags to nova boot from novaclient<br>
> into nova-api and ultimately my compute driver?<br>
><br>
> Thanks for any help!<br>
><br>
> -Drew Fisher<br>
><br>
> _______________________________________________<br>
> OpenStack-dev mailing list<br>
> <a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br>
_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br></div>