)]}'
{"neutron/plugins/ml2/drivers/type_tunnel.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"e73a165eb06232f530bd5c39898e1aab6d234e12","unresolved":true,"context_lines":[{"line_number":181,"context_line":"        self.load_network_segment_ranges(ctx\u003dadmin_context)"},{"line_number":182,"context_line":"        self._sync_allocations(ctx\u003dadmin_context)"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def load_network_segment_ranges(self, ctx\u003dNone):"},{"line_number":185,"context_line":"        \"\"\"Cache the effective tunnel ranges from the DB."},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"        Read-only and idempotent, so every API worker must call it."}],"source_content_type":"text/x-python","patch_set":2,"id":"dc8d74d4_05351d4a","line":184,"range":{"start_line":184,"start_character":8,"end_line":184,"end_character":35},"updated":"2026-09-15 07:59:47.000000000","message":"Why this new method that is wrapping a call to `_get_network_segment_ranges_from_db`? \n\nThat would make sense, for example, if you make this method an abstract method in `SegmentTypeDriver`, now you are using it in `managers` for the segmented types.","commit_id":"80bb54efc504a5b42bdac693b14ecc4cb6985134"}],"neutron/plugins/ml2/managers.py":[{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"e73a165eb06232f530bd5c39898e1aab6d234e12","unresolved":true,"context_lines":[{"line_number":201,"context_line":"                LOG.info(\"Initializing driver network segment range support \""},{"line_number":202,"context_line":"                         \"for type \u0027%s\u0027\", network_type)"},{"line_number":203,"context_line":"                driver.obj.initialize_network_segment_range_support(start_time)"},{"line_number":204,"context_line":"            else:"},{"line_number":205,"context_line":"                # The writes above happen once, but every worker needs the"},{"line_number":206,"context_line":"                # effective ranges cached locally."},{"line_number":207,"context_line":"                driver.obj.load_network_segment_ranges()"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"    def _add_network_segment(self, context, network_id, segment,"},{"line_number":210,"context_line":"                             segment_index\u003d0):"}],"source_content_type":"text/x-python","patch_set":2,"id":"c2aaf69c_d4802d2c","line":207,"range":{"start_line":204,"start_character":12,"end_line":207,"end_character":56},"updated":"2026-09-15 07:59:47.000000000","message":"That could lead to a race condition between the first worker updating the DB and the other workers reading it.\n\nWe need another way to load the tunnel/segment ranges.\n\nAfter checking both the tunneled and the VLAN driver, we can see that both do almost the same:\n* We call `initialize`.\n** If network segment range is not enabled, we call `sync_allocations`\n* Then we call `initialize_network_segment_range_support`, that is executed by the first worker. That introduces the de-synchronization between worker 1 and others.\n\nThe goal of this patch is to correctly have the tunnel/vlan ranges for each driver. This is now stored in `self._tunnel_ranges` and `self._network_vlan_ranges`. These two variables are used only once outside the initialization process, in the `get_network_segment_ranges` method.\n\nHowever this is not needed: the method `get_network_segment_ranges` calls `ranges \u003d self._get_network_segment_ranges_from_db()` every time `get_network_segment_ranges` is called thus we don\u0027t need to make this call here.","commit_id":"80bb54efc504a5b42bdac693b14ecc4cb6985134"}]}
