)]}'
{"nova/network/neutronv2/api.py":[{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"1e4fc365e4f7c01aa72acfd9f84eb8a7cc9c6ce0","unresolved":false,"context_lines":[{"line_number":1688,"context_line":""},{"line_number":1689,"context_line":"        # In that case we should repopulate ports from the state of"},{"line_number":1690,"context_line":"        # Neutron."},{"line_number":1691,"context_line":"        if not port_ids:"},{"line_number":1692,"context_line":"            port_ids \u003d current_neutron_port_map.keys()"},{"line_number":1693,"context_line":""},{"line_number":1694,"context_line":"        for port_id in port_ids:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a2ca52d_e5dae6e7","side":"PARENT","line":1691,"updated":"2015-10-15 15:25:02.000000000","message":"FWIW, this only helped in the case when the cache happened to be empty - if there was issue with a missing interface among many, or a duplication of interfaces - the cache would remain corrupted forever.\n\nAnd Mark\u0027s patch ( https://review.openstack.org/#/c/194597 ) ensures we:\n\n1) do not try to overwrite the results of another network API method call by putting both method execution and cache update within the lock - https://review.openstack.org/#/c/194597/4/nova/network/base_api.py\n\n2) have the latest state of the cache (it\u0027s retrieved within the lock) before we update it based on the info received from Neutron (https://review.openstack.org/#/c/194597/4/nova/network/neutronv2/api.py)","commit_id":"b0013d93ffeaed53bc28d9558def26bdb7041ed7"},{"author":{"_account_id":5511,"name":"Nikola Dipanov","email":"ndipanov@redhat.com","username":"ndipanov"},"change_message_id":"228a2c25a58fa5d3ec7b82d21945b88779cbd9f3","unresolved":false,"context_lines":[{"line_number":1620,"context_line":""},{"line_number":1621,"context_line":"        # In that case we should repopulate ports from the state of"},{"line_number":1622,"context_line":"        # Neutron."},{"line_number":1623,"context_line":"        if not port_ids:"},{"line_number":1624,"context_line":"            port_ids \u003d current_neutron_port_map.keys()"},{"line_number":1625,"context_line":""},{"line_number":1626,"context_line":"        for port_id in port_ids:"}],"source_content_type":"text/x-python","patch_set":2,"id":"da6ed579_69a54145","side":"PARENT","line":1623,"range":{"start_line":1623,"start_character":8,"end_line":1623,"end_character":24},"updated":"2016-01-14 12:24:06.000000000","message":"So currently if we got here and there are no port_ids it means that none were passed in to the _get_insatnce_nwinfo AND that none were found from concurrent nw_info cache updates that could have happened before we grabbed the lock (this is what _gather_port_ids_and_networks does).\n\nBased on that - when the event update manages to grab the nw-info lock before the allocate_for_instance from the boot thread gets here, without this - it will indeed update the nw_info_cache to an empty list which is wrong in the general case, but not a problem if we are racing with the boot request (since now there are locks), since those ports would have been passed in to this call in the boot thread and would have ended up in the DB once it completes.\n\nBased on the above (and in case I am correct) - I am mildly against removing this.\n\nThe reason this removal fixes duplicate entries is because we don\u0027t actually check for those in the boot tread in case the event thread managed to grab the lock before us, and this ensures that they are never there. \n\nIn the case when they are there and the event thread grabbed the lock before the boot thread - we already have all the ports that we created in nw_info which we get from _gaher_port_ids_and_networks, which also merges them with the ports we passed in (same ones) - hence the duplicates.\n\nIMHO - a less harmful fix is https://review.openstack.org/#/c/252565/ as it does not completely cripple the event thread (which will still not do the right thing if it\u0027s not racing with the boot request afaict as it will never add the port to NW info really)","commit_id":"de22fd22b5fb81db47179f7bb6b66b8b90626592"}],"nova/tests/unit/network/test_neutronv2.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"97472c8685abce8fe0abcd259883f6cb7805e2dc","unresolved":false,"context_lines":[{"line_number":780,"context_line":"                     \u0027tenant_id\u0027: iface[\u0027network\u0027][\u0027meta\u0027][\u0027tenant_id\u0027]}"},{"line_number":781,"context_line":"                    for iface in ifaces]"},{"line_number":782,"context_line":"        if networks is None:"},{"line_number":783,"context_line":"            if ifaces:"},{"line_number":784,"context_line":"                self.moxed_client.list_networks("},{"line_number":785,"context_line":"                    id\u003dnet_ids).AndReturn({\u0027networks\u0027: nets})"},{"line_number":786,"context_line":"            else:"},{"line_number":787,"context_line":"                non_shared_nets \u003d ["},{"line_number":788,"context_line":"                    {\u0027id\u0027: iface[\u0027network\u0027][\u0027id\u0027],"},{"line_number":789,"context_line":"                     \u0027name\u0027: iface[\u0027network\u0027][\u0027label\u0027],"},{"line_number":790,"context_line":"                     \u0027tenant_id\u0027: iface[\u0027network\u0027][\u0027meta\u0027][\u0027tenant_id\u0027]}"},{"line_number":791,"context_line":"                    for iface in ifaces if not iface[\u0027shared\u0027]]"},{"line_number":792,"context_line":"                shared_nets \u003d ["},{"line_number":793,"context_line":"                    {\u0027id\u0027: iface[\u0027network\u0027][\u0027id\u0027],"},{"line_number":794,"context_line":"                     \u0027name\u0027: iface[\u0027network\u0027][\u0027label\u0027],"},{"line_number":795,"context_line":"                     \u0027tenant_id\u0027: iface[\u0027network\u0027][\u0027meta\u0027][\u0027tenant_id\u0027]}"},{"line_number":796,"context_line":"                    for iface in ifaces if iface[\u0027shared\u0027]]"},{"line_number":797,"context_line":"                self.moxed_client.list_networks("},{"line_number":798,"context_line":"                    shared\u003dFalse,"},{"line_number":799,"context_line":"                    tenant_id\u003dself.instance[\u0027project_id\u0027]"},{"line_number":800,"context_line":"                        ).AndReturn({\u0027networks\u0027: non_shared_nets})"},{"line_number":801,"context_line":"                self.moxed_client.list_networks("},{"line_number":802,"context_line":"                    shared\u003dTrue).AndReturn({\u0027networks\u0027: shared_nets})"},{"line_number":803,"context_line":"        else:"},{"line_number":804,"context_line":"            networks \u003d networks + ["},{"line_number":805,"context_line":"                dict(id\u003diface[\u0027network\u0027][\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba63e191_39093bde","line":802,"range":{"start_line":783,"start_character":12,"end_line":802,"end_character":69},"updated":"2016-01-19 16:58:59.000000000","message":"yuck! TestNeutronV2 needs to die in a fire with all of the scaffolding it does.","commit_id":"8694c1619d774bb8a6c23ed4c0f33df2084849bc"}]}
