<p dir="ltr">I think option 2 is the better one, and we can just call it something else other than capabilities. Available_services or similar</p>
<div class="gmail_quote">On 16 Oct 2015 11:05, "Ramakrishna, Deepti" <<a href="mailto:deepti.ramakrishna@intel.com">deepti.ramakrishna@intel.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">We need a way to let Horizon know about the presence of cinder-backup service so that it can enable the volume backup operations in the UI (</span><a href="https://bugs.launchpad.net/cinder/+bug/1334856" target="_blank"><span style="color:#1155cc;background:white">https://bugs.launchpad.net/cinder/+bug/1334856</span></a><span style="color:#222222">).<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">The backup action does not have any restrictions on who can perform it as evidenced by the following policy in<span> </span><a href="https://github.com/openstack/cinder/blob/master/etc/cinder/policy.json" target="_blank"><span style="color:#1155cc">etc/cinder/policy.json</span></a>:<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#183691">"backup:create"</span><span style="color:#333333"> :
</span><span style="color:#183691">""</span><span style="color:#222222"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">However, the only API that can tell Horizon about the existence of this service, namely the "</span><span style="color:#222222">os-services"</span><span><span style="color:#222222"> </span></span><span style="color:#222222">API
extension (that corresponds to the "</span><span style="color:#222222">cinder service-list"</span><span><span style="color:#222222"> </span></span><span style="color:#222222">client command) is admin-only:<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#183691">"volume_extension:services:index"</span><span style="color:#333333">:
</span><span style="color:#183691">"rule:admin_api"</span><span style="color:#222222"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">Today, Horizon<span> </span><a href="http://docs.openstack.org/developer/horizon/topics/settings.html" target="_blank"><span style="color:#1155cc">uses</span></a><span> </span>a
config setting<span> </span></span><span style="color:#222222">"enable_backup"</span><span style="color:#222222">, that needs to be manually set in order to enable backup functionality in Horizon. We need a way for Horizon to
figure this out itself, programmatically.<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">I can think of two ways:<u></u><u></u></span></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoNormal" style="color:#222222">Modify the services:index action to take a details=true/false parameter (http://{cinder-endpoint}/v2/{tenant-id}/os-services<b>?details=false</b>). And define different policies for detail=true(admin_api)
and detail=false ("" i.e. unrestricted).<u></u><u></u></li></ol>
<ol style="margin-top:0in" start="1" type="1">
<ul style="margin-top:0in" type="disc">
<li class="MsoNormal" style="color:#222222"><span style="color:#183691">"volume_extension:services:index_with_details"</span><span style="color:#333333">:
</span><span style="color:#183691">"rule:admin_api"</span><u></u><u></u></li><li class="MsoNormal" style="color:#222222"><span style="color:#183691">"volume_extension:services:index_without_details"</span><span style="color:#333333">:
</span><span style="color:#183691">"”</span><u></u><u></u></li></ul>
<li class="MsoNormal" style="color:#222222">Raise the abstraction level by creating a Cinder API extension that returns the list of "service capabilities". That is, the list of functionality that the cinder service supports. This will
return only "volume backup" for now but can be augmented as new capabilities are added to Cinder.<u></u><u></u></li></ol>
<p class="MsoNormal" style="margin-left:.5in"><span style="color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">I don't know if #1 can be implemented in a backward compatible way and also whether there is precedence for splitting the policy of a single API call based on parameters.<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">#2 seems the traditional way to do it, but I am afraid that "service capabilities" terminology clashes with existing "volume capabilities"<span> </span><a href="https://github.com/openstack/cinder/blob/master/cinder/api/contrib/capabilities.py" target="_blank"><span style="color:#1155cc">extension</span></a>,
which has a different purpose.<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">I would appreciate any input on this.<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222"><u></u> <u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="color:#222222">Deepti<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div>