)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"60f11893ec76e21df6db247bf0e6f022a53ae8d9","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"[2] Neutron server side Floating IP port forwarding"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch fixes some issues in race condiction, such port forwarding"},{"line_number":10,"context_line":"resource conflict with floatingip resource and port forwarding resource"},{"line_number":11,"context_line":"conflict with port resource."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"5f7c97a3_3e59728d","line":9,"range":{"start_line":9,"start_character":17,"end_line":9,"end_character":46},"updated":"2018-06-19 17:23:05.000000000","message":"\u0027race conditions\u0027 or just `some issues`","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"60f11893ec76e21df6db247bf0e6f022a53ae8d9","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"[2] Neutron server side Floating IP port forwarding"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch fixes some issues in race condiction, such port forwarding"},{"line_number":10,"context_line":"resource conflict with floatingip resource and port forwarding resource"},{"line_number":11,"context_line":"conflict with port resource."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"5f7c97a3_be4ca2c8","line":9,"range":{"start_line":9,"start_character":49,"end_line":9,"end_character":53},"updated":"2018-06-19 17:23:05.000000000","message":"such as","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6c5f505e43c64fa3256c102e2de9747b2eb80697","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"[2] Neutron server side Floating IP port forwarding"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch fixes some issues in race condiction, such port forwarding"},{"line_number":10,"context_line":"resource conflict with floatingip resource and port forwarding resource"},{"line_number":11,"context_line":"conflict with port resource."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"5f7c97a3_1039fef0","line":9,"range":{"start_line":9,"start_character":17,"end_line":9,"end_character":46},"in_reply_to":"5f7c97a3_3e59728d","updated":"2018-06-20 00:25:22.000000000","message":"Oh, thanks, I want to say fix race conditions.. I will reword this here.","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6c5f505e43c64fa3256c102e2de9747b2eb80697","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"[2] Neutron server side Floating IP port forwarding"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This patch fixes some issues in race condiction, such port forwarding"},{"line_number":10,"context_line":"resource conflict with floatingip resource and port forwarding resource"},{"line_number":11,"context_line":"conflict with port resource."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"5f7c97a3_f0580258","line":9,"range":{"start_line":9,"start_character":49,"end_line":9,"end_character":53},"in_reply_to":"5f7c97a3_be4ca2c8","updated":"2018-06-20 00:25:22.000000000","message":"Done","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5f2be73dd68c34d5dfc4736be29cdfb176e3131c","unresolved":false,"context_lines":[{"line_number":13,"context_line":"As the port forwarding resource associated with 2 resources,"},{"line_number":14,"context_line":"one is floatingip, the other is neutron internal port resource."},{"line_number":15,"context_line":"So floatingip update/delete maybe in a conflict situation with"},{"line_number":16,"context_line":"port forwarding CUD. But for port, we just lack the logic to"},{"line_number":17,"context_line":"process port forwarding during update port\u0027s fixed_ip and delete"},{"line_number":18,"context_line":"port. So my approach is that serialization, as the key point here"},{"line_number":19,"context_line":"we must to make sure the fip/port existing during create/update"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5f7c97a3_b776b60b","line":16,"range":{"start_line":16,"start_character":16,"end_line":16,"end_character":19},"updated":"2018-07-10 18:35:23.000000000","message":"CRUD ? you mean create, update delete or just update and delete ?","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":13,"context_line":"As the port forwarding resource associated with 2 resources,"},{"line_number":14,"context_line":"one is floatingip, the other is neutron internal port resource."},{"line_number":15,"context_line":"So floatingip update/delete maybe in a conflict situation with"},{"line_number":16,"context_line":"port forwarding CUD. But for port, we just lack the logic to"},{"line_number":17,"context_line":"process port forwarding during update port\u0027s fixed_ip and delete"},{"line_number":18,"context_line":"port. So my approach is that serialization, as the key point here"},{"line_number":19,"context_line":"we must to make sure the fip/port existing during create/update"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5f7c97a3_29faf576","line":16,"range":{"start_line":16,"start_character":16,"end_line":16,"end_character":19},"in_reply_to":"5f7c97a3_b776b60b","updated":"2018-07-11 03:37:52.000000000","message":"Yeah, sorry for this. The confict will happen in Create/Update/Delete.","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5f2be73dd68c34d5dfc4736be29cdfb176e3131c","unresolved":false,"context_lines":[{"line_number":17,"context_line":"process port forwarding during update port\u0027s fixed_ip and delete"},{"line_number":18,"context_line":"port. So my approach is that serialization, as the key point here"},{"line_number":19,"context_line":"we must to make sure the fip/port existing during create/update"},{"line_number":20,"context_line":"port forwarding and also make sure whether there is a port forwrading"},{"line_number":21,"context_line":"inused based on the fip during update/delete fip operation."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"So in this patch:"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5f7c97a3_d77b32f1","line":20,"range":{"start_line":20,"start_character":59,"end_line":20,"end_character":69},"updated":"2018-07-10 18:35:23.000000000","message":"forwarding","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":17,"context_line":"process port forwarding during update port\u0027s fixed_ip and delete"},{"line_number":18,"context_line":"port. So my approach is that serialization, as the key point here"},{"line_number":19,"context_line":"we must to make sure the fip/port existing during create/update"},{"line_number":20,"context_line":"port forwarding and also make sure whether there is a port forwrading"},{"line_number":21,"context_line":"inused based on the fip during update/delete fip operation."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"So in this patch:"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5f7c97a3_49ff3166","line":20,"range":{"start_line":20,"start_character":59,"end_line":20,"end_character":69},"in_reply_to":"5f7c97a3_d77b32f1","updated":"2018-07-11 03:37:52.000000000","message":"Done","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5f2be73dd68c34d5dfc4736be29cdfb176e3131c","unresolved":false,"context_lines":[{"line_number":18,"context_line":"port. So my approach is that serialization, as the key point here"},{"line_number":19,"context_line":"we must to make sure the fip/port existing during create/update"},{"line_number":20,"context_line":"port forwarding and also make sure whether there is a port forwrading"},{"line_number":21,"context_line":"inused based on the fip during update/delete fip operation."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"So in this patch:"},{"line_number":24,"context_line":"* for fip race issue, I introduce 2 functions in that patch."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5f7c97a3_777c9ee9","line":21,"range":{"start_line":21,"start_character":0,"end_line":21,"end_character":7},"updated":"2018-07-10 18:35:23.000000000","message":"in use","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":18,"context_line":"port. So my approach is that serialization, as the key point here"},{"line_number":19,"context_line":"we must to make sure the fip/port existing during create/update"},{"line_number":20,"context_line":"port forwarding and also make sure whether there is a port forwrading"},{"line_number":21,"context_line":"inused based on the fip during update/delete fip operation."},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"So in this patch:"},{"line_number":24,"context_line":"* for fip race issue, I introduce 2 functions in that patch."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5f7c97a3_09f13997","line":21,"range":{"start_line":21,"start_character":0,"end_line":21,"end_character":7},"in_reply_to":"5f7c97a3_777c9ee9","updated":"2018-07-11 03:37:52.000000000","message":"Done","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"4bc723fd74d69b6068ab3f82e3e2d8062ec253cc","unresolved":false,"context_lines":[{"line_number":39,"context_line":"now, we support no default value cases, but the default value will be"},{"line_number":40,"context_line":"done after server and agent side code done."},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"[1]"},{"line_number":43,"context_line":"https://specs.openstack.org/openstack/neutron-specs/specs/rocky/port-forwarding.html"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"Change-Id: I637ebcb33b91d899a077bded5ca10097a830a847"},{"line_number":46,"context_line":"Partial-Bug: #1491317"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":13,"id":"5f7c97a3_20125a56","line":43,"range":{"start_line":42,"start_character":0,"end_line":43,"end_character":84},"updated":"2018-07-18 14:44:01.000000000","message":"OK, I see, you just add this URL in every patch. Not so much necessary.","commit_id":"4df1c66af61c3da2986c0ac5c1a4465a3f8095c9"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"041bef7f7ea68b864564db930b1e200e06945666","unresolved":false,"context_lines":[{"line_number":39,"context_line":"now, we support no default value cases, but the default value will be"},{"line_number":40,"context_line":"done after server and agent side code done."},{"line_number":41,"context_line":""},{"line_number":42,"context_line":"[1]"},{"line_number":43,"context_line":"https://specs.openstack.org/openstack/neutron-specs/specs/rocky/port-forwarding.html"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"Change-Id: I637ebcb33b91d899a077bded5ca10097a830a847"},{"line_number":46,"context_line":"Partial-Bug: #1491317"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":13,"id":"5f7c97a3_b0c46e42","line":43,"range":{"start_line":42,"start_character":0,"end_line":43,"end_character":84},"in_reply_to":"5f7c97a3_20125a56","updated":"2018-07-19 02:24:21.000000000","message":"Yeah, just easy to check the related spec for us","commit_id":"4df1c66af61c3da2986c0ac5c1a4465a3f8095c9"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"756ad75949813b57d31115df3a44a145bdde3783","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":19,"id":"5f7c97a3_d16a95ea","updated":"2018-07-26 23:19:54.000000000","message":"Do we need to update the commit message to reflect what the patch does now","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"ce47dc05574413ab1e2a0301b9f2bdb8e3ae4969","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":19,"id":"5f7c97a3_2cfdacb1","in_reply_to":"5f7c97a3_d16a95ea","updated":"2018-07-27 05:13:50.000000000","message":"OK, I had change some sentences for descriping, but seems we found it not clear, let me refactor now. Thanks Miguel.","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"986f5153b16fb6eb29cdbc0e3febfce3f906b01f","unresolved":false,"context_lines":[{"line_number":37,"context_line":"now, we support no default value cases, but the default value will be"},{"line_number":38,"context_line":"done after server and agent side code done."},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"Partially-Implements: blueprint port-forwarding"},{"line_number":41,"context_line":"Change-Id: I637ebcb33b91d899a077bded5ca10097a830a847"},{"line_number":42,"context_line":"Partial-Bug: #1491317"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"5f7c97a3_20ce238f","line":40,"updated":"2018-07-26 10:53:18.000000000","message":"This patch\u0027s parent should be:\nhttps://review.openstack.org/#/c/579910/\n\nAnd, we are now fixing a patch that does not merged yet. Only two new functions were added, without any new mechanism. So maybe we can move this to the parent patch to avoid a `fix` during the developing?","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"cce7448c7490abeaf3bf288a2901d12ae9ec942a","unresolved":false,"context_lines":[{"line_number":37,"context_line":"now, we support no default value cases, but the default value will be"},{"line_number":38,"context_line":"done after server and agent side code done."},{"line_number":39,"context_line":""},{"line_number":40,"context_line":"Partially-Implements: blueprint port-forwarding"},{"line_number":41,"context_line":"Change-Id: I637ebcb33b91d899a077bded5ca10097a830a847"},{"line_number":42,"context_line":"Partial-Bug: #1491317"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"5f7c97a3_114a4d81","line":40,"in_reply_to":"5f7c97a3_20ce238f","updated":"2018-07-26 23:21:54.000000000","message":"As a reviewer of the entire series, I see value in dividing the work in smaller chunks. IMO, keeping this patch separate is fine","commit_id":"28c186fe36857ee366d2d231639110187863855b"}],"neutron/db/models/port_forwarding.py":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":47,"context_line":"    port \u003d orm.relationship("},{"line_number":48,"context_line":"        models_v2.Port, load_on_pending\u003dTrue,"},{"line_number":49,"context_line":"        backref\u003dorm.backref(\"port_forwardings\","},{"line_number":50,"context_line":"                            lazy\u003d\u0027joined\u0027, uselist\u003dTrue,"},{"line_number":51,"context_line":"                            cascade\u003d\u0027delete\u0027)"},{"line_number":52,"context_line":"    )"},{"line_number":53,"context_line":"    floating_ip \u003d orm.relationship("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_9ad616c3","line":50,"range":{"start_line":50,"start_character":28,"end_line":50,"end_character":56},"updated":"2018-06-13 09:21:16.000000000","message":"Can this move to neutron serer side patch [1] ?","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":47,"context_line":"    port \u003d orm.relationship("},{"line_number":48,"context_line":"        models_v2.Port, load_on_pending\u003dTrue,"},{"line_number":49,"context_line":"        backref\u003dorm.backref(\"port_forwardings\","},{"line_number":50,"context_line":"                            lazy\u003d\u0027joined\u0027, uselist\u003dTrue,"},{"line_number":51,"context_line":"                            cascade\u003d\u0027delete\u0027)"},{"line_number":52,"context_line":"    )"},{"line_number":53,"context_line":"    floating_ip \u003d orm.relationship("}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_ddb568ee","line":50,"range":{"start_line":50,"start_character":28,"end_line":50,"end_character":56},"in_reply_to":"5f7c97a3_9ad616c3","updated":"2018-06-13 10:46:49.000000000","message":"Done","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":53,"context_line":"    floating_ip \u003d orm.relationship("},{"line_number":54,"context_line":"        l3.FloatingIP, load_on_pending\u003dTrue,"},{"line_number":55,"context_line":"        backref\u003dorm.backref(\"port_forwardings\","},{"line_number":56,"context_line":"                            lazy\u003d\u0027joined\u0027, uselist\u003dTrue,"},{"line_number":57,"context_line":"                            cascade\u003d\u0027delete\u0027)"},{"line_number":58,"context_line":"    )"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_3ae1029c","line":56,"range":{"start_line":56,"start_character":28,"end_line":56,"end_character":56},"updated":"2018-06-13 09:21:16.000000000","message":"ditto","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":53,"context_line":"    floating_ip \u003d orm.relationship("},{"line_number":54,"context_line":"        l3.FloatingIP, load_on_pending\u003dTrue,"},{"line_number":55,"context_line":"        backref\u003dorm.backref(\"port_forwardings\","},{"line_number":56,"context_line":"                            lazy\u003d\u0027joined\u0027, uselist\u003dTrue,"},{"line_number":57,"context_line":"                            cascade\u003d\u0027delete\u0027)"},{"line_number":58,"context_line":"    )"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_7dd0d41f","line":56,"range":{"start_line":56,"start_character":28,"end_line":56,"end_character":56},"in_reply_to":"5f7c97a3_3ae1029c","updated":"2018-06-13 10:46:49.000000000","message":"Done","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"}],"neutron/extensions/extend_fip_port_forwarding.py":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":15,"context_line":"from neutron_lib.api.definitions import floating_ip_port_forwarding"},{"line_number":16,"context_line":"from neutron_lib.api import extensions"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"EXTEND_FIP_ALIAS \u003d \"extend-fip-port-forwarding\""},{"line_number":19,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":20,"context_line":"    l3.FLOATINGIPS: {"},{"line_number":21,"context_line":"        floating_ip_port_forwarding.COLLECTION_NAME: {"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_3a8fc2cd","line":18,"updated":"2018-06-13 09:21:16.000000000","message":"This is really interesting, we are adding a new extension to fix a foreseeable bug?\nI think such extension should be in one separated patch.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":15,"context_line":"from neutron_lib.api.definitions import floating_ip_port_forwarding"},{"line_number":16,"context_line":"from neutron_lib.api import extensions"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"EXTEND_FIP_ALIAS \u003d \"extend-fip-port-forwarding\""},{"line_number":19,"context_line":"EXTENDED_ATTRIBUTES_2_0 \u003d {"},{"line_number":20,"context_line":"    l3.FLOATINGIPS: {"},{"line_number":21,"context_line":"        floating_ip_port_forwarding.COLLECTION_NAME: {"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_5d6f185f","line":18,"in_reply_to":"5f7c97a3_3a8fc2cd","updated":"2018-06-13 10:46:49.000000000","message":"This extension is for fiting the spec mentioned API behavior. As the first part of neutron server side didn\u0027t contain this.\nGET /v2.0/floatingips/\u003cfloatingip-uuid\u003e\n\n{\n    \"floatingip\": {\n         \"floating_network_id\": \"376da547-b977-4cfe-9cba-275c80debf57\",\n         \"router_id\": \"d23abc8d-2991-4a55-ba98-2aaea84cc72f\",\n         \"fixed_ip_address\": \"\",\n         \"floating_ip_address\": \"172.24.4.228\",\n         \"project_id\": \"4969c491a3c74ee4af974e6d800c62de\",\n         \"tenant_id\": \"4969c491a3c74ee4af974e6d800c62de\",\n         \"status\": \"ACTIVE\",\n         \"port_id\": \"\",\n         \"id\": \"2f245a7b-796b-4f26-9cf9-9e82d248fda7\",\n         \"port_forwardings\": [\n             {\n                 \"internal_ip_address\": \"10.0.0.3\",\n                 \"protocol\": \"tcp\",\n                 \"internal_port\": \"22\",\n                 \"external_port\": \"7001\"\n             },\n             {\n                 \"internal_ip_address\": \"192.168.4.32\",\n                 \"protocol\": \"tcp\",\n                 \"internal_port\": \"22\",\n                 \"external_port\": \"7002\"\n             }\n         ]\n    }\n}","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"}],"neutron/objects/port_forwarding.py":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":49,"context_line":"        \u0027external_port\u0027: common_types.PortRangeField(nullable\u003dFalse),"},{"line_number":50,"context_line":"        \u0027protocol\u0027: common_types.IpProtocolEnumField(nullable\u003dFalse),"},{"line_number":51,"context_line":"        \u0027internal_port_id\u0027: common_types.UUIDField(nullable\u003dFalse),"},{"line_number":52,"context_line":"        \u0027internal_ip_address\u0027: obj_fields.IPV4AddressField(nullable\u003dFalse),"},{"line_number":53,"context_line":"        \u0027internal_port\u0027: common_types.PortRangeField(nullable\u003dFalse),"},{"line_number":54,"context_line":"        \u0027floating_ip_address\u0027: obj_fields.IPV4AddressField(),"},{"line_number":55,"context_line":"        \u0027router_id\u0027: common_types.UUIDField()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_7a777ad5","side":"PARENT","line":52,"range":{"start_line":52,"start_character":59,"end_line":52,"end_character":74},"updated":"2018-06-13 09:21:16.000000000","message":"Move such change to neutron server side patch [1] ?","commit_id":"a1c247e4e856807b18c997618661c9a1103dffca"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":49,"context_line":"        \u0027external_port\u0027: common_types.PortRangeField(nullable\u003dFalse),"},{"line_number":50,"context_line":"        \u0027protocol\u0027: common_types.IpProtocolEnumField(nullable\u003dFalse),"},{"line_number":51,"context_line":"        \u0027internal_port_id\u0027: common_types.UUIDField(nullable\u003dFalse),"},{"line_number":52,"context_line":"        \u0027internal_ip_address\u0027: obj_fields.IPV4AddressField(nullable\u003dFalse),"},{"line_number":53,"context_line":"        \u0027internal_port\u0027: common_types.PortRangeField(nullable\u003dFalse),"},{"line_number":54,"context_line":"        \u0027floating_ip_address\u0027: obj_fields.IPV4AddressField(),"},{"line_number":55,"context_line":"        \u0027router_id\u0027: common_types.UUIDField()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_1d93e050","side":"PARENT","line":52,"range":{"start_line":52,"start_character":59,"end_line":52,"end_character":74},"in_reply_to":"5f7c97a3_7a777ad5","updated":"2018-06-13 10:46:49.000000000","message":"Done.","commit_id":"a1c247e4e856807b18c997618661c9a1103dffca"}],"neutron/services/portforwarding/common/exceptions.py":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class FipIsInUsedByPortForwarding(n_exc.InUse):"},{"line_number":29,"context_line":"    message \u003d _(\"Floating Ip %(id)s is used by Port Forwarding resources\")"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_7ab21a96","line":29,"range":{"start_line":29,"start_character":25,"end_line":29,"end_character":28},"updated":"2018-06-13 09:21:16.000000000","message":"s/IP","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class FipIsInUsedByPortForwarding(n_exc.InUse):"},{"line_number":29,"context_line":"    message \u003d _(\"Floating Ip %(id)s is used by Port Forwarding resources\")"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_ddb1e8e1","line":29,"range":{"start_line":29,"start_character":25,"end_line":29,"end_character":28},"in_reply_to":"5f7c97a3_7ab21a96","updated":"2018-06-13 10:46:49.000000000","message":"Done","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"60f11893ec76e21df6db247bf0e6f022a53ae8d9","unresolved":false,"context_lines":[{"line_number":25,"context_line":"    message \u003d _(\"Port Forwarding lists can not be filtered by %(filter)s\")"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class FipIsInUsedByPortForwarding(n_exc.InUse):"},{"line_number":29,"context_line":"    message \u003d _(\"Floating IP %(id)s is used by Port Forwarding resources\")"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_fe853aaf","line":28,"range":{"start_line":28,"start_character":6,"end_line":28,"end_character":33},"updated":"2018-06-19 17:23:05.000000000","message":"\u0027FloatingipInUseByPortForwarding\u0027\n\nor \u0027FipInUseByPortForwarding\u0027","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6c5f505e43c64fa3256c102e2de9747b2eb80697","unresolved":false,"context_lines":[{"line_number":25,"context_line":"    message \u003d _(\"Port Forwarding lists can not be filtered by %(filter)s\")"},{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class FipIsInUsedByPortForwarding(n_exc.InUse):"},{"line_number":29,"context_line":"    message \u003d _(\"Floating IP %(id)s is used by Port Forwarding resources\")"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_bbd34b01","line":28,"range":{"start_line":28,"start_character":6,"end_line":28,"end_character":33},"in_reply_to":"5f7c97a3_fe853aaf","updated":"2018-06-20 00:25:22.000000000","message":"Thanks, I will reword the name. :)","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"af9a4436573d7da6211a6d961377cc87b7427916","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"class FipInUseByPortForwarding(n_exc.InUse):"},{"line_number":29,"context_line":"    message \u003d _(\"Floating IP %(id)s is used by Port Forwarding resources\")"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_4872ab14","line":29,"range":{"start_line":29,"start_character":36,"end_line":29,"end_character":43},"updated":"2018-06-28 18:18:45.000000000","message":"s/in use","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"}],"neutron/services/portforwarding/pf_plugin.py":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":71,"context_line":"    \"\"\""},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    supported_extension_aliases \u003d [\u0027floating-ip-port-forwarding\u0027,"},{"line_number":74,"context_line":"                                   \"extend-fip-port-forwarding\"]"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    __native_pagination_support \u003d True"},{"line_number":77,"context_line":"    __native_sorting_support \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_da3a4ee4","line":74,"range":{"start_line":74,"start_character":35,"end_line":74,"end_character":63},"updated":"2018-06-13 09:21:16.000000000","message":"This is really interesting, we are adding a new extension to fix a foreseeable bug?\nMaybe you mixed these two things.\nIt\u0027s better to move such extension to a separated patch.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":71,"context_line":"    \"\"\""},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    supported_extension_aliases \u003d [\u0027floating-ip-port-forwarding\u0027,"},{"line_number":74,"context_line":"                                   \"extend-fip-port-forwarding\"]"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    __native_pagination_support \u003d True"},{"line_number":77,"context_line":"    __native_sorting_support \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_bde3ccd7","line":74,"range":{"start_line":74,"start_character":35,"end_line":74,"end_character":63},"in_reply_to":"5f7c97a3_da3a4ee4","updated":"2018-06-13 10:46:49.000000000","message":"OK, let me split this into 2 patchsets.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        self.l3_plugin \u003d directory.get_plugin(constants.L3)"},{"line_number":83,"context_line":"        self.core_plugin \u003d directory.get_plugin()"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    @staticmethod"},{"line_number":86,"context_line":"    @resource_extend.extends([l3.FLOATINGIPS])"},{"line_number":87,"context_line":"    def _extend_floatingip_dict(result_dict, db):"},{"line_number":88,"context_line":"        fields \u003d [\u0027internal_ip_address\u0027, \u0027protocol\u0027, \u0027internal_port\u0027,"},{"line_number":89,"context_line":"                  \u0027external_port\u0027]"},{"line_number":90,"context_line":"        result_dict[\u0027port_forwardings\u0027] \u003d []"},{"line_number":91,"context_line":"        if db.port_forwardings:"},{"line_number":92,"context_line":"            port_forwarding_result \u003d []"},{"line_number":93,"context_line":"            for port_forwarding in db.port_forwardings:"},{"line_number":94,"context_line":"                pf_dict \u003d pf.PortForwarding.modify_fields_from_db("},{"line_number":95,"context_line":"                    port_forwarding)"},{"line_number":96,"context_line":"                for key in pf_dict.keys():"},{"line_number":97,"context_line":"                    if key not in fields:"},{"line_number":98,"context_line":"                        pf_dict.pop(key)"},{"line_number":99,"context_line":"                    elif key \u003d\u003d \u0027internal_ip_address\u0027:"},{"line_number":100,"context_line":"                        pf_dict[key] \u003d str(pf_dict[key])"},{"line_number":101,"context_line":"                port_forwarding_result.append(pf_dict)"},{"line_number":102,"context_line":"            result_dict[\u0027port_forwardings\u0027] \u003d port_forwarding_result"},{"line_number":103,"context_line":"        return result_dict"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    @registry.receives(resources.FLOATING_IP, [events.PRECOMMIT_UPDATE,"},{"line_number":106,"context_line":"                                               events.PRECOMMIT_DELETE])"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_da132e64","line":103,"range":{"start_line":85,"start_character":0,"end_line":103,"end_character":26},"updated":"2018-06-13 09:21:16.000000000","message":"Move to a independent patch ?","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":82,"context_line":"        self.l3_plugin \u003d directory.get_plugin(constants.L3)"},{"line_number":83,"context_line":"        self.core_plugin \u003d directory.get_plugin()"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    @staticmethod"},{"line_number":86,"context_line":"    @resource_extend.extends([l3.FLOATINGIPS])"},{"line_number":87,"context_line":"    def _extend_floatingip_dict(result_dict, db):"},{"line_number":88,"context_line":"        fields \u003d [\u0027internal_ip_address\u0027, \u0027protocol\u0027, \u0027internal_port\u0027,"},{"line_number":89,"context_line":"                  \u0027external_port\u0027]"},{"line_number":90,"context_line":"        result_dict[\u0027port_forwardings\u0027] \u003d []"},{"line_number":91,"context_line":"        if db.port_forwardings:"},{"line_number":92,"context_line":"            port_forwarding_result \u003d []"},{"line_number":93,"context_line":"            for port_forwarding in db.port_forwardings:"},{"line_number":94,"context_line":"                pf_dict \u003d pf.PortForwarding.modify_fields_from_db("},{"line_number":95,"context_line":"                    port_forwarding)"},{"line_number":96,"context_line":"                for key in pf_dict.keys():"},{"line_number":97,"context_line":"                    if key not in fields:"},{"line_number":98,"context_line":"                        pf_dict.pop(key)"},{"line_number":99,"context_line":"                    elif key \u003d\u003d \u0027internal_ip_address\u0027:"},{"line_number":100,"context_line":"                        pf_dict[key] \u003d str(pf_dict[key])"},{"line_number":101,"context_line":"                port_forwarding_result.append(pf_dict)"},{"line_number":102,"context_line":"            result_dict[\u0027port_forwardings\u0027] \u003d port_forwarding_result"},{"line_number":103,"context_line":"        return result_dict"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    @registry.receives(resources.FLOATING_IP, [events.PRECOMMIT_UPDATE,"},{"line_number":106,"context_line":"                                               events.PRECOMMIT_DELETE])"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_1d0a0089","line":103,"range":{"start_line":85,"start_character":0,"end_line":103,"end_character":26},"in_reply_to":"5f7c97a3_da132e64","updated":"2018-06-13 10:46:49.000000000","message":"Yeah, this will follow the extension.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":106,"context_line":"                                               events.PRECOMMIT_DELETE])"},{"line_number":107,"context_line":"    def _check_floatingip_request(self, resource, event, trigger, context,"},{"line_number":108,"context_line":"                                  **kwargs):"},{"line_number":109,"context_line":"        # We only support the \"free\" floatingip to associated with"},{"line_number":110,"context_line":"        # port forwarding resources. And in the PUT request of floatingip,"},{"line_number":111,"context_line":"        # the request body must contain a \"port_id\" field which is not"},{"line_number":112,"context_line":"        # allowed in port forwarding functionality."},{"line_number":113,"context_line":"        floating_ip_id \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_1a3206a8","line":110,"range":{"start_line":109,"start_character":0,"end_line":110,"end_character":36},"updated":"2018-06-13 09:21:16.000000000","message":"Please see my comments Line 128-131.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":125,"context_line":"        @lockutils.synchronized(floating_ip_id+\u0027-create-or-update\u0027,"},{"line_number":126,"context_line":"                                external\u003dTrue)"},{"line_number":127,"context_line":"        def _do_validate():"},{"line_number":128,"context_line":"            exist_pf_resources \u003d pf.PortForwarding.get_objects("},{"line_number":129,"context_line":"                context, floating_ip_id\u003dfloating_ip_id)"},{"line_number":130,"context_line":"            if exist_pf_resources:"},{"line_number":131,"context_line":"                raise pf_exc.FipIsInUsedByPortForwarding(id\u003dfloating_ip_id)"},{"line_number":132,"context_line":"        _do_validate()"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_da0ecee2","line":131,"range":{"start_line":128,"start_character":11,"end_line":131,"end_character":75},"updated":"2018-06-13 09:21:16.000000000","message":"So, if one floating IP has port_forwardings, it can not be associated to a port? Even the port is under the same router? Correct me if I\u0027m wrong.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":125,"context_line":"        @lockutils.synchronized(floating_ip_id+\u0027-create-or-update\u0027,"},{"line_number":126,"context_line":"                                external\u003dTrue)"},{"line_number":127,"context_line":"        def _do_validate():"},{"line_number":128,"context_line":"            exist_pf_resources \u003d pf.PortForwarding.get_objects("},{"line_number":129,"context_line":"                context, floating_ip_id\u003dfloating_ip_id)"},{"line_number":130,"context_line":"            if exist_pf_resources:"},{"line_number":131,"context_line":"                raise pf_exc.FipIsInUsedByPortForwarding(id\u003dfloating_ip_id)"},{"line_number":132,"context_line":"        _do_validate()"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_736a45b3","line":131,"range":{"start_line":128,"start_character":11,"end_line":131,"end_character":75},"in_reply_to":"5f7c97a3_da0ecee2","updated":"2018-06-13 10:46:49.000000000","message":"Yeah, a floatingip could be associated with only 1 of them(port or port forwarding resource) for forbiding conflict traffic.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"d1e1e9bb7b266b1387c0a267865e7f7b9a254c16","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                                external\u003dTrue)"},{"line_number":242,"context_line":"        def _do_create_if_parallel():"},{"line_number":243,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":244,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":245,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":246,"context_line":"                if fip_obj:"},{"line_number":247,"context_line":"                    router_id \u003d self._find_a_router_for_fippf(context,"},{"line_number":248,"context_line":"                                                              port_forwarding,"},{"line_number":249,"context_line":"                                                              fip_obj)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_7acc5a69","line":246,"range":{"start_line":244,"start_character":0,"end_line":246,"end_character":27},"updated":"2018-06-13 09:21:16.000000000","message":"I don\u0027t think this can work. If floating IP is free and available, in line 244 you can get one DB object. In another neutron server (or worker), the L3 plugin is going to delete the floating IP after you call Line 244. Then in line 274 you may get some foreign key constraint exception.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"4f657ab7de0063d8c20cea37a39d65f96816aed8","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                                external\u003dTrue)"},{"line_number":242,"context_line":"        def _do_create_if_parallel():"},{"line_number":243,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":244,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":245,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":246,"context_line":"                if fip_obj:"},{"line_number":247,"context_line":"                    router_id \u003d self._find_a_router_for_fippf(context,"},{"line_number":248,"context_line":"                                                              port_forwarding,"},{"line_number":249,"context_line":"                                                              fip_obj)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_19e2f901","line":246,"range":{"start_line":244,"start_character":0,"end_line":246,"end_character":27},"in_reply_to":"5f7c97a3_080e253a","updated":"2018-06-14 08:37:56.000000000","message":"Sorry, I miss that delete_floatingip notify payload, it is a l2 port. This is really hard to review, maybe you can refactor line 113 - 122.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6c5f505e43c64fa3256c102e2de9747b2eb80697","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                                external\u003dTrue)"},{"line_number":242,"context_line":"        def _do_create_if_parallel():"},{"line_number":243,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":244,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":245,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":246,"context_line":"                if fip_obj:"},{"line_number":247,"context_line":"                    router_id \u003d self._find_a_router_for_fippf(context,"},{"line_number":248,"context_line":"                                                              port_forwarding,"},{"line_number":249,"context_line":"                                                              fip_obj)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_92a7bb50","line":246,"range":{"start_line":244,"start_character":0,"end_line":246,"end_character":27},"in_reply_to":"5f7c97a3_456968f5","updated":"2018-06-20 00:25:22.000000000","message":"No,","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"26def78fe2577336a521d8ef95e5216b8647a73f","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                                external\u003dTrue)"},{"line_number":242,"context_line":"        def _do_create_if_parallel():"},{"line_number":243,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":244,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":245,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":246,"context_line":"                if fip_obj:"},{"line_number":247,"context_line":"                    router_id \u003d self._find_a_router_for_fippf(context,"},{"line_number":248,"context_line":"                                                              port_forwarding,"},{"line_number":249,"context_line":"                                                              fip_obj)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_080e253a","line":246,"range":{"start_line":244,"start_character":0,"end_line":246,"end_character":27},"in_reply_to":"5f7c97a3_456968f5","updated":"2018-06-14 06:33:14.000000000","message":"_check_floatingip_request func subscribed fip events.PRECOMMIT_UPDATE and events.PRECOMMIT_DELETE. A \"free\" floatingip means this floatingip is not associated with a Neutron port for 1-1 DNAT, in the traditional way.\nFor update, the PRECOMMIT_UPDATE will be notified in http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1399 and the payload would be http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1257 .\n\nFor delete, the PRECOMMIT_DELETE will be notified in \nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1439 , and the payload is http://git.openstack.org/cgit/openstack/neutron/tree/neutron/plugins/ml2/plugin.py#n1530\n\nSo the _check_floatingip_request treat the difference by update and delete cases, get the necessary value by different event, but need to concern that, both of these cases the \"floating_ip_id\" won\u0027t be None,  think about it.  And for your said, deleting a free floatingip, the fip PRECOMMIT_DELETE will be raised before delete its floating_port_id, and the port\u0027s device_id must be floatingip_id, then it will still do _do_validate, which locked by the floatingip_id.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"49b135f9fcb66226b976ed5e40f5ad2045749219","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                                external\u003dTrue)"},{"line_number":242,"context_line":"        def _do_create_if_parallel():"},{"line_number":243,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":244,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":245,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":246,"context_line":"                if fip_obj:"},{"line_number":247,"context_line":"                    router_id \u003d self._find_a_router_for_fippf(context,"},{"line_number":248,"context_line":"                                                              port_forwarding,"},{"line_number":249,"context_line":"                                                              fip_obj)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_fdbe2463","line":246,"range":{"start_line":244,"start_character":0,"end_line":246,"end_character":27},"in_reply_to":"5f7c97a3_7acc5a69","updated":"2018-06-13 10:46:49.000000000","message":"Correct, that\u0027s the reason I say “A distributed lock is better.”。 For a single Neutron server instance, this function(create_floatingip_port_forwarding) and \"_check_floatingip_request\" must be serialized, this lock can make sure there is only 1 func are processing between many workers. But for generic deployment, the neutron server would be depolyed on several nodes, that means if the API requests are processed by different neutron server instances, then this lock would be useless, should be a distributed lock to limit them in race condition.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6bb313a4b2da045efa1948a347835fedca6ce0b6","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                                external\u003dTrue)"},{"line_number":242,"context_line":"        def _do_create_if_parallel():"},{"line_number":243,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":244,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":245,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":246,"context_line":"                if fip_obj:"},{"line_number":247,"context_line":"                    router_id \u003d self._find_a_router_for_fippf(context,"},{"line_number":248,"context_line":"                                                              port_forwarding,"},{"line_number":249,"context_line":"                                                              fip_obj)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_ffd126f9","line":246,"range":{"start_line":244,"start_character":0,"end_line":246,"end_character":27},"in_reply_to":"5f7c97a3_bf088ed8","updated":"2018-06-14 01:20:05.000000000","message":"No, if the neutron server enable port forwarding service plugin, a callback func \"_check_floatingip_request\" will be registered for checking the floatingip precommit-delete event. And the internal func \"_do_validate\" will share the lock with \"_do_create_if_parallel\" if they call the same fip resource. Please feel free to correct. Let\u0027s discuss. :)","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"b89d0fbe32a9c61c647780c824e70d5e6846b947","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                                external\u003dTrue)"},{"line_number":242,"context_line":"        def _do_create_if_parallel():"},{"line_number":243,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":244,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":245,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":246,"context_line":"                if fip_obj:"},{"line_number":247,"context_line":"                    router_id \u003d self._find_a_router_for_fippf(context,"},{"line_number":248,"context_line":"                                                              port_forwarding,"},{"line_number":249,"context_line":"                                                              fip_obj)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_bf088ed8","line":246,"range":{"start_line":244,"start_character":0,"end_line":246,"end_character":27},"in_reply_to":"5f7c97a3_fdbe2463","updated":"2018-06-14 01:13:56.000000000","message":"A distributed lock still not work, because L3 plugin and port_forwaring plugin do not share the lock. They are two independent API create_floatingip_port_forwarding and delete_floatingip.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"267551f313d07f84825d08cc96276d6b7c3ce364","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                                external\u003dTrue)"},{"line_number":242,"context_line":"        def _do_create_if_parallel():"},{"line_number":243,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":244,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":245,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":246,"context_line":"                if fip_obj:"},{"line_number":247,"context_line":"                    router_id \u003d self._find_a_router_for_fippf(context,"},{"line_number":248,"context_line":"                                                              port_forwarding,"},{"line_number":249,"context_line":"                                                              fip_obj)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_456968f5","line":246,"range":{"start_line":244,"start_character":0,"end_line":246,"end_character":27},"in_reply_to":"5f7c97a3_ffd126f9","updated":"2018-06-14 04:58:08.000000000","message":"A free floating IP deleting will directly return at line 122, right? The lock does not take effect.","commit_id":"a2f47d36c23929fcff009574016e6b6c2905af37"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"60f11893ec76e21df6db247bf0e6f022a53ae8d9","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            if not kwargs.get(\u0027floatingip\u0027).get(\u0027floatingip\u0027).get(\u0027port_id\u0027):"},{"line_number":98,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":99,"context_line":"                # The port_id field is a must-option."},{"line_number":100,"context_line":"                return"},{"line_number":101,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"},{"line_number":102,"context_line":"            floatingip_id \u003d kwargs.get(\u0027port\u0027).get(\u0027device_id\u0027)"},{"line_number":103,"context_line":"        if not floatingip_id:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_193930ce","line":100,"range":{"start_line":100,"start_character":16,"end_line":100,"end_character":22},"updated":"2018-06-19 17:23:05.000000000","message":"can an exception be raised here ? or some sort of logging would also help here before return.","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6c5f505e43c64fa3256c102e2de9747b2eb80697","unresolved":false,"context_lines":[{"line_number":97,"context_line":"            if not kwargs.get(\u0027floatingip\u0027).get(\u0027floatingip\u0027).get(\u0027port_id\u0027):"},{"line_number":98,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":99,"context_line":"                # The port_id field is a must-option."},{"line_number":100,"context_line":"                return"},{"line_number":101,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"},{"line_number":102,"context_line":"            floatingip_id \u003d kwargs.get(\u0027port\u0027).get(\u0027device_id\u0027)"},{"line_number":103,"context_line":"        if not floatingip_id:"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_1b97df3c","line":100,"range":{"start_line":100,"start_character":16,"end_line":100,"end_character":22},"in_reply_to":"5f7c97a3_193930ce","updated":"2018-06-20 00:25:22.000000000","message":"Exception is not needed here, as any update floatingip with a port_id cases should be check here, because the port willing to monopolize the floatingip. So that\u0027s the cases we want to cover, and I agree to log something here before return silently.","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"60f11893ec76e21df6db247bf0e6f022a53ae8d9","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":108,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":109,"context_line":"                                external\u003dTrue)"},{"line_number":110,"context_line":"        def _do_validate():"},{"line_number":111,"context_line":"            exist_pf_resources \u003d pf.PortForwarding.get_objects("},{"line_number":112,"context_line":"                context, floatingip_id\u003dfloatingip_id)"},{"line_number":113,"context_line":"            if exist_pf_resources:"},{"line_number":114,"context_line":"                raise pf_exc.FipIsInUsedByPortForwarding(id\u003dfloatingip_id)"},{"line_number":115,"context_line":"        _do_validate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_59f3280a","line":114,"range":{"start_line":110,"start_character":7,"end_line":114,"end_character":73},"updated":"2018-06-19 17:23:05.000000000","message":"can be separate helper out of this method starting at L87","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6c5f505e43c64fa3256c102e2de9747b2eb80697","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":108,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":109,"context_line":"                                external\u003dTrue)"},{"line_number":110,"context_line":"        def _do_validate():"},{"line_number":111,"context_line":"            exist_pf_resources \u003d pf.PortForwarding.get_objects("},{"line_number":112,"context_line":"                context, floatingip_id\u003dfloatingip_id)"},{"line_number":113,"context_line":"            if exist_pf_resources:"},{"line_number":114,"context_line":"                raise pf_exc.FipIsInUsedByPortForwarding(id\u003dfloatingip_id)"},{"line_number":115,"context_line":"        _do_validate()"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_7bde1311","line":114,"range":{"start_line":110,"start_character":7,"end_line":114,"end_character":73},"in_reply_to":"5f7c97a3_59f3280a","updated":"2018-06-20 00:25:22.000000000","message":"Hmm, you mean that if separate it out of this function would be clearer. But why it write inside this callback func at L87, because we can easily to get the \"floatingip_id\" value in func decorator in L107. Any suggestion?","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"60f11893ec76e21df6db247bf0e6f022a53ae8d9","unresolved":false,"context_lines":[{"line_number":119,"context_line":"    @db_api.retry_if_session_inactive()"},{"line_number":120,"context_line":"    def _process_port_request(self, resource, event, trigger, context,"},{"line_number":121,"context_line":"                              **kwargs):"},{"line_number":122,"context_line":"        # Delete floatingip will receive port resource with precommit_delete"},{"line_number":123,"context_line":"        # event, so just return, then check the request in"},{"line_number":124,"context_line":"        # _check_floatingip_request callback."},{"line_number":125,"context_line":"        if kwargs.get(\u0027port\u0027).get(\u0027device_owner\u0027).startswith("}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_d9de5869","line":122,"range":{"start_line":122,"start_character":10,"end_line":122,"end_character":16},"updated":"2018-06-19 17:23:05.000000000","message":"Deleting","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6c5f505e43c64fa3256c102e2de9747b2eb80697","unresolved":false,"context_lines":[{"line_number":119,"context_line":"    @db_api.retry_if_session_inactive()"},{"line_number":120,"context_line":"    def _process_port_request(self, resource, event, trigger, context,"},{"line_number":121,"context_line":"                              **kwargs):"},{"line_number":122,"context_line":"        # Delete floatingip will receive port resource with precommit_delete"},{"line_number":123,"context_line":"        # event, so just return, then check the request in"},{"line_number":124,"context_line":"        # _check_floatingip_request callback."},{"line_number":125,"context_line":"        if kwargs.get(\u0027port\u0027).get(\u0027device_owner\u0027).startswith("}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_3b23bba9","line":122,"range":{"start_line":122,"start_character":10,"end_line":122,"end_character":16},"in_reply_to":"5f7c97a3_d9de5869","updated":"2018-06-20 00:25:22.000000000","message":"Done","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"60f11893ec76e21df6db247bf0e6f022a53ae8d9","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        # Delete floatingip will receive port resource with precommit_delete"},{"line_number":123,"context_line":"        # event, so just return, then check the request in"},{"line_number":124,"context_line":"        # _check_floatingip_request callback."},{"line_number":125,"context_line":"        if kwargs.get(\u0027port\u0027).get(\u0027device_owner\u0027).startswith("},{"line_number":126,"context_line":"                lib_conts.DEVICE_OWNER_FLOATINGIP):"},{"line_number":127,"context_line":"            return"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"        # if the port owner want to update or delete port, we must elevate the"},{"line_number":130,"context_line":"        # context to check the floatingip or port forwarding resources if they"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_39574ccd","line":127,"range":{"start_line":125,"start_character":8,"end_line":127,"end_character":18},"updated":"2018-06-19 17:23:05.000000000","message":"is this the case where port has device owner and can\u0027t be removed ? then shouldn\u0027t it raise an exception that deleting port isn\u0027t allowed ?","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"6c5f505e43c64fa3256c102e2de9747b2eb80697","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        # Delete floatingip will receive port resource with precommit_delete"},{"line_number":123,"context_line":"        # event, so just return, then check the request in"},{"line_number":124,"context_line":"        # _check_floatingip_request callback."},{"line_number":125,"context_line":"        if kwargs.get(\u0027port\u0027).get(\u0027device_owner\u0027).startswith("},{"line_number":126,"context_line":"                lib_conts.DEVICE_OWNER_FLOATINGIP):"},{"line_number":127,"context_line":"            return"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"        # if the port owner want to update or delete port, we must elevate the"},{"line_number":130,"context_line":"        # context to check the floatingip or port forwarding resources if they"}],"source_content_type":"text/x-python","patch_set":6,"id":"5f7c97a3_9bb68f3e","line":127,"range":{"start_line":125,"start_character":8,"end_line":127,"end_character":18},"in_reply_to":"5f7c97a3_39574ccd","updated":"2018-06-20 00:25:22.000000000","message":"This is just for forbiding the race condition for deleting floatingip, as it will notify 2 events during deleting floatingip, one is \u0027precommit_delete\u0027 floatingip event, the other  is \"precommit_delete\" l2 port which is used for floatingip. So just want make the process into only 1 validation function, that\u0027s _check_floatingip_request callback. So I think the exception is not needed.","commit_id":"cc596efaed0f537ee43517467fd09fe7ae3e5a14"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"af9a4436573d7da6211a6d961377cc87b7427916","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":101,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":102,"context_line":"                # disassociate a internal port, the port_id should be null."},{"line_number":103,"context_line":"                LOG.debug(\u0027Skip check for floatingip %s, as the update request\u0027"},{"line_number":104,"context_line":"                          \u0027doesn\\\u0027t contain port_id.\u0027, floatingip_id)"},{"line_number":105,"context_line":"                return"},{"line_number":106,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_08027373","line":103,"range":{"start_line":103,"start_character":78,"end_line":103,"end_character":79},"updated":"2018-06-28 18:18:45.000000000","message":"missing trailing space, will be run-on sentence","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"24d8154d7cd95c3cab1a47d0e5f8433d05adb721","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":101,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":102,"context_line":"                # disassociate a internal port, the port_id should be null."},{"line_number":103,"context_line":"                LOG.debug(\u0027Skip check for floatingip %s, as the update request\u0027"},{"line_number":104,"context_line":"                          \u0027doesn\\\u0027t contain port_id.\u0027, floatingip_id)"},{"line_number":105,"context_line":"                return"},{"line_number":106,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_ca90e552","line":103,"range":{"start_line":103,"start_character":78,"end_line":103,"end_character":79},"in_reply_to":"5f7c97a3_08027373","updated":"2018-06-29 09:40:05.000000000","message":"Done","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"af9a4436573d7da6211a6d961377cc87b7427916","unresolved":false,"context_lines":[{"line_number":101,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":102,"context_line":"                # disassociate a internal port, the port_id should be null."},{"line_number":103,"context_line":"                LOG.debug(\u0027Skip check for floatingip %s, as the update request\u0027"},{"line_number":104,"context_line":"                          \u0027doesn\\\u0027t contain port_id.\u0027, floatingip_id)"},{"line_number":105,"context_line":"                return"},{"line_number":106,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"},{"line_number":107,"context_line":"            floatingip_id \u003d kwargs.get(\u0027port\u0027).get(\u0027device_id\u0027)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_28072f84","line":104,"range":{"start_line":104,"start_character":27,"end_line":104,"end_character":36},"updated":"2018-06-28 18:18:45.000000000","message":"s/does not","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"24d8154d7cd95c3cab1a47d0e5f8433d05adb721","unresolved":false,"context_lines":[{"line_number":101,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":102,"context_line":"                # disassociate a internal port, the port_id should be null."},{"line_number":103,"context_line":"                LOG.debug(\u0027Skip check for floatingip %s, as the update request\u0027"},{"line_number":104,"context_line":"                          \u0027doesn\\\u0027t contain port_id.\u0027, floatingip_id)"},{"line_number":105,"context_line":"                return"},{"line_number":106,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"},{"line_number":107,"context_line":"            floatingip_id \u003d kwargs.get(\u0027port\u0027).get(\u0027device_id\u0027)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_8a9aed6c","line":104,"range":{"start_line":104,"start_character":27,"end_line":104,"end_character":36},"in_reply_to":"5f7c97a3_28072f84","updated":"2018-06-29 09:40:05.000000000","message":"Done","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"af9a4436573d7da6211a6d961377cc87b7427916","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        # TODO(bzhao) A distributed lock is better."},{"line_number":112,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":113,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":114,"context_line":"                                external\u003dTrue)"},{"line_number":115,"context_line":"        def _do_validate():"},{"line_number":116,"context_line":"            exist_pf_resources \u003d pf.PortForwarding.get_objects("},{"line_number":117,"context_line":"                context, floatingip_id\u003dfloatingip_id)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_487cebb5","line":114,"updated":"2018-06-28 18:18:45.000000000","message":"Why this locking?  Won\u0027t the DB code handle this?  Also, why external?","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"24d8154d7cd95c3cab1a47d0e5f8433d05adb721","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        # TODO(bzhao) A distributed lock is better."},{"line_number":112,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":113,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":114,"context_line":"                                external\u003dTrue)"},{"line_number":115,"context_line":"        def _do_validate():"},{"line_number":116,"context_line":"            exist_pf_resources \u003d pf.PortForwarding.get_objects("},{"line_number":117,"context_line":"                context, floatingip_id\u003dfloatingip_id)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_16acc89d","line":114,"in_reply_to":"5f7c97a3_487cebb5","updated":"2018-06-29 09:40:05.000000000","message":"Hi, Brain. Thanks for review. I explain it below.\n\nAs like the functions \"_check_floatingip_request\" registered events, and \"_do_create_if_parallel\" in create_floating_ip_port_forwarding function. So here, we found the several cases that will hit race issues.\n* associate \"Free\" fip and create port forwarding may in race condition, as we associate fip with a neutron port and create port forwarding based on this fip in concurrent way, both of them will success.\n* delete \"Free\" fip and create port forwarding based on this fip, and during create port forwarding, the db delete the record after the logic check the fip exist. Then will gerate the port forwarding obj, as the port forwarding obj will reread the fip_obj, so this will hit 500.\n\nSo for forbidding this kind race condition, my approach is to serialize to process towards a same fip by a external lock. Why external lock? As a neutron server instance will setup several api workers to process the api requests, if we just use the internal lock(which is not external), the different workers still face the race issue, as the internal lock can be shared with the single worker, the other workers don\u0027t know whether the lock exists. So for a single neutron server instance, I introduce the external lock, but for the case which deploy multiple neutron server instance, the distributed lock is better(That\u0027s why I wrote TODO).\n\nDB code not cover this, as the DB code are different, in current design, the fip_obj and portforwarding obj are 2 seperate obj, port forwarding obj just want to query the floatingip info during genating the port forwrading obj.\nSo they just commit the record into their db table.\n\nNotes from the past comments, I think it\u0027s good to help to understand :\n_check_floatingip_request func subscribed fip events.PRECOMMIT_UPDATE and events.PRECOMMIT_DELETE. A \"free\" floatingip means this floatingip is not associated with a Neutron port for 1-1 DNAT, in the traditional way.\nFor update, the PRECOMMIT_UPDATE will be notified in http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1399 and the payload would be http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1257 .\n\nFor delete, the PRECOMMIT_DELETE will be notified in \nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1439 , and the payload is http://git.openstack.org/cgit/openstack/neutron/tree/neutron/plugins/ml2/plugin.py#n1530\n\nSo the _check_floatingip_request treat the difference by update and delete cases, get the necessary value by different event, but need to concern that, both of these cases the \"floating_ip_id\" won\u0027t be None,  think about it.  And for your said, deleting a free floatingip, the fip PRECOMMIT_DELETE will be raised before delete its floating_port_id, and the port\u0027s device_id must be floatingip_id, then it will still do _do_validate, which locked by the floatingip_id.","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"af9a4436573d7da6211a6d961377cc87b7427916","unresolved":false,"context_lines":[{"line_number":241,"context_line":"        # TODO(bzhao) A distributed lock is better."},{"line_number":242,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":243,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":244,"context_line":"                                external\u003dTrue)"},{"line_number":245,"context_line":"        def _do_create_if_parallel():"},{"line_number":246,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":247,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_e846177c","line":244,"updated":"2018-06-28 18:18:45.000000000","message":"Same comment as above.","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"24d8154d7cd95c3cab1a47d0e5f8433d05adb721","unresolved":false,"context_lines":[{"line_number":241,"context_line":"        # TODO(bzhao) A distributed lock is better."},{"line_number":242,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":243,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":244,"context_line":"                                external\u003dTrue)"},{"line_number":245,"context_line":"        def _do_create_if_parallel():"},{"line_number":246,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":247,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_d68df035","line":244,"in_reply_to":"5f7c97a3_e846177c","updated":"2018-06-29 09:40:05.000000000","message":"Same as above. Please check and some nice suggestions.","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"0647fdea234d464efaadaa1e8b3c08675177f1f8","unresolved":false,"context_lines":[{"line_number":86,"context_line":"                                               events.PRECOMMIT_DELETE])"},{"line_number":87,"context_line":"    def _check_floatingip_request(self, resource, event, trigger, context,"},{"line_number":88,"context_line":"                                  **kwargs):"},{"line_number":89,"context_line":"        # We only support the \"free\" floatingip to associated with"},{"line_number":90,"context_line":"        # port forwarding resources. And in the PUT request of floatingip,"},{"line_number":91,"context_line":"        # the request body must contain a \"port_id\" field which is not"},{"line_number":92,"context_line":"        # allowed in port forwarding functionality."}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_5ecda990","line":89,"range":{"start_line":89,"start_character":51,"end_line":89,"end_character":61},"updated":"2018-07-10 23:33:01.000000000","message":"be associated","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":86,"context_line":"                                               events.PRECOMMIT_DELETE])"},{"line_number":87,"context_line":"    def _check_floatingip_request(self, resource, event, trigger, context,"},{"line_number":88,"context_line":"                                  **kwargs):"},{"line_number":89,"context_line":"        # We only support the \"free\" floatingip to associated with"},{"line_number":90,"context_line":"        # port forwarding resources. And in the PUT request of floatingip,"},{"line_number":91,"context_line":"        # the request body must contain a \"port_id\" field which is not"},{"line_number":92,"context_line":"        # allowed in port forwarding functionality."}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_69254d16","line":89,"range":{"start_line":89,"start_character":51,"end_line":89,"end_character":61},"in_reply_to":"5f7c97a3_5ecda990","updated":"2018-07-11 03:37:52.000000000","message":"Done","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5f2be73dd68c34d5dfc4736be29cdfb176e3131c","unresolved":false,"context_lines":[{"line_number":94,"context_line":"        if event \u003d\u003d events.PRECOMMIT_UPDATE:"},{"line_number":95,"context_line":"            floatingip_id \u003d (kwargs.get(\u0027floatingip_id\u0027) or"},{"line_number":96,"context_line":"                             kwargs.get(\u0027floating_ip_id\u0027))"},{"line_number":97,"context_line":"            if not kwargs.get(\u0027floatingip\u0027).get(\u0027floatingip\u0027).get(\u0027port_id\u0027):"},{"line_number":98,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":99,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":100,"context_line":"                # disassociate a internal port, the port_id should be null."}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_5c993acd","line":97,"range":{"start_line":97,"start_character":19,"end_line":97,"end_character":61},"updated":"2018-07-10 18:35:23.000000000","message":"this needs a check I guess, would kwargs have nested floatingip keys ?","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":94,"context_line":"        if event \u003d\u003d events.PRECOMMIT_UPDATE:"},{"line_number":95,"context_line":"            floatingip_id \u003d (kwargs.get(\u0027floatingip_id\u0027) or"},{"line_number":96,"context_line":"                             kwargs.get(\u0027floating_ip_id\u0027))"},{"line_number":97,"context_line":"            if not kwargs.get(\u0027floatingip\u0027).get(\u0027floatingip\u0027).get(\u0027port_id\u0027):"},{"line_number":98,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":99,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":100,"context_line":"                # disassociate a internal port, the port_id should be null."}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_44987868","line":97,"range":{"start_line":97,"start_character":19,"end_line":97,"end_character":61},"in_reply_to":"5f7c97a3_5c993acd","updated":"2018-07-11 03:37:52.000000000","message":"Here I explain both events:\n\nPRECOMMIT_DELETE:\nThe PRECOMMIT_DELETE event send out from:\nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1445\n\nBefore delete the floatingip_port, so the delete port event \u0027PRECOMMIT_DELETE\u0027 send out from:\nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1457\nexactly it\u0027s from:\nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/plugins/ml2/plugin.py#n1560\nSo for PRECOMMIT_DELETE event, the kwargs would be port\u003d{XXX}\nsee \nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/plugins/ml2/plugin.py#n1532\n\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\nPRECOMMIT_UPDATE:\nThe PRECOMMIT_UPDATE event send out from:\n(associate floatingip)\nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1400\n(disassociate floatingip)\nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1579\n\nFor disassociate floatingip, there must be a kwarg floatingip\u003d{\u0027floatingip\u0027: {\u0027fixed_port_id\u0027: XXX, \u0027fixed_ip_address\u0027: XXX, \u0027router_id\u0027: XXXX}, for details see\nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1573\n\nFor update floatingip(associate floatingip), there also must be a kwarg floatingip\u003d{\u0027floatingip\u0027: XXXX}, but this value is from the update request, it\u0027s from users API request body. For more details see:\nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1378\n\nSo for these 2 update operations, need to check if \u0027port_id\u0027 exists for verify the operation is associate/disassociate a floatingip.\n\nSo, if the code here make reviewers confused, I could add notes.\n\nHmm, I also found a exist bug here in L95-96, I should get the floatingip_id from floatingip_db. :)","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5f2be73dd68c34d5dfc4736be29cdfb176e3131c","unresolved":false,"context_lines":[{"line_number":115,"context_line":"                context, floatingip_id\u003dfloatingip_id)"},{"line_number":116,"context_line":"            if exist_pf_resources:"},{"line_number":117,"context_line":"                raise pf_exc.FipInUseByPortForwarding(id\u003dfloatingip_id)"},{"line_number":118,"context_line":"        _do_validate()"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"},{"line_number":121,"context_line":"                                        events.PRECOMMIT_DELETE])"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_1cc6629d","line":118,"range":{"start_line":118,"start_character":8,"end_line":118,"end_character":22},"updated":"2018-07-10 18:35:23.000000000","message":"this _do_validate is unconditionally called within, so i guess method is not required L113-L117 can be part of above method.\n\nanother concern I have is, is L89-107 really needed ? IMO, just L114-117 can handle the conflict ?","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":115,"context_line":"                context, floatingip_id\u003dfloatingip_id)"},{"line_number":116,"context_line":"            if exist_pf_resources:"},{"line_number":117,"context_line":"                raise pf_exc.FipInUseByPortForwarding(id\u003dfloatingip_id)"},{"line_number":118,"context_line":"        _do_validate()"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"},{"line_number":121,"context_line":"                                        events.PRECOMMIT_DELETE])"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_499e5107","line":118,"range":{"start_line":118,"start_character":8,"end_line":118,"end_character":22},"in_reply_to":"5f7c97a3_1cc6629d","updated":"2018-07-11 03:37:52.000000000","message":"The reason about _do_validate is part of the above func, as the lock param \"floatingip_id\", the above func can get floatingip_id, and the internal func _do_validate just use it for lock name. And put it inside is just for better understanding..\n\nFor L89-107, I think it\u0027s necessary, the expect is minimal effect toward API concurrency, so need to logic to check if it need to be locked. It\u0027s my opinion, any suggest/helps are welcome.","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5f2be73dd68c34d5dfc4736be29cdfb176e3131c","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    @db_api.retry_if_session_inactive()"},{"line_number":123,"context_line":"    def _process_port_request(self, resource, event, trigger, context,"},{"line_number":124,"context_line":"                              **kwargs):"},{"line_number":125,"context_line":"        # Deleteing floatingip will receive port resource with precommit_delete"},{"line_number":126,"context_line":"        # event, so just return, then check the request in"},{"line_number":127,"context_line":"        # _check_floatingip_request callback."},{"line_number":128,"context_line":"        if kwargs.get(\u0027port\u0027).get(\u0027device_owner\u0027).startswith("}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_5c35baa6","line":125,"range":{"start_line":125,"start_character":10,"end_line":125,"end_character":19},"updated":"2018-07-10 18:35:23.000000000","message":"Deleting","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    @db_api.retry_if_session_inactive()"},{"line_number":123,"context_line":"    def _process_port_request(self, resource, event, trigger, context,"},{"line_number":124,"context_line":"                              **kwargs):"},{"line_number":125,"context_line":"        # Deleteing floatingip will receive port resource with precommit_delete"},{"line_number":126,"context_line":"        # event, so just return, then check the request in"},{"line_number":127,"context_line":"        # _check_floatingip_request callback."},{"line_number":128,"context_line":"        if kwargs.get(\u0027port\u0027).get(\u0027device_owner\u0027).startswith("}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_4934114a","line":125,"range":{"start_line":125,"start_character":10,"end_line":125,"end_character":19},"in_reply_to":"5f7c97a3_5c35baa6","updated":"2018-07-11 03:37:52.000000000","message":"Done","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5f2be73dd68c34d5dfc4736be29cdfb176e3131c","unresolved":false,"context_lines":[{"line_number":159,"context_line":"                return"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"        remove_port_forwarding_list \u003d []"},{"line_number":162,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":163,"context_line":"            for pf_resource in pf_resources:"},{"line_number":164,"context_line":"                if str(pf_resource.internal_ip_address) in remove_ip_set:"},{"line_number":165,"context_line":"                    pf_objs \u003d pf.PortForwarding.get_objects("},{"line_number":166,"context_line":"                        context, floatingip_id\u003dpf_resource.floatingip_id)"},{"line_number":167,"context_line":"                    if len(pf_objs) \u003d\u003d 1:"},{"line_number":168,"context_line":"                        fip_obj \u003d router.FloatingIP.get_object("},{"line_number":169,"context_line":"                            context, id\u003dpf_resource.floatingip_id)"},{"line_number":170,"context_line":"                        fip_obj.update_fields({\u0027router_id\u0027: None})"},{"line_number":171,"context_line":"                        fip_obj.update()"},{"line_number":172,"context_line":"                    pf_resource.delete()"},{"line_number":173,"context_line":"                    remove_port_forwarding_list.append(pf_resource)"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"        self.push_api.push(context, remove_port_forwarding_list,"},{"line_number":176,"context_line":"                           rpc_events.DELETED)"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_1cac2286","line":173,"range":{"start_line":162,"start_character":8,"end_line":173,"end_character":67},"updated":"2018-07-10 18:35:23.000000000","message":"I have a feeling that this block should be under conditional\nif event \u003d\u003d event.PRECOMMIT_DELETE:\n\nI\u0027m imagining a case where things can go wrong for other case, this check will make sure delete doesn\u0027t happen for unintended event ?","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":159,"context_line":"                return"},{"line_number":160,"context_line":""},{"line_number":161,"context_line":"        remove_port_forwarding_list \u003d []"},{"line_number":162,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":163,"context_line":"            for pf_resource in pf_resources:"},{"line_number":164,"context_line":"                if str(pf_resource.internal_ip_address) in remove_ip_set:"},{"line_number":165,"context_line":"                    pf_objs \u003d pf.PortForwarding.get_objects("},{"line_number":166,"context_line":"                        context, floatingip_id\u003dpf_resource.floatingip_id)"},{"line_number":167,"context_line":"                    if len(pf_objs) \u003d\u003d 1:"},{"line_number":168,"context_line":"                        fip_obj \u003d router.FloatingIP.get_object("},{"line_number":169,"context_line":"                            context, id\u003dpf_resource.floatingip_id)"},{"line_number":170,"context_line":"                        fip_obj.update_fields({\u0027router_id\u0027: None})"},{"line_number":171,"context_line":"                        fip_obj.update()"},{"line_number":172,"context_line":"                    pf_resource.delete()"},{"line_number":173,"context_line":"                    remove_port_forwarding_list.append(pf_resource)"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"        self.push_api.push(context, remove_port_forwarding_list,"},{"line_number":176,"context_line":"                           rpc_events.DELETED)"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_2fe195d0","line":173,"range":{"start_line":162,"start_character":8,"end_line":173,"end_character":67},"in_reply_to":"5f7c97a3_1cac2286","updated":"2018-07-11 03:37:52.000000000","message":"OK, let me explain and discuss here. Any suggest and not-covered cases are welcome. Also please feel free to correct.\nIf we get event \"PRECOMMIT_DELETE\", so there are 2 situations here.\n\n1. The port didn\u0027t associate with any port forwarding.\n2. The port already associate with port forwarding.\n\nFor situation 1:\nHere maybe in race condition if there is a create port forwarding using that port.\n1) get pf_resources in L147 after create_fip_port_forwarding, then we can get the created pf_resource. Then do the following to delete port forwarding. Then if there any update fip or delete pf_resource in race condition, the high level api part for make sure to retry. more details see db_api.retry_db_error in neutron/api/v2/base.py\n2) can not get pf_resources in L147, that means the create fip port forwarding would be after port delete, so like above show, if they are in race condition, port had been delete(as port delete before create port forwarding), so the port forwaring creation must  raise DB StaleDataError, then the outside wrap \"db_api.retry_db_error\" in base API will retry and create failed as wish.\n\nFor situation 2:\nHere maybe in race condition if there is a create port forwarding using that port. [NOT CONFIDENT HERE, not sure if there is any other cases not covered]\n\nASSOCIATED PFs: A, B\nNEW CREATE: C\n\n1) get pf_resources in L147 after create_fip_port_forwarding, then we can get the created pf_resources (ABC), the expect result is deleting ABC, then we do the following. As currently, the fip is used by port forwarding resources, so the update fip will be hang by _check_floatingip_request. But at this moment, if there is a API request want to delete the last port forwarding of the association fip, and the last port forwrading is used by this port(internal neutron port). For this case, I think it\u0027s good, as both of them are delete the resource, what we want is to push the delete obj to agent side to refresh/remove the l3 agent did.\n\n2) get pf_resources in L147 before create_fip_port_forwarding,\nas delete port before than create port forwarding, so the create will failed after db retry.\n\nSo, need you advice here if it\u0027s not clear.","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5f2be73dd68c34d5dfc4736be29cdfb176e3131c","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":240,"context_line":"        port_forwarding[\u0027floatingip_id\u0027] \u003d floatingip_id"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"        # TODO(bzhao) A distributed lock is better."},{"line_number":243,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":244,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":245,"context_line":"                                external\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_9cbfd2a9","line":242,"range":{"start_line":242,"start_character":21,"end_line":242,"end_character":51},"updated":"2018-07-10 18:35:23.000000000","message":"why ? I guess little explanation in this case would help.","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":239,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":240,"context_line":"        port_forwarding[\u0027floatingip_id\u0027] \u003d floatingip_id"},{"line_number":241,"context_line":""},{"line_number":242,"context_line":"        # TODO(bzhao) A distributed lock is better."},{"line_number":243,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":244,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":245,"context_line":"                                external\u003dTrue)"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_8978e9f7","line":242,"range":{"start_line":242,"start_character":21,"end_line":242,"end_character":51},"in_reply_to":"5f7c97a3_9cbfd2a9","updated":"2018-07-11 03:37:52.000000000","message":"Yeah, thanks, but I explain it on the previous patchset, I think it\u0027s necessary to add it now. :)\n\nExplains, copy from the previous patchset for good understanding.\n\nAs like the functions \"_check_floatingip_request\" registered events, and \"_do_create_if_parallel\" in create_floating_ip_port_forwarding function. So here, we found the several cases that will hit race issues.\n\nassociate \"Free\" fip and create port forwarding may in race condition, as we associate fip with a neutron port and create port forwarding based on this fip in concurrent way, both of them will success.\ndelete \"Free\" fip and create port forwarding based on this fip, and during create port forwarding, the db delete the record after the logic check the fip exist. Then will gerate the port forwarding obj, as the port forwarding obj will reread the fip_obj, so this will hit 500.\nSo for forbidding this kind race condition, my approach is to serialize to process towards a same fip by a external lock. Why external lock? As a neutron server instance will setup several api workers to process the api requests, if we just use the internal lock(which is not external), the different workers still face the race issue, as the internal lock can be shared with the single worker, the other workers don\u0027t know whether the lock exists. So for a single neutron server instance, I introduce the external lock, but for the case which deploy multiple neutron server instance, the distributed lock is better(That\u0027s why I wrote TODO).\n\nDB code not cover this, as the DB code are different, in current design, the fip_obj and portforwarding obj are 2 seperate obj, port forwarding obj just want to query the floatingip info during genating the port forwrading obj.\nSo they just commit the record into their db table.\n\nNotes from the past comments, I think it\u0027s good to help to understand :\n_check_floatingip_request func subscribed fip events.PRECOMMIT_UPDATE and events.PRECOMMIT_DELETE. A \"free\" floatingip means this floatingip is not associated with a Neutron port for 1-1 DNAT, in the traditional way.\nFor update, the PRECOMMIT_UPDATE will be notified in http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1399 and the payload would be http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1257 .\n\nFor delete, the PRECOMMIT_DELETE will be notified in \nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1439 , and the payload is http://git.openstack.org/cgit/openstack/neutron/tree/neutron/plugins/ml2/plugin.py#n1530\n\nSo the _check_floatingip_request treat the difference by update and delete cases, get the necessary value by different event, but need to concern that, both of these cases the \"floating_ip_id\" won\u0027t be None,  think about it.  And for your said, deleting a free floatingip, the fip PRECOMMIT_DELETE will be raised before delete its floating_port_id, and the port\u0027s device_id must be floatingip_id, then it will still do _do_validate, which locked by the floatingip_id.","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"0647fdea234d464efaadaa1e8b3c08675177f1f8","unresolved":false,"context_lines":[{"line_number":244,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":245,"context_line":"                                external\u003dTrue)"},{"line_number":246,"context_line":"        def _do_create_if_parallel():"},{"line_number":247,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":248,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":249,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":250,"context_line":"                if fip_obj:"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_8051bc0f","line":247,"updated":"2018-07-10 23:33:01.000000000","message":"I have to confess that I am having a hard time understanding exactly how the lock is going to protect us from race conditions. I would like to walk through one of those race conditions. Let\u0027s imagine we don\u0027t have the protection of L243-245. Let\u0027s say that we enter the with block and start a write DB transaction. In L248 we read the floating IP with uuid zhaobo-floating-ip. Now a race condition hits us. What happens now step by step? What goes wrong?","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c1a32cbe5d65fab157837d1a44cafe61c3987fdb","unresolved":false,"context_lines":[{"line_number":244,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":245,"context_line":"                                external\u003dTrue)"},{"line_number":246,"context_line":"        def _do_create_if_parallel():"},{"line_number":247,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":248,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":249,"context_line":"                                                       id\u003dfloatingip_id)"},{"line_number":250,"context_line":"                if fip_obj:"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_aaa6f3ab","line":247,"in_reply_to":"5f7c97a3_8051bc0f","updated":"2018-07-11 03:37:52.000000000","message":"Thanks, Miguel. I will try my best to explain here.\nFirst, if no L243-245, here.\nENV: a exist free floatingip(not associate with any ports/port forwarding resources)\nCASE:\n1) Associated FIPX with PORT B\n2) Create port forwarding with FIPX and PORT A.\n\nThen we just do 1) 2) in cmdline quickly, both of them will success. It violates the port forwarding design, which the FIP can be used in 1 way, (1:1 fip or 1:N port forwarding). And some strange situation here, the floatingip list can see the fip associated with port B, we also can see the port forwarding with port A, and the router_id of fip is overrided.\n\nupdate_fip:\nhttp://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1378\n\nThe real result from function insight is above. Then let me deep into.\nHere we create a free floatingip, and its uuid is \"zhaobo-floating-ip\".\n2 API requests:\n1\u003e update floatnigip with port A(associated fip)\n2\u003e create floatingip port forwarding with port B\n\nStart in L248, here we get the fip_obj, the assumption here the both requests are not done and not update the db yet. So in L248, we get the same result with http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1381 .\n\nThen begin the 2 seperate processes, one is here L275, the other is http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1387 \nWe start the db session, and finding the router_id based on readed fip_obj. Generating the pf obj for preparing commit the record, also we need to verify that the fip is \"free\" and need to bind the fip with the router we selected, so we need to make sure if the fip_obj.router_id is None and not associated with any neutron port, update the router_id of fip_obj. \nThen whatever update_floatingip and create_fip_port_forwarding exit the with block and commit the updated FIP, both are successful.\n\nAlso, looks very similar to the delete fip cases.\nENV:\nwe have a free floatingip\n1\u003e delete fipX\n2\u003e create fipX port forwarding\n\nAs before commit port forwarding we must make sure the fip exist, if the delete fip before create port forwarding, the por tforwarding.create() will be break as the fip record is None.","commit_id":"0a3eb26b9ef49701535ee9c614b6113b672c9c21"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"129f548a462513a9661f91a311b78a24242bcc6b","unresolved":false,"context_lines":[{"line_number":95,"context_line":"            fip_db \u003d kwargs.get(\u0027floatingip_db\u0027)"},{"line_number":96,"context_line":"            floatingip_id \u003d fip_db.id"},{"line_number":97,"context_line":"            # Here the key-value must contain a floatingip param, and the value"},{"line_number":98,"context_line":"            # must a dict with key \u0027floatingip\u0027."},{"line_number":99,"context_line":"            if not kwargs[\u0027floatingip\u0027][\u0027floatingip\u0027].get(\u0027port_id\u0027):"},{"line_number":100,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":101,"context_line":"                # The port_id field is a must-option. But if a floatingip"}],"source_content_type":"text/x-python","patch_set":13,"id":"5f7c97a3_a8497a2f","line":98,"range":{"start_line":98,"start_character":14,"end_line":98,"end_character":18},"updated":"2018-07-18 09:18:21.000000000","message":"nitty nit: must be a dict","commit_id":"4df1c66af61c3da2986c0ac5c1a4465a3f8095c9"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"041bef7f7ea68b864564db930b1e200e06945666","unresolved":false,"context_lines":[{"line_number":95,"context_line":"            fip_db \u003d kwargs.get(\u0027floatingip_db\u0027)"},{"line_number":96,"context_line":"            floatingip_id \u003d fip_db.id"},{"line_number":97,"context_line":"            # Here the key-value must contain a floatingip param, and the value"},{"line_number":98,"context_line":"            # must a dict with key \u0027floatingip\u0027."},{"line_number":99,"context_line":"            if not kwargs[\u0027floatingip\u0027][\u0027floatingip\u0027].get(\u0027port_id\u0027):"},{"line_number":100,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":101,"context_line":"                # The port_id field is a must-option. But if a floatingip"}],"source_content_type":"text/x-python","patch_set":13,"id":"5f7c97a3_adfc153f","line":98,"range":{"start_line":98,"start_character":14,"end_line":98,"end_character":18},"in_reply_to":"5f7c97a3_a8497a2f","updated":"2018-07-19 02:24:21.000000000","message":"Done","commit_id":"4df1c66af61c3da2986c0ac5c1a4465a3f8095c9"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"129f548a462513a9661f91a311b78a24242bcc6b","unresolved":false,"context_lines":[{"line_number":102,"context_line":"                # disassociate a internal port, the port_id should be null."},{"line_number":103,"context_line":"                LOG.debug(\u0027Skip check for floatingip %s, as the update \u0027"},{"line_number":104,"context_line":"                          \u0027request does not contain port_id.\u0027, floatingip_id)"},{"line_number":105,"context_line":"                return"},{"line_number":106,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"},{"line_number":107,"context_line":"            floatingip_id \u003d kwargs.get(\u0027port\u0027).get(\u0027device_id\u0027)"},{"line_number":108,"context_line":"        if not floatingip_id:"}],"source_content_type":"text/x-python","patch_set":13,"id":"5f7c97a3_28da4a49","line":105,"updated":"2018-07-18 09:18:21.000000000","message":"I will probably have to deploy this on devstack and check to understand exactly but I have a question now.\nImagine the case that there is FIP associated to port and then I create port forwarding - I need to give internal IP address to which forwarding will be done, right? So if now I will update floating IP and disassociate it from port, port_id will be None, right? If so shouldn\u0027t this be forbidden as it\u0027s still \"in use\" by port forwarding?","commit_id":"4df1c66af61c3da2986c0ac5c1a4465a3f8095c9"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"13f6426b0b334c319a9c9f1b2729957e66213882","unresolved":false,"context_lines":[{"line_number":102,"context_line":"                # disassociate a internal port, the port_id should be null."},{"line_number":103,"context_line":"                LOG.debug(\u0027Skip check for floatingip %s, as the update \u0027"},{"line_number":104,"context_line":"                          \u0027request does not contain port_id.\u0027, floatingip_id)"},{"line_number":105,"context_line":"                return"},{"line_number":106,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"},{"line_number":107,"context_line":"            floatingip_id \u003d kwargs.get(\u0027port\u0027).get(\u0027device_id\u0027)"},{"line_number":108,"context_line":"        if not floatingip_id:"}],"source_content_type":"text/x-python","patch_set":13,"id":"5f7c97a3_02ce302b","line":105,"in_reply_to":"5f7c97a3_10b682dd","updated":"2018-07-20 10:24:39.000000000","message":"Ok. I think it\u0027s clear now for me. Thanks.","commit_id":"4df1c66af61c3da2986c0ac5c1a4465a3f8095c9"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"041bef7f7ea68b864564db930b1e200e06945666","unresolved":false,"context_lines":[{"line_number":102,"context_line":"                # disassociate a internal port, the port_id should be null."},{"line_number":103,"context_line":"                LOG.debug(\u0027Skip check for floatingip %s, as the update \u0027"},{"line_number":104,"context_line":"                          \u0027request does not contain port_id.\u0027, floatingip_id)"},{"line_number":105,"context_line":"                return"},{"line_number":106,"context_line":"        elif event \u003d\u003d events.PRECOMMIT_DELETE:"},{"line_number":107,"context_line":"            floatingip_id \u003d kwargs.get(\u0027port\u0027).get(\u0027device_id\u0027)"},{"line_number":108,"context_line":"        if not floatingip_id:"}],"source_content_type":"text/x-python","patch_set":13,"id":"5f7c97a3_10b682dd","line":105,"in_reply_to":"5f7c97a3_28da4a49","updated":"2018-07-19 02:24:21.000000000","message":"\u003e I will probably have to deploy this on devstack and check to\n \u003e understand exactly but I have a question now.\n\n\nHmmm, let me explain here.\nThe fip resource now can be used in 2 ways, 1 way is the generic floatingip 1:1 DNAT(this kind internal neutron port own the whole priority for the listened protocol port), the other way is used for port forwarding 1:N DNAT. That means if a fip associated a port already, it can not be used for creating port forwardings. So if we want to create the port forwarding, we must to make sure the fip is \"free\"(not associated with any ports for generic fip usage which is 1:1 DNAT). So this is the backend case.\n\nI answer inline for your question.\n\nQ:\n \u003e Imagine the case that there is FIP associated to port and then I\n \u003e create port forwarding - I need to give internal IP address to\n \u003e which forwarding will be done, right? \nA: So if the fip had been not \"free\", we can not create port forwarding on this fip resource.\n\nQ:\nSo if now I will update\n \u003e floating IP and disassociate it from port, port_id will be None,\n \u003e right? If so shouldn\u0027t this be forbidden as it\u0027s still \"in use\" by\n \u003e port forwarding?\nA: Hmmm, I guess you may ask the question about disassociate fip and create port forwarding at the same time. \n\nYou are right, disassociate fip from a port, that means we request the PUT fip with Null port_id, and in existing logic it  will set None to \u0027fixed_port_id\u0027, \u0027fixed_ip_address\u0027 and \u0027router_id\u0027, then it will sendout a PRECOMMIT_UPDATE event.(http://git.openstack.org/cgit/openstack/neutron/tree/neutron/db/l3_db.py#n1584)\n\nThen here 2 cases:\n1. disassociate fip comes before creating port forwarding\n2. disassociate fip comes after creating port forwarding\n\nFor case 1:\nThis case would be success, as during disassociate fip, and it send out PRECOMMIT_UPDATE event, this check \"_check_floatingip_request\" is just return. Then creating port forwarding will be created on a already \"free\" fip.\n\nFor case 2:\nwe cannot create port forwarding if fip is not \"free\".\n disassociate fip will success.","commit_id":"4df1c66af61c3da2986c0ac5c1a4465a3f8095c9"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"129f548a462513a9661f91a311b78a24242bcc6b","unresolved":false,"context_lines":[{"line_number":255,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":256,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":257,"context_line":"                                external\u003dTrue)"},{"line_number":258,"context_line":"        def _do_create_if_parallel():"},{"line_number":259,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":260,"context_line":"                fip_obj \u003d router.FloatingIP.get_object(context,"},{"line_number":261,"context_line":"                                                       id\u003dfloatingip_id)"}],"source_content_type":"text/x-python","patch_set":13,"id":"5f7c97a3_280b2a7c","line":258,"range":{"start_line":258,"start_character":23,"end_line":258,"end_character":25},"updated":"2018-07-18 09:18:21.000000000","message":"\"if\"? shoudn\u0027t be \"in\"?","commit_id":"4df1c66af61c3da2986c0ac5c1a4465a3f8095c9"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"13f6426b0b334c319a9c9f1b2729957e66213882","unresolved":false,"context_lines":[{"line_number":146,"context_line":"        update_ip_set \u003d set()"},{"line_number":147,"context_line":"        for update_fixed_ip in update_fixed_ips:"},{"line_number":148,"context_line":"            if netaddr.IPNetwork("},{"line_number":149,"context_line":"                    update_fixed_ip.get(\u0027ip_address\u0027)).version \u003d\u003d 4:"},{"line_number":150,"context_line":"                update_ip_set.add(update_fixed_ip.get(\u0027ip_address\u0027))"},{"line_number":151,"context_line":"        if not update_ip_set:"},{"line_number":152,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_7a58cc87","line":149,"range":{"start_line":149,"start_character":66,"end_line":149,"end_character":67},"updated":"2018-07-20 10:24:39.000000000","message":"nit: there is constant for this in neutron-lib","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"23376236ac05069524a37d5105f75d9844fb1248","unresolved":false,"context_lines":[{"line_number":146,"context_line":"        update_ip_set \u003d set()"},{"line_number":147,"context_line":"        for update_fixed_ip in update_fixed_ips:"},{"line_number":148,"context_line":"            if netaddr.IPNetwork("},{"line_number":149,"context_line":"                    update_fixed_ip.get(\u0027ip_address\u0027)).version \u003d\u003d 4:"},{"line_number":150,"context_line":"                update_ip_set.add(update_fixed_ip.get(\u0027ip_address\u0027))"},{"line_number":151,"context_line":"        if not update_ip_set:"},{"line_number":152,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_d558bc59","line":149,"range":{"start_line":149,"start_character":66,"end_line":149,"end_character":67},"in_reply_to":"5f7c97a3_7a58cc87","updated":"2018-07-22 08:45:26.000000000","message":"Thanks, will done.","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"f7ae5714f4ee74b4e2da224b403bc0f5860af110","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        # the floatingip request handed by server instance A,"},{"line_number":258,"context_line":"        # the port forwarding request handed by server instance B, then"},{"line_number":259,"context_line":"        # the lock external lock is useless."},{"line_number":260,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":261,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":262,"context_line":"                                external\u003dTrue)"},{"line_number":263,"context_line":"        def _do_create_if_parallel():"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_156954bf","line":260,"updated":"2018-07-22 00:22:13.000000000","message":"I still have my doubts about using this lock here. I will do some testing today and tomorrow","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"9b36f97b6ca1bc26738715d1fce34527ca1e29cb","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        # the floatingip request handed by server instance A,"},{"line_number":258,"context_line":"        # the port forwarding request handed by server instance B, then"},{"line_number":259,"context_line":"        # the lock external lock is useless."},{"line_number":260,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":261,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":262,"context_line":"                                external\u003dTrue)"},{"line_number":263,"context_line":"        def _do_create_if_parallel():"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_35a9f08e","line":260,"in_reply_to":"5f7c97a3_156954bf","updated":"2018-07-22 03:20:24.000000000","message":"Maybe I need to be educated:\n\nI can see how this lock will serialize the execution of two or more threads that call create_floatingip_port_forwarding. According to the documentation (https://docs.openstack.org/oslo.concurrency/latest/user/index.html#locking-a-function-local-to-a-process-as-well-as-across-process): \"Once decorated later callers of this function will be able to call into this method and the contract that two threads (or any two processes) will not enter this function at the same time will be upheld.\"\n\nHowever, I cannot see how this lock is going to prevent the concurrent execution of create_floatingip_port_forwarding and update_flotingip in the L3 plugin, which is what we are trying to accomplish according to the functional test in this patch:https://review.openstack.org/#/c/574673/15/neutron/tests/functional/services/portforwarding/test_port_forwarding.py@193. Please explain","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"23376236ac05069524a37d5105f75d9844fb1248","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        # the floatingip request handed by server instance A,"},{"line_number":258,"context_line":"        # the port forwarding request handed by server instance B, then"},{"line_number":259,"context_line":"        # the lock external lock is useless."},{"line_number":260,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":261,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":262,"context_line":"                                external\u003dTrue)"},{"line_number":263,"context_line":"        def _do_create_if_parallel():"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_b863b5ab","line":260,"in_reply_to":"5f7c97a3_35a9f08e","updated":"2018-07-22 08:45:26.000000000","message":"Oh no, You are our expert and leader. Don\u0027t laugh at me. :).\n\nYes, I didn\u0027t see the doc, I just saw the func doc in code. I copy it here:\n\ndef synchronized(name, lock_file_prefix\u003dNone, external\u003dFalse, lock_path\u003dNone,\n                 semaphores\u003dNone, delay\u003d0.01):\n    \"\"\"Synchronization decorator.\n\n    Decorating a method like so::\n\n        @synchronized(\u0027mylock\u0027)\n        def foo(self, *args):\n           ...\n\n    ensures that only one thread will execute the foo method at a time.\n\n    Different methods can share the same lock::\n\n        @synchronized(\u0027mylock\u0027)\n        def foo(self, *args):\n           ...\n\n        @synchronized(\u0027mylock\u0027)\n        def bar(self, *args):\n           ...\n\n    This way only one of either foo or bar can be executing at a time.\n\n    .. versionchanged:: 0.3\n       Added *delay* and *semaphores* optional parameter.\n    \"\"\"\n\nIf pass \"external\" here, it must be like a file lock, that\u0027s my understanding, and it will file some temp file in current Filesystem, maybe in /var/temp/(that\u0027s based on your configuration), then the other threads/processes will check if there is a temp file named \"name\" and \"prefix\" in the specific directory. If yes, the other won\u0027t run in the method and wait until the func which get the current file lock had done.\n\nI would share something to you about this feature. If we remove the lock code here, setup the neutron server, we create a \"free\" floatingip. We can use curl to create port forwarding, use CLI to associate floatingip. If we exec them at short time, then both of them will success. That\u0027s unexpected, as a floatingip can not be used for 1:1 DNAT and port forwarding at the same time. I think you may test it for the case I said if this is not a good way to prevent it. As \"Lock the funcs which process the same floatingip resources in API layer\", the details is Lock the update floatingip to check if there is port forwarding associate the floatingip, and lock the create port forwarding to make sure the floatingip is not in-use. So my thought is leave a validate func(receive FLOATINGIP PRECOMMIT_UPDATE) in update floatingip rpc functions for check if floatingip has port forwardings association, and make create port forwarding share the same external lock with the same floatingip_id if they are process the same floatingip resource. Then the 2 funcs will process in serial way, any fit this case, 1 of them will be failure.\n\nFor the function test, I\u0027m trying to simulate the case as much as possible. Make 2 concurrent calls (1 from l3_plugin update floatingip, the other create port forwarding from port forwarding plugin), run them and make sure 1 of them will fail, not both success. If any not clear, we can talk and make it better. Please feel free to correct. :)","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"5fa7ba2e8492d7a2a3f796cd3006af463416912d","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        # the floatingip request handed by server instance A,"},{"line_number":258,"context_line":"        # the port forwarding request handed by server instance B, then"},{"line_number":259,"context_line":"        # the lock external lock is useless."},{"line_number":260,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":261,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":262,"context_line":"                                external\u003dTrue)"},{"line_number":263,"context_line":"        def _do_create_if_parallel():"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_ef587d59","line":260,"in_reply_to":"5f7c97a3_7be75747","updated":"2018-07-23 03:12:19.000000000","message":"Thanks Miguel, I know revision_number could help the case for preventing to update the same db record in concurrent session. But I still have doubt towards it. I had deep into debug in more concurrent cases which is db in race condition, that\u0027s ture the db will raise the StaleError for the next time db retry like I explain before. We can use revision_number for most cases. But a odd case I hit, not very concurrent execute curl a port forwarding and associate fip in real env, they are success in both side, till to I lock them, every thing is OK..Maybe we miss something, but I think it\u0027s better to move this patch after the whole patch series. I agree to move this to the end. And let me test more if we remove the lock, and see what\u0027s going on.","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"3a5f1dc18ddc8146e4d3a93d9f70fc3d69cfa4da","unresolved":false,"context_lines":[{"line_number":257,"context_line":"        # the floatingip request handed by server instance A,"},{"line_number":258,"context_line":"        # the port forwarding request handed by server instance B, then"},{"line_number":259,"context_line":"        # the lock external lock is useless."},{"line_number":260,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":261,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":262,"context_line":"                                external\u003dTrue)"},{"line_number":263,"context_line":"        def _do_create_if_parallel():"}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_7be75747","line":260,"in_reply_to":"5f7c97a3_b863b5ab","updated":"2018-07-22 13:00:50.000000000","message":"Hi Zhaobo,\n\nActually, you (and Slawek) are right and I am wrong. I wrote my comment at 10pm last night my time. Now that it is early Sunday morning and I had a good night sleep, I can see that I missed the way the lock is also being acquired by the callback in L117 above and that is going to achieve synchronization with floating ips updates and deletes.\n\nHaving said that, I still remain reluctant to move ahead with this lock based mechanism to prevent race conditions. Floating IPs have standard attributes: https://github.com/openstack/neutron/blob/master/neutron/db/models/l3.py#L70. One of those standard attributes is revision_number. Two years ago Kevin Benton added it to, among other things, prevent this type of race conditions. Please look at https://review.openstack.org/#/c/328185, https://review.openstack.org/#/c/303966 and http://docs.sqlalchemy.org/en/latest/orm/versioning.html. Why is it that the revision_number standard attribute is not helping us to prevent two threads updating the same floating ip in parallel? Maybe we could tweak the functional test in this patch and see whether this is the case or not. What do you think?","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"13f6426b0b334c319a9c9f1b2729957e66213882","unresolved":false,"context_lines":[{"line_number":260,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":261,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":262,"context_line":"                                external\u003dTrue)"},{"line_number":263,"context_line":"        def _do_create_if_parallel():"},{"line_number":264,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":265,"context_line":"                fip_obj \u003d self._get_fip_obj(context, floatingip_id)"},{"line_number":266,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_5ae390a0","line":263,"range":{"start_line":263,"start_character":23,"end_line":263,"end_character":25},"updated":"2018-07-20 10:24:39.000000000","message":"You didn\u0027t answer me for my last comment, should it be \"if\" and not \"in\" here?","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"23376236ac05069524a37d5105f75d9844fb1248","unresolved":false,"context_lines":[{"line_number":260,"context_line":"        @lockutils.synchronized(floatingip_id + \u0027-update-or-delete\u0027,"},{"line_number":261,"context_line":"                                lock_file_prefix\u003dLOCK_PREFIX,"},{"line_number":262,"context_line":"                                external\u003dTrue)"},{"line_number":263,"context_line":"        def _do_create_if_parallel():"},{"line_number":264,"context_line":"            with db_api.context_manager.writer.using(context):"},{"line_number":265,"context_line":"                fip_obj \u003d self._get_fip_obj(context, floatingip_id)"},{"line_number":266,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"5f7c97a3_55134c69","line":263,"range":{"start_line":263,"start_character":23,"end_line":263,"end_character":25},"in_reply_to":"5f7c97a3_5ae390a0","updated":"2018-07-22 08:45:26.000000000","message":"Oh, sorry. Maybe I miss it. :(. The function name shows my thought which is \"This function won\u0027t always be processed in parallel way, just during update/delete the same floatingip resource with creating port forwarding\". So I introdused \"if\" there are multiple processes wants the same floatingip. Any suggest? How about \"if_in_parallel\"?","commit_id":"4ece54664ce43f96fda1c08c9b86eec2d4956b0b"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"33dcf734f4fcfc948481ce3c430d86dae422df90","unresolved":false,"context_lines":[{"line_number":131,"context_line":""},{"line_number":132,"context_line":"        exist_pf_resources \u003d pf.PortForwarding.get_objects("},{"line_number":133,"context_line":"            context, floatingip_id\u003dfloatingip_id)"},{"line_number":134,"context_line":"        if exist_pf_resources:"},{"line_number":135,"context_line":"            raise pf_exc.FipInUseByPortForwarding(id\u003dfloatingip_id)"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"}],"source_content_type":"text/x-python","patch_set":16,"id":"5f7c97a3_2863c647","line":134,"updated":"2018-07-23 10:15:39.000000000","message":"Yes! I see that if the floating IP has port forwardings, port association is not allowed :-)","commit_id":"8e4d6ebf38d6ed09c3e7adb8fbc3f0272dd0d887"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1e46e9b614e9273e97591a53f70c503dc0d56204","unresolved":false,"context_lines":[{"line_number":131,"context_line":""},{"line_number":132,"context_line":"        exist_pf_resources \u003d pf.PortForwarding.get_objects("},{"line_number":133,"context_line":"            context, floatingip_id\u003dfloatingip_id)"},{"line_number":134,"context_line":"        if exist_pf_resources:"},{"line_number":135,"context_line":"            raise pf_exc.FipInUseByPortForwarding(id\u003dfloatingip_id)"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"}],"source_content_type":"text/x-python","patch_set":16,"id":"5f7c97a3_e64dfe3c","line":134,"in_reply_to":"5f7c97a3_2863c647","updated":"2018-07-23 12:27:04.000000000","message":";-). Ha. yes. Thanks, Miguel.","commit_id":"8e4d6ebf38d6ed09c3e7adb8fbc3f0272dd0d887"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1e46e9b614e9273e97591a53f70c503dc0d56204","unresolved":false,"context_lines":[{"line_number":261,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":262,"context_line":"        port_forwarding[\u0027floatingip_id\u0027] \u003d floatingip_id"},{"line_number":263,"context_line":""},{"line_number":264,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":265,"context_line":"            fip_obj \u003d self._get_fip_obj(context, floatingip_id)"},{"line_number":266,"context_line":""},{"line_number":267,"context_line":"            router_id \u003d self._find_a_router_for_fip_port_forwarding("}],"source_content_type":"text/x-python","patch_set":16,"id":"5f7c97a3_46d152ca","line":264,"range":{"start_line":264,"start_character":0,"end_line":264,"end_character":58},"updated":"2018-07-23 12:27:04.000000000","message":"I test in the whole afternoon. Yeah, seems that we don\u0027t use lock, it also works. I think it lacks the associate func with l3 plugin side, but here, I add _check_floatingip_request rpc callback validation, it works. :).\n\nAnd the staleError will raise in the case,\nIf debug and wait before execute L287-288, at this moment, I associate a port with the same fip, after associate sucess, I continue to process(because the fip update process by other worker). It will rasie StaleError in L287-288, then the whole process will retry in the high level wrapper as I explain before.","commit_id":"8e4d6ebf38d6ed09c3e7adb8fbc3f0272dd0d887"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"cb1ff20ff92dd462500ec281d6086da65817fdec","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            floatingip_id \u003d fip_db.id"},{"line_number":117,"context_line":"            # Here the key-value must contain a floatingip param, and the value"},{"line_number":118,"context_line":"            # must a dict with key \u0027floatingip\u0027."},{"line_number":119,"context_line":"            if not kwargs[\u0027floatingip\u0027][\u0027floatingip\u0027].get(\u0027port_id\u0027):"},{"line_number":120,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":121,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":122,"context_line":"                # disassociate a internal port, the port_id should be null."}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_eddb5277","line":119,"updated":"2018-07-25 20:50:19.000000000","message":"I\u0027m not sure if I understand it correctly.\nIn comment in L109-112 You are saying that if there is PUT request (so update) then port_id must exists if it\u0027s floating ip update but will not be available in port forwarding update, right?\nIf yes, why here You are checking with get() this port_id? You will get None in case if port_id is not kwargs and also in case if port_id is None - which, according to comment below is the case when disassociate of FIP is done.\n\nSo shouldn\u0027t You check here if \"port_id\" is in this dict? Not only check with get() if it\u0027s not None?","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"3cf75033bd44e54bacec6e8c170e83d8d6510e85","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            floatingip_id \u003d fip_db.id"},{"line_number":117,"context_line":"            # Here the key-value must contain a floatingip param, and the value"},{"line_number":118,"context_line":"            # must a dict with key \u0027floatingip\u0027."},{"line_number":119,"context_line":"            if not kwargs[\u0027floatingip\u0027][\u0027floatingip\u0027].get(\u0027port_id\u0027):"},{"line_number":120,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":121,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":122,"context_line":"                # disassociate a internal port, the port_id should be null."}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_34e5ee07","line":119,"in_reply_to":"5f7c97a3_eddb5277","updated":"2018-07-27 10:48:41.000000000","message":";-). Let me explain here.","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"ce47dc05574413ab1e2a0301b9f2bdb8e3ae4969","unresolved":false,"context_lines":[{"line_number":116,"context_line":"            floatingip_id \u003d fip_db.id"},{"line_number":117,"context_line":"            # Here the key-value must contain a floatingip param, and the value"},{"line_number":118,"context_line":"            # must a dict with key \u0027floatingip\u0027."},{"line_number":119,"context_line":"            if not kwargs[\u0027floatingip\u0027][\u0027floatingip\u0027].get(\u0027port_id\u0027):"},{"line_number":120,"context_line":"                # Only care about the associate floatingip cases."},{"line_number":121,"context_line":"                # The port_id field is a must-option. But if a floatingip"},{"line_number":122,"context_line":"                # disassociate a internal port, the port_id should be null."}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_dd2b8498","line":119,"in_reply_to":"5f7c97a3_eddb5277","updated":"2018-07-27 05:13:50.000000000","message":"L109-112, the PUT request is \"associate/disassociate fip\", both of them will contain keyvalue which is \u0027port_id\u0027: \u003cNeutron port id\u003e / \u0027port_id\u0027: None .. A \"Free\" floatingip which will be used by port forwarding must be not associated with any Neutron port in previous way(1:1 DNAT), also in previous way, if a port is associated with a fip, the fip will contains a port_id field. So it\u0027s not \"Free\" for port forwarding.\n\nThen for question 1, https://developer.openstack.org/api-ref/network/v2/index.html#update-floating-ip the port-id is a positional argument. The reason why use get(), is we update fip \"description\" field.. Then not \u0027port_id\u0027 in kwargs, that also no need to check, just return..","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"cb1ff20ff92dd462500ec281d6086da65817fdec","unresolved":false,"context_lines":[{"line_number":150,"context_line":"        # are owned by other tenants."},{"line_number":151,"context_line":"        if not context.is_admin:"},{"line_number":152,"context_line":"            context \u003d context.elevated()"},{"line_number":153,"context_line":"        port_id \u003d kwargs.get(\u0027port\u0027).get(\u0027id\u0027)"},{"line_number":154,"context_line":"        update_fixed_ips \u003d kwargs.get(\u0027port\u0027).get(\u0027fixed_ips\u0027)"},{"line_number":155,"context_line":"        update_ip_set \u003d set()"},{"line_number":156,"context_line":"        for update_fixed_ip in update_fixed_ips:"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_6d3e628b","line":153,"updated":"2018-07-25 20:50:19.000000000","message":"can it be that \u0027port\u0027 is not kwargs? or \"id\" is not in \"port\" dict? If no, why use get(), get it with [\u0027port\u0027][\u0027id\u0027] simple.","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"ce47dc05574413ab1e2a0301b9f2bdb8e3ae4969","unresolved":false,"context_lines":[{"line_number":150,"context_line":"        # are owned by other tenants."},{"line_number":151,"context_line":"        if not context.is_admin:"},{"line_number":152,"context_line":"            context \u003d context.elevated()"},{"line_number":153,"context_line":"        port_id \u003d kwargs.get(\u0027port\u0027).get(\u0027id\u0027)"},{"line_number":154,"context_line":"        update_fixed_ips \u003d kwargs.get(\u0027port\u0027).get(\u0027fixed_ips\u0027)"},{"line_number":155,"context_line":"        update_ip_set \u003d set()"},{"line_number":156,"context_line":"        for update_fixed_ip in update_fixed_ips:"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_c5716aad","line":153,"in_reply_to":"5f7c97a3_6d3e628b","updated":"2018-07-27 05:13:50.000000000","message":"yeah, this looks odd here, I think refactor maybe help. There is still a \u0027port\u0027 keyvalue.","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"cb1ff20ff92dd462500ec281d6086da65817fdec","unresolved":false,"context_lines":[{"line_number":275,"context_line":"            self._check_router_match(context, fip_obj,"},{"line_number":276,"context_line":"                                     router_id, port_forwarding)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"            if fip_obj.fixed_port_id:"},{"line_number":279,"context_line":"                raise lib_l3_exc.FloatingIPPortAlreadyAssociated("},{"line_number":280,"context_line":"                    port_id\u003dport_forwarding[\u0027internal_port_id\u0027],"},{"line_number":281,"context_line":"                    fip_id\u003dfip_obj.id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_add0fa2b","line":278,"updated":"2018-07-25 20:50:19.000000000","message":"small optimization: You can do this just after L265 and fail fast if it\u0027s necessary, right?","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"3cf75033bd44e54bacec6e8c170e83d8d6510e85","unresolved":false,"context_lines":[{"line_number":275,"context_line":"            self._check_router_match(context, fip_obj,"},{"line_number":276,"context_line":"                                     router_id, port_forwarding)"},{"line_number":277,"context_line":""},{"line_number":278,"context_line":"            if fip_obj.fixed_port_id:"},{"line_number":279,"context_line":"                raise lib_l3_exc.FloatingIPPortAlreadyAssociated("},{"line_number":280,"context_line":"                    port_id\u003dport_forwarding[\u0027internal_port_id\u0027],"},{"line_number":281,"context_line":"                    fip_id\u003dfip_obj.id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_d4011a6f","line":278,"in_reply_to":"5f7c97a3_add0fa2b","updated":"2018-07-27 10:48:41.000000000","message":"Correct, thanks. I will move it. :)","commit_id":"28c186fe36857ee366d2d231639110187863855b"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"822a4b95ab1946fb0cbb5c924da71e2030b07011","unresolved":false,"context_lines":[{"line_number":102,"context_line":"            result_dict[apidef.COLLECTION_NAME] \u003d port_forwarding_result"},{"line_number":103,"context_line":"        return result_dict"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    @registry.receives(resources.FLOATING_IP, [events.PRECOMMIT_UPDATE,"},{"line_number":106,"context_line":"                                               events.PRECOMMIT_DELETE])"},{"line_number":107,"context_line":"    def _check_floatingip_request(self, resource, event, trigger, context,"},{"line_number":108,"context_line":"                                  **kwargs):"},{"line_number":109,"context_line":"        # We only support the \"free\" floatingip to be associated with"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_da76f7a3","line":106,"range":{"start_line":105,"start_character":46,"end_line":106,"end_character":71},"updated":"2018-07-30 17:18:12.000000000","message":"since these events are consumed by other stadium projects and plugins, I believe this should be highest priority for callback, I doubt having default priority may end up different order of execution than expected.\n\nNote: that\u0027s just my concern need atm, need to cleared if others confirm it is a concern then we can tackle that on followup patch, don\u0027t want to block this patch.","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"943721c95cd1fc4dada7aeed0a52ad4ef7408378","unresolved":false,"context_lines":[{"line_number":102,"context_line":"            result_dict[apidef.COLLECTION_NAME] \u003d port_forwarding_result"},{"line_number":103,"context_line":"        return result_dict"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    @registry.receives(resources.FLOATING_IP, [events.PRECOMMIT_UPDATE,"},{"line_number":106,"context_line":"                                               events.PRECOMMIT_DELETE])"},{"line_number":107,"context_line":"    def _check_floatingip_request(self, resource, event, trigger, context,"},{"line_number":108,"context_line":"                                  **kwargs):"},{"line_number":109,"context_line":"        # We only support the \"free\" floatingip to be associated with"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_3634dfde","line":106,"range":{"start_line":105,"start_character":46,"end_line":106,"end_character":71},"in_reply_to":"5f7c97a3_66a94a76","updated":"2018-07-31 01:51:05.000000000","message":"Miguel is right. Thanks for explain ;-)","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"7a88cda82c9a579fe22dba465fb72a5e4877e078","unresolved":false,"context_lines":[{"line_number":102,"context_line":"            result_dict[apidef.COLLECTION_NAME] \u003d port_forwarding_result"},{"line_number":103,"context_line":"        return result_dict"},{"line_number":104,"context_line":""},{"line_number":105,"context_line":"    @registry.receives(resources.FLOATING_IP, [events.PRECOMMIT_UPDATE,"},{"line_number":106,"context_line":"                                               events.PRECOMMIT_DELETE])"},{"line_number":107,"context_line":"    def _check_floatingip_request(self, resource, event, trigger, context,"},{"line_number":108,"context_line":"                                  **kwargs):"},{"line_number":109,"context_line":"        # We only support the \"free\" floatingip to be associated with"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_66a94a76","line":106,"range":{"start_line":105,"start_character":46,"end_line":106,"end_character":71},"in_reply_to":"5f7c97a3_da76f7a3","updated":"2018-07-30 22:09:47.000000000","message":"At this point, we don\u0027t have a reason to believe we need to process port forwardings before or after any other extension or service plugin. In my test environments everything works fine. So in my opinion it is better to leave this callbacks registrations as they are","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"822a4b95ab1946fb0cbb5c924da71e2030b07011","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        if exist_pf_resources:"},{"line_number":134,"context_line":"            raise pf_exc.FipInUseByPortForwarding(id\u003dfloatingip_id)"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"},{"line_number":137,"context_line":"                                        events.PRECOMMIT_DELETE])"},{"line_number":138,"context_line":"    @db_api.retry_if_session_inactive()"},{"line_number":139,"context_line":"    def _process_port_request(self, resource, event, trigger, context,"},{"line_number":140,"context_line":"                              **kwargs):"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_5adf4737","line":137,"range":{"start_line":136,"start_character":3,"end_line":137,"end_character":65},"updated":"2018-07-30 17:18:12.000000000","message":"this is consumed in neutron itself,\n\n[1]. https://github.com/openstack/neutron/blob/master/neutron/db/l3_db.py#L1466\n\n[2].https://github.com/openstack/neutron/blob/master/neutron/services/trunk/plugin.py#L404\n\nfortunately, we have priority mechanism which can be used to control the order of execution.","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"7a88cda82c9a579fe22dba465fb72a5e4877e078","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        if exist_pf_resources:"},{"line_number":134,"context_line":"            raise pf_exc.FipInUseByPortForwarding(id\u003dfloatingip_id)"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"},{"line_number":137,"context_line":"                                        events.PRECOMMIT_DELETE])"},{"line_number":138,"context_line":"    @db_api.retry_if_session_inactive()"},{"line_number":139,"context_line":"    def _process_port_request(self, resource, event, trigger, context,"},{"line_number":140,"context_line":"                              **kwargs):"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_c6ddbe13","line":137,"range":{"start_line":136,"start_character":3,"end_line":137,"end_character":65},"in_reply_to":"5f7c97a3_5adf4737","updated":"2018-07-30 22:09:47.000000000","message":"At this point, we don\u0027t have a reason to believe we need to process port forwardings before or after any other extension or service plugin. In my test environments everything works fine. So in my opinion it is better to leave this callbacks registrations as they are","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"f1827a124e0b55a5ad3c8de7e63b756522bca745","unresolved":false,"context_lines":[{"line_number":133,"context_line":"        if exist_pf_resources:"},{"line_number":134,"context_line":"            raise pf_exc.FipInUseByPortForwarding(id\u003dfloatingip_id)"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"    @registry.receives(resources.PORT, [events.AFTER_UPDATE,"},{"line_number":137,"context_line":"                                        events.PRECOMMIT_DELETE])"},{"line_number":138,"context_line":"    @db_api.retry_if_session_inactive()"},{"line_number":139,"context_line":"    def _process_port_request(self, resource, event, trigger, context,"},{"line_number":140,"context_line":"                              **kwargs):"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_8c31255b","line":137,"range":{"start_line":136,"start_character":3,"end_line":137,"end_character":65},"in_reply_to":"5f7c97a3_c6ddbe13","updated":"2018-07-30 22:13:14.000000000","message":"thanks for detail, I guess we can proceed now with this and tackle it later if issue arises.","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"56284ee473d1f8193bf8279acab4565387bebcd9","unresolved":false,"context_lines":[{"line_number":149,"context_line":"        # context to check the floatingip or port forwarding resources if they"},{"line_number":150,"context_line":"        # are owned by other tenants."},{"line_number":151,"context_line":"        if not context.is_admin:"},{"line_number":152,"context_line":"            context \u003d context.elevated()"},{"line_number":153,"context_line":"        port_id \u003d kwargs[\u0027port\u0027][\u0027id\u0027]"},{"line_number":154,"context_line":"        update_fixed_ips \u003d kwargs[\u0027port\u0027][\u0027fixed_ips\u0027]"},{"line_number":155,"context_line":"        update_ip_set \u003d set()"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_9d6959f8","line":152,"updated":"2018-07-30 18:34:37.000000000","message":"nit: guess this could have been done after L161 since it\u0027s not used until after then, and we might return early.","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"7a88cda82c9a579fe22dba465fb72a5e4877e078","unresolved":false,"context_lines":[{"line_number":149,"context_line":"        # context to check the floatingip or port forwarding resources if they"},{"line_number":150,"context_line":"        # are owned by other tenants."},{"line_number":151,"context_line":"        if not context.is_admin:"},{"line_number":152,"context_line":"            context \u003d context.elevated()"},{"line_number":153,"context_line":"        port_id \u003d kwargs[\u0027port\u0027][\u0027id\u0027]"},{"line_number":154,"context_line":"        update_fixed_ips \u003d kwargs[\u0027port\u0027][\u0027fixed_ips\u0027]"},{"line_number":155,"context_line":"        update_ip_set \u003d set()"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_51d3aad3","line":152,"in_reply_to":"5f7c97a3_9d6959f8","updated":"2018-07-30 22:09:47.000000000","message":"+1","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"943721c95cd1fc4dada7aeed0a52ad4ef7408378","unresolved":false,"context_lines":[{"line_number":149,"context_line":"        # context to check the floatingip or port forwarding resources if they"},{"line_number":150,"context_line":"        # are owned by other tenants."},{"line_number":151,"context_line":"        if not context.is_admin:"},{"line_number":152,"context_line":"            context \u003d context.elevated()"},{"line_number":153,"context_line":"        port_id \u003d kwargs[\u0027port\u0027][\u0027id\u0027]"},{"line_number":154,"context_line":"        update_fixed_ips \u003d kwargs[\u0027port\u0027][\u0027fixed_ips\u0027]"},{"line_number":155,"context_line":"        update_ip_set \u003d set()"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_76a1f7f5","line":152,"in_reply_to":"5f7c97a3_9d6959f8","updated":"2018-07-31 01:51:05.000000000","message":"Done","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"56284ee473d1f8193bf8279acab4565387bebcd9","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        if event \u003d\u003d events.AFTER_UPDATE:"},{"line_number":173,"context_line":"            remove_ip_set \u003d used_ip_set - update_ip_set"},{"line_number":174,"context_line":"            if not remove_ip_set:"},{"line_number":175,"context_line":"                return"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        remove_port_forwarding_list \u003d []"},{"line_number":178,"context_line":"        with db_api.context_manager.writer.using(context):"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_60a7f20a","line":175,"updated":"2018-07-30 18:34:37.000000000","message":"Is this block indented too much?  For example, if remove_ip_set is empty, then L180 will never match, and remove_port_forwarding_list will be empty.  Then do you still want to do the push on L191 if that is the case?  Maybe you do in the delete case?","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"943721c95cd1fc4dada7aeed0a52ad4ef7408378","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        if event \u003d\u003d events.AFTER_UPDATE:"},{"line_number":173,"context_line":"            remove_ip_set \u003d used_ip_set - update_ip_set"},{"line_number":174,"context_line":"            if not remove_ip_set:"},{"line_number":175,"context_line":"                return"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        remove_port_forwarding_list \u003d []"},{"line_number":178,"context_line":"        with db_api.context_manager.writer.using(context):"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_d6880b6d","line":175,"in_reply_to":"5f7c97a3_11fc520b","updated":"2018-07-31 01:51:05.000000000","message":"@Miguel, thanks Miguel.\n\n@Brain, That\u0027s right as Miguel helping to explain. We return early if no port forwarding need to be deleted. This func for update port with \"fixed_ip\" or delete port. We do deleting port forwarding in this func, no other cases here.\nFor L172-175, that means we hit the UPDATE event, and if no port forwarding need to be removed, RETURN.\nIf we hit the DELETE event, and the port acctually owns some port forwardings(its fixed ip owns ipv4 version), that means we pass L160-161 and L165-166. Then we defualt set the remove_ip_set as used_ip_set, and set it used_ip_set - update_ip_set if we hit AFTER_UPDATE. Then we delete them.\nFor remove_ip_set is empty case, whatever we hit DELETE/UPDATE event, we will still return and do nothing in L160-161. So the case you mentioned is not exist.","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"7a88cda82c9a579fe22dba465fb72a5e4877e078","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        if event \u003d\u003d events.AFTER_UPDATE:"},{"line_number":173,"context_line":"            remove_ip_set \u003d used_ip_set - update_ip_set"},{"line_number":174,"context_line":"            if not remove_ip_set:"},{"line_number":175,"context_line":"                return"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        remove_port_forwarding_list \u003d []"},{"line_number":178,"context_line":"        with db_api.context_manager.writer.using(context):"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_11fc520b","line":175,"in_reply_to":"5f7c97a3_60a7f20a","updated":"2018-07-30 22:09:47.000000000","message":"Although it wouldn\u0027t hurt to un-indent L174-175, it is fine as it is, because if it is not an update (i.e., it is a delete) you are going to remove the port forwardings and you know you have port forwardings to delete because of L165-166 and L171","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"8795d706cb9f67d2b1e90667769e7010816f4f90","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        if event \u003d\u003d events.AFTER_UPDATE:"},{"line_number":173,"context_line":"            remove_ip_set \u003d used_ip_set - update_ip_set"},{"line_number":174,"context_line":"            if not remove_ip_set:"},{"line_number":175,"context_line":"                return"},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"        remove_port_forwarding_list \u003d []"},{"line_number":178,"context_line":"        with db_api.context_manager.writer.using(context):"}],"source_content_type":"text/x-python","patch_set":22,"id":"5f7c97a3_59bc1eda","line":175,"in_reply_to":"5f7c97a3_d6880b6d","updated":"2018-07-31 14:53:21.000000000","message":"Thanks for the explanation, it makes sense now.  If you push an update it would be good to put a comment near this code to explain we do want to fall through in that case.","commit_id":"64769b011c3a18315e00ddf0cda19ed72a90995c"}],"neutron/tests/functional/services/portforwarding/test_port_forwarding.py":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"af9a4436573d7da6211a6d961377cc87b7427916","unresolved":false,"context_lines":[{"line_number":25,"context_line":"from neutron.tests.unit.plugins.ml2 import base as ml2_test_base"},{"line_number":26,"context_line":"from oslo_config import cfg"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"LOCK_PATH \u003d \u0027/opt/stack/data/neutron/lock\u0027"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"class PortForwardingTestCaseBase(ml2_test_base.ML2TestFramework):"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_082a732e","line":28,"updated":"2018-06-28 18:18:45.000000000","message":"This will cause problems when tests run concurrently, as well as leaving behind files.  It should be something like $state_path/neutron/lock, or maybe just set it in neutron/tests/base.py where state_path is set.  I\u0027m surprised it\u0027s needed at all - what\u0027s failing without it?","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"24d8154d7cd95c3cab1a47d0e5f8433d05adb721","unresolved":false,"context_lines":[{"line_number":25,"context_line":"from neutron.tests.unit.plugins.ml2 import base as ml2_test_base"},{"line_number":26,"context_line":"from oslo_config import cfg"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"LOCK_PATH \u003d \u0027/opt/stack/data/neutron/lock\u0027"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"class PortForwardingTestCaseBase(ml2_test_base.ML2TestFramework):"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_aac24952","line":28,"in_reply_to":"5f7c97a3_082a732e","updated":"2018-06-29 09:40:05.000000000","message":"Oh, yeah. It\u0027s true that hard code is bad here. Thanks for pointing out and kind suggestion. The reason that the my devstack store the lock file into that path. So....","commit_id":"8bfca3a8311218066e166ad604e743b8450457fd"}],"neutron/tests/unit/services/portforwarding/test_pf_plugin.py":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"986f5153b16fb6eb29cdbc0e3febfce3f906b01f","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import mock"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"from neutron_lib import context"},{"line_number":19,"context_line":"from neutron_lib import exceptions as lib_exc"},{"line_number":20,"context_line":"from neutron_lib.exceptions import l3 as lib_l3_exc"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_0de80079","side":"PARENT","line":17,"updated":"2018-07-26 10:53:18.000000000","message":"Nit:\nUnrelated changes may cause rebase/cherry-pick/revert conflicts, please remove.","commit_id":"a103ec22ee8af79d6f1c03fea87f4908d64a533f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"ce47dc05574413ab1e2a0301b9f2bdb8e3ae4969","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"import mock"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"from neutron_lib import context"},{"line_number":19,"context_line":"from neutron_lib import exceptions as lib_exc"},{"line_number":20,"context_line":"from neutron_lib.exceptions import l3 as lib_l3_exc"}],"source_content_type":"text/x-python","patch_set":19,"id":"5f7c97a3_3d24f8c2","side":"PARENT","line":17,"in_reply_to":"5f7c97a3_0de80079","updated":"2018-07-27 05:13:50.000000000","message":"Done","commit_id":"a103ec22ee8af79d6f1c03fea87f4908d64a533f"}]}
