Re: [openstack-dev] [nova][api] why need PUT /servers/{server_id}/metadata/{key} ?
yes, I didn't go to that detail and missed the delete flag , that's exactly what I am looking for, which is a little bit confusing... Thanks for the info for know this... Best Regards! Kevin (Chen) Ji 纪 晨 Engineer, zVM Development, CSTL Notes: Chen CH Ji/China/IBM@IBMCN Internet: jiche...@cn.ibm.com Phone: +86-10-82451493 Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, Beijing 100193, PRC From: Matt Riedemann <mriede...@gmail.com> To: openstack-dev@lists.openstack.org Date: 09/20/2017 09:15 PM Subject: Re: [openstack-dev] [nova][api] why need PUT /servers/{server_id}/metadata/{key} ? On 9/20/2017 12:48 AM, Chen CH Ji wrote: > in analyzing other code, found seems we don't need PUT > /servers/{server_id}/metadata/{key} ? > > 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) > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openstack_nova_blob_master_nova_api_openstack_compute_server-5Fmetadata.py-23L80=DwIGaQ=jf_iaSHvJObTbx-siA1ZOg=8sI5aZT88Uetyy_XsOddbPjIiLSGM-sFnua3lLy2Xr0=DSFbFb2bqll3hC8yrttkW6teiZtFod4XBQIC8jauVlE=1S1y1O0K2KOZgQd1wmx5_P8IhzNqf-i6d4IThx0yLrI= > > looks like it's identical to > PUT /servers/{server_id}/metadata > > why we need this API or it should be something like > > PUT /servers/{server_id}/metadata/{key}but we only accept a value to > modify the meta given by {key} in the API side? > > Best Regards! > > Kevin (Chen) Ji 纪 晨 > > Engineer, zVM Development, CSTL > Notes: Chen CH Ji/China/IBM@IBMCN Internet: jiche...@cn.ibm.com > Phone: +86-10-82451493 > Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian > District, Beijing 100193, PRC > > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openstack.org_cgi-2Dbin_mailman_listinfo_openstack-2Ddev=DwIGaQ=jf_iaSHvJObTbx-siA1ZOg=8sI5aZT88Uetyy_XsOddbPjIiLSGM-sFnua3lLy2Xr0=DSFbFb2bqll3hC8yrttkW6teiZtFod4XBQIC8jauVlE=EMTJozBhxl7wXNyB7emtzxXMkegVXKWV6Ko8E2uhsPs= > 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: https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openstack_nova_blob_5bf1bb47c7e17c26592a699d07c2faa59d98bfb8_nova_compute_api.py-23L3830=DwIGaQ=jf_iaSHvJObTbx-siA1ZOg=8sI5aZT88Uetyy_XsOddbPjIiLSGM-sFnua3lLy2Xr0=DSFbFb2bqll3hC8yrttkW6teiZtFod4XBQIC8jauVlE=AMY4S8Ux0G78V_Nu2H17kNivICkiKErqDzPj0eFsUgg= 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. Does that answer your question? 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. -- Thanks, Matt __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openstack.org_cgi-2Dbin_mailman_listinfo_openstack-2Ddev=DwIGaQ=jf_iaSHvJObTbx-siA1ZOg=8sI5aZT88Uetyy_XsOddbPjIiLSGM-sFnua3lLy2Xr0=DSFbFb2bqll3hC8yrttkW6teiZtFod4XBQIC8jauVlE=EMTJozBhxl7wXNyB7emtzxXMkegVXKWV6Ko8E2uhsPs= __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [nova][api] why need PUT /servers/{server_id}/metadata/{key} ?
On 9/20/2017 8:33 AM, Alex Xu wrote: is there any use-case that people update server's metadata such frequently? If you have automation tooling updating the metadata for whatever reason it could be a problem. This was the reported bug FWIW: https://bugs.launchpad.net/nova/+bug/1650188 -- Thanks, Matt __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [nova][api] why need PUT /servers/{server_id}/metadata/{key} ?
On Wed, Sep 20, 2017 at 10:14 PM, Matt Riedemannwrote: > On 9/20/2017 12:48 AM, Chen CH Ji wrote: >> >> in analyzing other code, found seems we don't need PUT >> /servers/{server_id}/metadata/{key} ? >> >> 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) >> >> https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/server_metadata.py#L80 >> >> looks like it's identical to >> PUT /servers/{server_id}/metadata >> >> why we need this API or it should be something like >> >> PUT /servers/{server_id}/metadata/{key}but we only accept a value to >> modify the meta given by {key} in the API side? >> >> Best Regards! >> >> Kevin (Chen) Ji 纪 晨 >> >> Engineer, zVM Development, CSTL >> Notes: Chen CH Ji/China/IBM@IBMCN Internet: jiche...@cn.ibm.com >> Phone: +86-10-82451493 >> Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, >> Beijing 100193, PRC >> >> >> __ >> OpenStack Development Mailing List (not for usage questions) >> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe >> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev >> > > 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: > > https://github.com/openstack/nova/blob/5bf1bb47c7e17c26592a699d07c2faa59d98bfb8/nova/compute/api.py#L3830 > > 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. > > Does that answer your question? > > 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. > I think confusion is for updating the single metadata item by key [1]. and whether it has bug to allow update more than 1 item. But It does not as schema restrict request body to allow only 1 item in body. Which means update metadata item by key only allow to update that key value only. Also we do have tests to verify that: https://github.com/openstack/nova/blob/5bf1bb47c7e17c26592a699d07c2faa59d98bfb8/nova/tests/unit/api/openstack/compute/test_server_metadata.py#L529 ..1 https://developer.openstack.org/api-ref/compute/#create-or-update-metadata-item > -- > > Thanks, > > Matt > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [nova][api] why need PUT /servers/{server_id}/metadata/{key} ?
2017-09-20 21:14 GMT+08:00 Matt Riedemann: > On 9/20/2017 12:48 AM, Chen CH Ji wrote: > >> in analyzing other code, found seems we don't need PUT >> /servers/{server_id}/metadata/{key} ? >> >> 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) >> https://github.com/openstack/nova/blob/master/nova/api/opens >> tack/compute/server_metadata.py#L80 >> >> looks like it's identical to >> PUT /servers/{server_id}/metadata >> >> why we need this API or it should be something like >> >> PUT /servers/{server_id}/metadata/{key}but we only accept a value to >> modify the meta given by {key} in the API side? >> >> Best Regards! >> >> Kevin (Chen) Ji 纪 晨 >> >> Engineer, zVM Development, CSTL >> Notes: Chen CH Ji/China/IBM@IBMCN Internet: jiche...@cn.ibm.com >> Phone: +86-10-82451493 >> Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, >> Beijing 100193, PRC >> >> >> >> __ >> OpenStack Development Mailing List (not for usage questions) >> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscrib >> e >> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev >> >> > 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: > > https://github.com/openstack/nova/blob/5bf1bb47c7e17c26592a6 > 99d07c2faa59d98bfb8/nova/compute/api.py#L3830 > > 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. > > Does that answer your question? > > 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. is there any use-case that people update server's metadata such frequently? > > -- > > Thanks, > > Matt > > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [nova][api] why need PUT /servers/{server_id}/metadata/{key} ?
On 9/20/2017 12:48 AM, Chen CH Ji wrote: in analyzing other code, found seems we don't need PUT /servers/{server_id}/metadata/{key} ? 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) https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/server_metadata.py#L80 looks like it's identical to PUT /servers/{server_id}/metadata why we need this API or it should be something like PUT /servers/{server_id}/metadata/{key}but we only accept a value to modify the meta given by {key} in the API side? Best Regards! Kevin (Chen) Ji 纪 晨 Engineer, zVM Development, CSTL Notes: Chen CH Ji/China/IBM@IBMCN Internet: jiche...@cn.ibm.com Phone: +86-10-82451493 Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, Beijing 100193, PRC __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev 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: https://github.com/openstack/nova/blob/5bf1bb47c7e17c26592a699d07c2faa59d98bfb8/nova/compute/api.py#L3830 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. Does that answer your question? 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. -- Thanks, Matt __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [nova][api] why need PUT /servers/{server_id}/metadata/{key} ?
On Wed, Sep 20, 2017 at 2:48 PM, Chen CH Jiwrote: > in analyzing other code, found seems we don't need PUT > /servers/{server_id}/metadata/{key} ? > > 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) > https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/server_metadata.py#L80 Schema restrict to 1 item in body - https://github.com/openstack/nova/blob/5bf1bb47c7e17c26592a699d07c2faa59d98bfb8/nova/api/openstack/compute/schemas/server_metadata.py#L32 User will not be able to pass more than 1 meta item in this API. Does not it work that way or you are able to pass more than 1 key in body ? > > looks like it's identical to > PUT /servers/{server_id}/metadata > > why we need this API or it should be something like > > PUT /servers/{server_id}/metadata/{key} but we only accept a value to modify > the meta given by {key} in the API side? > > Best Regards! > > Kevin (Chen) Ji 纪 晨 > > Engineer, zVM Development, CSTL > Notes: Chen CH Ji/China/IBM@IBMCN Internet: jiche...@cn.ibm.com > Phone: +86-10-82451493 > Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, > Beijing 100193, PRC > > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > -gmann __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
[openstack-dev] [nova][api] why need PUT /servers/{server_id}/metadata/{key} ?
in analyzing other code, found seems we don't need PUT /servers/{server_id}/metadata/{key} ? 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) https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/server_metadata.py#L80 looks like it's identical to PUT /servers/{server_id}/metadata why we need this API or it should be something like PUT /servers/{server_id}/metadata/{key} but we only accept a value to modify the meta given by {key} in the API side? Best Regards! Kevin (Chen) Ji 纪 晨 Engineer, zVM Development, CSTL Notes: Chen CH Ji/China/IBM@IBMCN Internet: jiche...@cn.ibm.com Phone: +86-10-82451493 Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, Beijing 100193, PRC __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev