<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-09-20 21:14 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On 9/20/2017 12:48 AM, Chen CH Ji wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-h5">
in analyzing other code, found seems we don't need PUT /servers/{server_id}/metadata/<wbr>{key} ?<br>
<br>
as the id is only used for check whether it's in the body and we will honor the whole body (body['meta'] in the code)<br>
<a href="https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/server_metadata.py#L80" rel="noreferrer" target="_blank">https://github.com/openstack/n<wbr>ova/blob/master/nova/api/opens<wbr>tack/compute/server_metadata.<wbr>py#L80</a><br>
<br>
looks like it's identical to<br>
PUT /servers/{server_id}/metadata<br>
<br>
why we need this API or it should be something like<br>
<br>
PUT /servers/{server_id}/metadata/<wbr>{key}but we only accept a value to modify the meta given by {key} in the API side?<br>
<br>
Best Regards!<br>
<br>
Kevin (Chen) Ji 纪 晨<br>
<br>
Engineer, zVM Development, CSTL<br>
Notes: Chen CH Ji/China/IBM@IBMCN Internet: <a href="mailto:jichenjc@cn.ibm.com" target="_blank">jichenjc@cn.ibm.com</a><br>
Phone: <a href="tel:%2B86-10-82451493" value="+861082451493" target="_blank">+86-10-82451493</a><br>
Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, Beijing 100193, PRC<br>
<br>
<br></div></div><span class="gmail-">
______________________________<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>
<br>
</span></blockquote>
<br>
This API is a bit confusing, and the code is too since it all goes down to some common code, and I think you're missing the 'delete' flag:<br>
<br>
<a href="https://github.com/openstack/nova/blob/5bf1bb47c7e17c26592a699d07c2faa59d98bfb8/nova/compute/api.py#L3830" rel="noreferrer" target="_blank">https://github.com/openstack/n<wbr>ova/blob/5bf1bb47c7e17c26592a6<wbr>99d07c2faa59d98bfb8/nova/<wbr>compute/api.py#L3830</a><br>
<br>
If delete=False, as it is in this case, we only add/update the existing metadata with the new metadata from the request body. If delete=True, then we overwrite the instance metadata with whatever is in the request.<br>
<br>
Does that answer your question?<br>
<br>
This API is problematic and we have bugs against it since it's not atomic, i.e. two concurrent requests will overwrite one of them. We should really have a generation ID or etag on this data to be sure it's atomically updated.</blockquote><div><br></div><div> is there any use-case that people update server's metadata such frequently?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
-- <br>
<br>
Thanks,<br>
<br>
Matt</font></span><div class="gmail-HOEnZb"><div class="gmail-h5"><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>
</div></div></blockquote></div><br></div></div>