<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-07-12 9:18 GMT+08:00 Matt Riedemann <span dir="ltr"><<a href="mailto:mriedemos@gmail.com" target="_blank">mriedemos@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm looking for some broader input on something being discussed in this change:<br>
<br>
<a href="https://review.openstack.org/#/c/464280/21/nova/api/openstack/compute/services.py" rel="noreferrer" target="_blank">https://review.openstack.org/#<wbr>/c/464280/21/nova/api/openstac<wbr>k/compute/services.py</a><br>
<br>
This is collapsing the following APIs into a single API:<br>
<br>
Old:<br>
<br>
* PUT /os-services/enable<br>
* PUT /os-services/disable<br>
* PUT /os-services/disable-log-reaso<wbr>n<br>
* PUT /os-services/force-down<br>
<br>
New:<br>
<br>
* PUT /os-services<br>
<br>
With the old APIs, if you tried to enable and already enabled service, it was not an error. The same is you tried to disable an already disabled service. It doesn't change anything, but it's not an error.<br>
<br>
The question is coming up in the new API if trying to enable an enabled service should be a 400, or trying to disable a disabled service. The way I wrote the new API, those are no 400 conditions. They don't do anything, like before, but they aren't errors.<br></blockquote><div><br></div><div>Sorry, I didn't describe clearly in the comment.</div><div><br></div><div>Some of those comments about save a DB call with more conditions checks. It means if enable a enabled service, we needn't a db call, we can just return to the user 200 directly.</div><div><br></div><div>One of those comments is about when the API user specified 'status=enabled' and 'disabled_reason' in the request body, then we just ignore the 'disabled_reason' and didn't save it into the db also. That sounds not right. We should return 400 to the API user, you can't specified the 'status=enabled' and 'disabled_reason'.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Looking at [1] it seems this should not be an error condition if you're trying to update the state of a resource and it's already at that state.<br>
<br>
I don't have a PhD in REST though so would like broader discussion on this.<br>
<br>
[1] <a href="http://www.restapitutorial.com/lessons/idempotency.html" rel="noreferrer" target="_blank">http://www.restapitutorial.com<wbr>/lessons/idempotency.html</a><span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
<br>
Thanks,<br>
<br>
Matt<br>
<br>
______________________________<wbr>______________________________<wbr>______________<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.op<wbr>enstack.org?subject:unsubscrib<wbr>e</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi<wbr>-bin/mailman/listinfo/openstac<wbr>k-dev</a><br>
</font></span></blockquote></div><br></div></div>