)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"fc3098811536fb10fce2bd3505e8bf6cc11b627f","unresolved":false,"context_lines":[{"line_number":21,"context_line":"When the new agent takes over the network scheduled to it, it won\u0027t be"},{"line_number":22,"context_line":"able to find a port to reuse so that an extra port might need to be"},{"line_number":23,"context_line":"created. This leads to two issues:"},{"line_number":24,"context_line":"1) an extra port is created and never deleted;"},{"line_number":25,"context_line":"2) the extra port creation may fail if there are no available IP"},{"line_number":26,"context_line":"addresses."},{"line_number":27,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3f79a3b5_3384740b","line":24,"range":{"start_line":24,"start_character":0,"end_line":24,"end_character":46},"updated":"2018-10-08 06:53:22.000000000","message":"IMO, it\u0027s better add a test case to see if such extra port exists or not?","commit_id":"f58db2e9326d1cdc92425ea90b6ece004a572f1a"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"69bdc7b8a42d51afbda656a9c3807689dd155dfb","unresolved":false,"context_lines":[{"line_number":21,"context_line":"When the new agent takes over the network scheduled to it, it won\u0027t be"},{"line_number":22,"context_line":"able to find a port to reuse so that an extra port might need to be"},{"line_number":23,"context_line":"created. This leads to two issues:"},{"line_number":24,"context_line":"1) an extra port is created and never deleted;"},{"line_number":25,"context_line":"2) the extra port creation may fail if there are no available IP"},{"line_number":26,"context_line":"addresses."},{"line_number":27,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3f79a3b5_3a97993c","line":24,"range":{"start_line":24,"start_character":0,"end_line":24,"end_character":46},"in_reply_to":"3f79a3b5_3384740b","updated":"2018-10-17 07:13:29.000000000","message":"Agree, but this should not be covered at the UT level. The extra port is created by the following code logic: [1] -\u003e [2] -\u003e [3] -\u003e [4] -\u003e [5] -\u003e [6]. Since in [6], the device_id may have already been updated by the old agent, then it wouldn\u0027t be able to find in the existing port list an ID that matches the required (dhcphost_uuid-network_id) nor a reserved one. So an extra one would be created in this case.\n\n[1] https://github.com/openstack/neutron/blob/master/neutron/db/agentschedulers_db.py#L245\n[2] https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L360\n[3] https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L279\n[4] https://github.com/openstack/neutron/blob/master/neutron/agent/dhcp/agent.py#L299\n[5] https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L223\n[6] https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L1397","commit_id":"f58db2e9326d1cdc92425ea90b6ece004a572f1a"}],"neutron/api/rpc/handlers/dhcp_rpc.py":[{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"5feeabb68ecb55635cea4f88a96f9f2c1decdf8b","unresolved":false,"context_lines":[{"line_number":279,"context_line":"        # Filter the eligible dhcp_agent on the host hosting the given network"},{"line_number":280,"context_line":"        agents \u003d plugin.get_dhcp_agents_hosting_networks(context, [network_id],"},{"line_number":281,"context_line":"                                                         hosts\u003d[host])"},{"line_number":282,"context_line":"        return bool(len(agents) !\u003d 0)"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"    @oslo_messaging.expected_exceptions(exceptions.IpAddressGenerationFailure)"},{"line_number":285,"context_line":"    @db_api.retry_db_errors"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_30111c54","line":282,"range":{"start_line":282,"start_character":15,"end_line":282,"end_character":19},"updated":"2018-10-03 13:27:12.000000000","message":"this conversion is useless","commit_id":"d8565bb80617d334c6e84b8c69d79defbfe2586a"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"d905f53049cab94fe6649c9a81a0e344de7c5586","unresolved":false,"context_lines":[{"line_number":279,"context_line":"        # Filter the eligible dhcp_agent on the host hosting the given network"},{"line_number":280,"context_line":"        agents \u003d plugin.get_dhcp_agents_hosting_networks(context, [network_id],"},{"line_number":281,"context_line":"                                                         hosts\u003d[host])"},{"line_number":282,"context_line":"        return bool(len(agents) !\u003d 0)"},{"line_number":283,"context_line":""},{"line_number":284,"context_line":"    @oslo_messaging.expected_exceptions(exceptions.IpAddressGenerationFailure)"},{"line_number":285,"context_line":"    @db_api.retry_db_errors"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_ca1f896f","line":282,"range":{"start_line":282,"start_character":15,"end_line":282,"end_character":19},"in_reply_to":"3f79a3b5_30111c54","updated":"2018-10-08 05:58:35.000000000","message":"Done","commit_id":"d8565bb80617d334c6e84b8c69d79defbfe2586a"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"5feeabb68ecb55635cea4f88a96f9f2c1decdf8b","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                old_port[\u0027device_id\u0027] !\u003d utils.get_dhcp_agent_device_id("},{"line_number":299,"context_line":"                    network_id, host)):"},{"line_number":300,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"},{"line_number":301,"context_line":"            else:"},{"line_number":302,"context_line":"                if not self._is_dhcp_agent_bound_to_network(plugin, context,"},{"line_number":303,"context_line":"                                                            host, network_id):"},{"line_number":304,"context_line":"                    # To avoid the race condition when a DHCP agent tried to"},{"line_number":305,"context_line":"                    # update a DHCP port after its ownership has already been"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_f0d404ec","line":302,"range":{"start_line":301,"start_character":12,"end_line":302,"end_character":18},"updated":"2018-10-03 13:27:12.000000000","message":"elif?","commit_id":"d8565bb80617d334c6e84b8c69d79defbfe2586a"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"d905f53049cab94fe6649c9a81a0e344de7c5586","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                old_port[\u0027device_id\u0027] !\u003d utils.get_dhcp_agent_device_id("},{"line_number":299,"context_line":"                    network_id, host)):"},{"line_number":300,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"},{"line_number":301,"context_line":"            else:"},{"line_number":302,"context_line":"                if not self._is_dhcp_agent_bound_to_network(plugin, context,"},{"line_number":303,"context_line":"                                                            host, network_id):"},{"line_number":304,"context_line":"                    # To avoid the race condition when a DHCP agent tried to"},{"line_number":305,"context_line":"                    # update a DHCP port after its ownership has already been"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_4d32b3c2","line":302,"range":{"start_line":301,"start_character":12,"end_line":302,"end_character":18},"in_reply_to":"3f79a3b5_f0d404ec","updated":"2018-10-08 05:58:35.000000000","message":"Done","commit_id":"d8565bb80617d334c6e84b8c69d79defbfe2586a"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"5feeabb68ecb55635cea4f88a96f9f2c1decdf8b","unresolved":false,"context_lines":[{"line_number":304,"context_line":"                    # To avoid the race condition when a DHCP agent tried to"},{"line_number":305,"context_line":"                    # update a DHCP port after its ownership has already been"},{"line_number":306,"context_line":"                    # removed and given to another DHCP agent."},{"line_number":307,"context_line":"                    LOG.debug(\"Host %(host)s tried to update DHCP port \""},{"line_number":308,"context_line":"                              \"%(port_id)s on network %(network_id)s. \""},{"line_number":309,"context_line":"                              \"However, the DHCP agent is not bound to that \""},{"line_number":310,"context_line":"                              \"network.\","}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_90fd906e","line":307,"range":{"start_line":307,"start_character":24,"end_line":307,"end_character":29},"updated":"2018-10-03 13:27:12.000000000","message":"LOG.exception","commit_id":"d8565bb80617d334c6e84b8c69d79defbfe2586a"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"d905f53049cab94fe6649c9a81a0e344de7c5586","unresolved":false,"context_lines":[{"line_number":304,"context_line":"                    # To avoid the race condition when a DHCP agent tried to"},{"line_number":305,"context_line":"                    # update a DHCP port after its ownership has already been"},{"line_number":306,"context_line":"                    # removed and given to another DHCP agent."},{"line_number":307,"context_line":"                    LOG.debug(\"Host %(host)s tried to update DHCP port \""},{"line_number":308,"context_line":"                              \"%(port_id)s on network %(network_id)s. \""},{"line_number":309,"context_line":"                              \"However, the DHCP agent is not bound to that \""},{"line_number":310,"context_line":"                              \"network.\","}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_ad42673a","line":307,"range":{"start_line":307,"start_character":24,"end_line":307,"end_character":29},"in_reply_to":"3f79a3b5_90fd906e","updated":"2018-10-08 05:58:35.000000000","message":"Thanks for the advice!\nLOG.exception seems too much IMO. LOG.debug looks more appropriate in this case since there is nothing for the user to really do.\nI\u0027ll leave this open for now and see if any further objection.","commit_id":"d8565bb80617d334c6e84b8c69d79defbfe2586a"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"dde357266a14fac11ae8666792f0ff56a227088d","unresolved":false,"context_lines":[{"line_number":304,"context_line":"                    # To avoid the race condition when a DHCP agent tried to"},{"line_number":305,"context_line":"                    # update a DHCP port after its ownership has already been"},{"line_number":306,"context_line":"                    # removed and given to another DHCP agent."},{"line_number":307,"context_line":"                    LOG.debug(\"Host %(host)s tried to update DHCP port \""},{"line_number":308,"context_line":"                              \"%(port_id)s on network %(network_id)s. \""},{"line_number":309,"context_line":"                              \"However, the DHCP agent is not bound to that \""},{"line_number":310,"context_line":"                              \"network.\","}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_3328f431","line":307,"range":{"start_line":307,"start_character":24,"end_line":307,"end_character":29},"in_reply_to":"3f79a3b5_ad42673a","updated":"2018-10-08 06:45:05.000000000","message":"Ok","commit_id":"d8565bb80617d334c6e84b8c69d79defbfe2586a"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"fc3098811536fb10fce2bd3505e8bf6cc11b627f","unresolved":false,"context_lines":[{"line_number":276,"context_line":"    def _is_dhcp_agent_bound_to_network(self, plugin, context, host,"},{"line_number":277,"context_line":"                                        network_id):"},{"line_number":278,"context_line":"        \"\"\"Check whether a DHCP agent (host) is bound to a network.\"\"\""},{"line_number":279,"context_line":"        # Filter the eligible dhcp_agent on the host hosting the given network"},{"line_number":280,"context_line":"        agents \u003d plugin.get_dhcp_agents_hosting_networks(context, [network_id],"},{"line_number":281,"context_line":"                                                         hosts\u003d[host])"},{"line_number":282,"context_line":"        return len(agents) !\u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_9399c87b","line":279,"range":{"start_line":279,"start_character":8,"end_line":279,"end_character":78},"updated":"2018-10-08 06:53:22.000000000","message":"Seems redundant to the doc string.","commit_id":"f58db2e9326d1cdc92425ea90b6ece004a572f1a"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"69bdc7b8a42d51afbda656a9c3807689dd155dfb","unresolved":false,"context_lines":[{"line_number":276,"context_line":"    def _is_dhcp_agent_bound_to_network(self, plugin, context, host,"},{"line_number":277,"context_line":"                                        network_id):"},{"line_number":278,"context_line":"        \"\"\"Check whether a DHCP agent (host) is bound to a network.\"\"\""},{"line_number":279,"context_line":"        # Filter the eligible dhcp_agent on the host hosting the given network"},{"line_number":280,"context_line":"        agents \u003d plugin.get_dhcp_agents_hosting_networks(context, [network_id],"},{"line_number":281,"context_line":"                                                         hosts\u003d[host])"},{"line_number":282,"context_line":"        return len(agents) !\u003d 0"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_17d63628","line":279,"range":{"start_line":279,"start_character":8,"end_line":279,"end_character":78},"in_reply_to":"3f79a3b5_9399c87b","updated":"2018-10-17 07:13:29.000000000","message":"Done","commit_id":"f58db2e9326d1cdc92425ea90b6ece004a572f1a"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"fc3098811536fb10fce2bd3505e8bf6cc11b627f","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                old_port[\u0027device_id\u0027] !\u003d utils.get_dhcp_agent_device_id("},{"line_number":299,"context_line":"                    network_id, host)):"},{"line_number":300,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"},{"line_number":301,"context_line":"            elif not self._is_dhcp_agent_bound_to_network(plugin, context,"},{"line_number":302,"context_line":"                                                          host, network_id):"},{"line_number":303,"context_line":"                    # To avoid the race condition when a DHCP agent tried to"},{"line_number":304,"context_line":"                    # update a DHCP port after its ownership has already been"},{"line_number":305,"context_line":"                    # removed and given to another DHCP agent."}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_13a618c2","line":302,"range":{"start_line":301,"start_character":21,"end_line":302,"end_character":75},"updated":"2018-10-08 06:53:22.000000000","message":"Why not add an \u0027or\u0027 condition to the above if statement since it raises the same exception except one additional debug LOG? And, for most cloud deployment the debug log may not enabled, so IMO, add this to one conditon is engouth.","commit_id":"f58db2e9326d1cdc92425ea90b6ece004a572f1a"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"69bdc7b8a42d51afbda656a9c3807689dd155dfb","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                old_port[\u0027device_id\u0027] !\u003d utils.get_dhcp_agent_device_id("},{"line_number":299,"context_line":"                    network_id, host)):"},{"line_number":300,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"},{"line_number":301,"context_line":"            elif not self._is_dhcp_agent_bound_to_network(plugin, context,"},{"line_number":302,"context_line":"                                                          host, network_id):"},{"line_number":303,"context_line":"                    # To avoid the race condition when a DHCP agent tried to"},{"line_number":304,"context_line":"                    # update a DHCP port after its ownership has already been"},{"line_number":305,"context_line":"                    # removed and given to another DHCP agent."}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_f7629a41","line":302,"range":{"start_line":301,"start_character":21,"end_line":302,"end_character":75},"in_reply_to":"3f79a3b5_13a618c2","updated":"2018-10-17 07:13:29.000000000","message":"Thanks for the advice. It makes sense to me.","commit_id":"f58db2e9326d1cdc92425ea90b6ece004a572f1a"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"a2019c52604d606424a5373f16bbcd8207c4f30c","unresolved":false,"context_lines":[{"line_number":273,"context_line":"        plugin \u003d directory.get_plugin()"},{"line_number":274,"context_line":"        return self._port_action(plugin, context, port, \u0027create_port\u0027)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"    def _is_dhcp_agent_bound_to_network(self, plugin, context, host,"},{"line_number":277,"context_line":"                                        network_id):"},{"line_number":278,"context_line":"        \"\"\"Check whether a DHCP agent (host) is bound to a network.\"\"\""},{"line_number":279,"context_line":"        agents \u003d plugin.get_dhcp_agents_hosting_networks(context, [network_id],"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_8818e783","line":276,"range":{"start_line":276,"start_character":23,"end_line":276,"end_character":31},"updated":"2018-10-17 09:17:53.000000000","message":"I would say \"host network\"","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"75fd6ad7226fc9dfff1b071334c790cb56d3b6e5","unresolved":false,"context_lines":[{"line_number":273,"context_line":"        plugin \u003d directory.get_plugin()"},{"line_number":274,"context_line":"        return self._port_action(plugin, context, port, \u0027create_port\u0027)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"    def _is_dhcp_agent_bound_to_network(self, plugin, context, host,"},{"line_number":277,"context_line":"                                        network_id):"},{"line_number":278,"context_line":"        \"\"\"Check whether a DHCP agent (host) is bound to a network.\"\"\""},{"line_number":279,"context_line":"        agents \u003d plugin.get_dhcp_agents_hosting_networks(context, [network_id],"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_29e3d5a2","line":276,"range":{"start_line":276,"start_character":23,"end_line":276,"end_character":31},"in_reply_to":"3f79a3b5_8818e783","updated":"2018-10-17 13:03:56.000000000","message":"Done","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"a2019c52604d606424a5373f16bbcd8207c4f30c","unresolved":false,"context_lines":[{"line_number":295,"context_line":"            if (old_port[\u0027device_id\u0027] !\u003d"},{"line_number":296,"context_line":"                constants.DEVICE_ID_RESERVED_DHCP_PORT and"},{"line_number":297,"context_line":"                old_port[\u0027device_id\u0027] !\u003d utils.get_dhcp_agent_device_id("},{"line_number":298,"context_line":"                    network_id, host)) or not \\"},{"line_number":299,"context_line":"                self._is_dhcp_agent_bound_to_network(plugin, context, host,"},{"line_number":300,"context_line":"                    network_id):"},{"line_number":301,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_e3341ce3","line":298,"range":{"start_line":298,"start_character":42,"end_line":298,"end_character":45},"updated":"2018-10-17 09:17:53.000000000","message":"I would move this to the next line to improve readability","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"a2019c52604d606424a5373f16bbcd8207c4f30c","unresolved":false,"context_lines":[{"line_number":295,"context_line":"            if (old_port[\u0027device_id\u0027] !\u003d"},{"line_number":296,"context_line":"                constants.DEVICE_ID_RESERVED_DHCP_PORT and"},{"line_number":297,"context_line":"                old_port[\u0027device_id\u0027] !\u003d utils.get_dhcp_agent_device_id("},{"line_number":298,"context_line":"                    network_id, host)) or not \\"},{"line_number":299,"context_line":"                self._is_dhcp_agent_bound_to_network(plugin, context, host,"},{"line_number":300,"context_line":"                    network_id):"},{"line_number":301,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_4320709b","line":298,"range":{"start_line":298,"start_character":46,"end_line":298,"end_character":47},"updated":"2018-10-17 09:17:53.000000000","message":"this is not necessary","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"75fd6ad7226fc9dfff1b071334c790cb56d3b6e5","unresolved":false,"context_lines":[{"line_number":295,"context_line":"            if (old_port[\u0027device_id\u0027] !\u003d"},{"line_number":296,"context_line":"                constants.DEVICE_ID_RESERVED_DHCP_PORT and"},{"line_number":297,"context_line":"                old_port[\u0027device_id\u0027] !\u003d utils.get_dhcp_agent_device_id("},{"line_number":298,"context_line":"                    network_id, host)) or not \\"},{"line_number":299,"context_line":"                self._is_dhcp_agent_bound_to_network(plugin, context, host,"},{"line_number":300,"context_line":"                    network_id):"},{"line_number":301,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_09fa9943","line":298,"range":{"start_line":298,"start_character":46,"end_line":298,"end_character":47},"in_reply_to":"3f79a3b5_4320709b","updated":"2018-10-17 13:03:56.000000000","message":"Done","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"75fd6ad7226fc9dfff1b071334c790cb56d3b6e5","unresolved":false,"context_lines":[{"line_number":295,"context_line":"            if (old_port[\u0027device_id\u0027] !\u003d"},{"line_number":296,"context_line":"                constants.DEVICE_ID_RESERVED_DHCP_PORT and"},{"line_number":297,"context_line":"                old_port[\u0027device_id\u0027] !\u003d utils.get_dhcp_agent_device_id("},{"line_number":298,"context_line":"                    network_id, host)) or not \\"},{"line_number":299,"context_line":"                self._is_dhcp_agent_bound_to_network(plugin, context, host,"},{"line_number":300,"context_line":"                    network_id):"},{"line_number":301,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_c9f3416d","line":298,"range":{"start_line":298,"start_character":42,"end_line":298,"end_character":45},"in_reply_to":"3f79a3b5_e3341ce3","updated":"2018-10-17 13:03:56.000000000","message":"Done","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"e993b7f1d406355741deb17bd1d5680ed8c73cd4","unresolved":false,"context_lines":[{"line_number":273,"context_line":"        plugin \u003d directory.get_plugin()"},{"line_number":274,"context_line":"        return self._port_action(plugin, context, port, \u0027create_port\u0027)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"    def _is_dhcp_agent_host_network(self, plugin, context, host,"},{"line_number":277,"context_line":"                                    network_id):"},{"line_number":278,"context_line":"        \"\"\"Check whether a DHCP agent (host) is hosting a network.\"\"\""},{"line_number":279,"context_line":"        agents \u003d plugin.get_dhcp_agents_hosting_networks(context, [network_id],"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_46ef14fa","line":276,"range":{"start_line":276,"start_character":23,"end_line":276,"end_character":27},"updated":"2018-10-17 16:42:23.000000000","message":"nit: sorry for that but I now think that \"hosting_network\" would be even better. But I don\u0027t think it\u0027s worth to respin this patch only because of that","commit_id":"8a272c3192bf1d478fa2ce24b6e25d94aaf37df9"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"6f9fc5dd3bf6d4ca24d39276c8ad5099768b6921","unresolved":false,"context_lines":[{"line_number":273,"context_line":"        plugin \u003d directory.get_plugin()"},{"line_number":274,"context_line":"        return self._port_action(plugin, context, port, \u0027create_port\u0027)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"    def _is_dhcp_agent_host_network(self, plugin, context, host,"},{"line_number":277,"context_line":"                                    network_id):"},{"line_number":278,"context_line":"        \"\"\"Check whether a DHCP agent (host) is hosting a network.\"\"\""},{"line_number":279,"context_line":"        agents \u003d plugin.get_dhcp_agents_hosting_networks(context, [network_id],"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_2d18b0cb","line":276,"range":{"start_line":276,"start_character":23,"end_line":276,"end_character":27},"in_reply_to":"3f79a3b5_46ef14fa","updated":"2018-10-17 23:53:54.000000000","message":"OK, I\u0027ll refresh the patch once we have an alignment on the below comment.","commit_id":"8a272c3192bf1d478fa2ce24b6e25d94aaf37df9"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"e993b7f1d406355741deb17bd1d5680ed8c73cd4","unresolved":false,"context_lines":[{"line_number":296,"context_line":"                    constants.DEVICE_ID_RESERVED_DHCP_PORT and"},{"line_number":297,"context_line":"                old_port[\u0027device_id\u0027] !\u003d"},{"line_number":298,"context_line":"                    utils.get_dhcp_agent_device_id(network_id, host) or"},{"line_number":299,"context_line":"                not self._is_dhcp_agent_host_network(plugin, context, host,"},{"line_number":300,"context_line":"                    network_id)):"},{"line_number":301,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"},{"line_number":302,"context_line":"            LOG.debug(\u0027Update dhcp port %(port)s \u0027"},{"line_number":303,"context_line":"                      \u0027from %(host)s.\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_46ddd43d","line":300,"range":{"start_line":299,"start_character":16,"end_line":300,"end_character":32},"updated":"2018-10-17 16:42:23.000000000","message":"is it proper exception raised in such case? Does it means that Dhcp Port is in use already?","commit_id":"8a272c3192bf1d478fa2ce24b6e25d94aaf37df9"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"6f9fc5dd3bf6d4ca24d39276c8ad5099768b6921","unresolved":false,"context_lines":[{"line_number":296,"context_line":"                    constants.DEVICE_ID_RESERVED_DHCP_PORT and"},{"line_number":297,"context_line":"                old_port[\u0027device_id\u0027] !\u003d"},{"line_number":298,"context_line":"                    utils.get_dhcp_agent_device_id(network_id, host) or"},{"line_number":299,"context_line":"                not self._is_dhcp_agent_host_network(plugin, context, host,"},{"line_number":300,"context_line":"                    network_id)):"},{"line_number":301,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"},{"line_number":302,"context_line":"            LOG.debug(\u0027Update dhcp port %(port)s \u0027"},{"line_number":303,"context_line":"                      \u0027from %(host)s.\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_4d4f2cbf","line":300,"range":{"start_line":299,"start_character":16,"end_line":300,"end_character":32},"in_reply_to":"3f79a3b5_46ddd43d","updated":"2018-10-17 23:53:54.000000000","message":"class DhcpPortInUse(InUse):\n    message \u003d _(\"Port %(port_id)s is already acquired by another DHCP agent\")\nThe patch is to avoid the race condition when a DHCP agent tried to update a DHCP port after its ownership has already been removed and given to another DHCP agent. IMO, it is OK to combine and raise this exception as the DHCP port is already acquired by another DHCP agent.","commit_id":"8a272c3192bf1d478fa2ce24b6e25d94aaf37df9"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"87c28b70a3d33e7bfdf07bc06a5acc3bf9b2717a","unresolved":false,"context_lines":[{"line_number":296,"context_line":"                    constants.DEVICE_ID_RESERVED_DHCP_PORT and"},{"line_number":297,"context_line":"                old_port[\u0027device_id\u0027] !\u003d"},{"line_number":298,"context_line":"                    utils.get_dhcp_agent_device_id(network_id, host) or"},{"line_number":299,"context_line":"                not self._is_dhcp_agent_host_network(plugin, context, host,"},{"line_number":300,"context_line":"                    network_id)):"},{"line_number":301,"context_line":"                raise n_exc.DhcpPortInUse(port_id\u003dport[\u0027id\u0027])"},{"line_number":302,"context_line":"            LOG.debug(\u0027Update dhcp port %(port)s \u0027"},{"line_number":303,"context_line":"                      \u0027from %(host)s.\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f79a3b5_640bdd7b","line":300,"range":{"start_line":299,"start_character":16,"end_line":300,"end_character":32},"in_reply_to":"3f79a3b5_4d4f2cbf","updated":"2018-10-22 10:54:36.000000000","message":"ok. It\u0027s good exception then :)","commit_id":"8a272c3192bf1d478fa2ce24b6e25d94aaf37df9"}],"neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py":[{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"a2019c52604d606424a5373f16bbcd8207c4f30c","unresolved":false,"context_lines":[{"line_number":281,"context_line":"            \u0027device_id\u0027: constants.DEVICE_ID_RESERVED_DHCP_PORT}"},{"line_number":282,"context_line":"        self.callbacks._port_action \u003d _fake_port_action"},{"line_number":283,"context_line":"        self.callbacks._is_dhcp_agent_bound_to_network \u003d \\"},{"line_number":284,"context_line":"            self._fake__is_dhcp_agent_bound_to_network"},{"line_number":285,"context_line":"        self.callbacks.update_dhcp_port(mock.Mock(),"},{"line_number":286,"context_line":"                                        host\u003d\u0027foo_host\u0027,"},{"line_number":287,"context_line":"                                        port_id\u003d\u0027foo_port_id\u0027,"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_036038d0","line":284,"updated":"2018-10-17 09:17:53.000000000","message":"can\u0027t You just use mock with \"return_value\u003dTrue\"?","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"75fd6ad7226fc9dfff1b071334c790cb56d3b6e5","unresolved":false,"context_lines":[{"line_number":281,"context_line":"            \u0027device_id\u0027: constants.DEVICE_ID_RESERVED_DHCP_PORT}"},{"line_number":282,"context_line":"        self.callbacks._port_action \u003d _fake_port_action"},{"line_number":283,"context_line":"        self.callbacks._is_dhcp_agent_bound_to_network \u003d \\"},{"line_number":284,"context_line":"            self._fake__is_dhcp_agent_bound_to_network"},{"line_number":285,"context_line":"        self.callbacks.update_dhcp_port(mock.Mock(),"},{"line_number":286,"context_line":"                                        host\u003d\u0027foo_host\u0027,"},{"line_number":287,"context_line":"                                        port_id\u003d\u0027foo_port_id\u0027,"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_2998b518","line":284,"in_reply_to":"3f79a3b5_036038d0","updated":"2018-10-17 13:03:56.000000000","message":"Done","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"a2019c52604d606424a5373f16bbcd8207c4f30c","unresolved":false,"context_lines":[{"line_number":308,"context_line":"                                                        \u0027foo_host\u0027)}"},{"line_number":309,"context_line":"        self.callbacks._port_action \u003d _fake_port_action"},{"line_number":310,"context_line":"        self.callbacks._is_dhcp_agent_bound_to_network \u003d \\"},{"line_number":311,"context_line":"            self._fake__is_dhcp_agent_bound_to_network"},{"line_number":312,"context_line":"        self.callbacks.update_dhcp_port("},{"line_number":313,"context_line":"            mock.Mock(), host\u003d\u0027foo_host\u0027, port_id\u003d\u0027foo_port_id\u0027, port\u003dport)"},{"line_number":314,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_c359e029","line":311,"updated":"2018-10-17 09:17:53.000000000","message":"can\u0027t You just use mock with \"return_value\u003dFalse\"?","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"75fd6ad7226fc9dfff1b071334c790cb56d3b6e5","unresolved":false,"context_lines":[{"line_number":308,"context_line":"                                                        \u0027foo_host\u0027)}"},{"line_number":309,"context_line":"        self.callbacks._port_action \u003d _fake_port_action"},{"line_number":310,"context_line":"        self.callbacks._is_dhcp_agent_bound_to_network \u003d \\"},{"line_number":311,"context_line":"            self._fake__is_dhcp_agent_bound_to_network"},{"line_number":312,"context_line":"        self.callbacks.update_dhcp_port("},{"line_number":313,"context_line":"            mock.Mock(), host\u003d\u0027foo_host\u0027, port_id\u003d\u0027foo_port_id\u0027, port\u003dport)"},{"line_number":314,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_9bc58c0c","line":311,"in_reply_to":"3f79a3b5_c359e029","updated":"2018-10-17 13:03:56.000000000","message":"Done","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"a2019c52604d606424a5373f16bbcd8207c4f30c","unresolved":false,"context_lines":[{"line_number":336,"context_line":"        self.plugin.get_port.return_value \u003d {"},{"line_number":337,"context_line":"            \u0027device_id\u0027: constants.DEVICE_ID_RESERVED_DHCP_PORT}"},{"line_number":338,"context_line":"        self.callbacks._is_dhcp_agent_bound_to_network \u003d \\"},{"line_number":339,"context_line":"            self._fake__is_dhcp_agent_bound_to_network"},{"line_number":340,"context_line":"        self.callbacks.update_dhcp_port(mock.Mock(),"},{"line_number":341,"context_line":"                                        host\u003d\u0027foo_host\u0027,"},{"line_number":342,"context_line":"                                        port_id\u003d\u0027foo_port_id\u0027,"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_63948c99","line":339,"updated":"2018-10-17 09:17:53.000000000","message":"ditto","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"75fd6ad7226fc9dfff1b071334c790cb56d3b6e5","unresolved":false,"context_lines":[{"line_number":336,"context_line":"        self.plugin.get_port.return_value \u003d {"},{"line_number":337,"context_line":"            \u0027device_id\u0027: constants.DEVICE_ID_RESERVED_DHCP_PORT}"},{"line_number":338,"context_line":"        self.callbacks._is_dhcp_agent_bound_to_network \u003d \\"},{"line_number":339,"context_line":"            self._fake__is_dhcp_agent_bound_to_network"},{"line_number":340,"context_line":"        self.callbacks.update_dhcp_port(mock.Mock(),"},{"line_number":341,"context_line":"                                        host\u003d\u0027foo_host\u0027,"},{"line_number":342,"context_line":"                                        port_id\u003d\u0027foo_port_id\u0027,"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_3bca3819","line":339,"in_reply_to":"3f79a3b5_63948c99","updated":"2018-10-17 13:03:56.000000000","message":"Done","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"a2019c52604d606424a5373f16bbcd8207c4f30c","unresolved":false,"context_lines":[{"line_number":352,"context_line":"        self.plugin.get_port.return_value \u003d {"},{"line_number":353,"context_line":"            \u0027device_id\u0027: constants.DEVICE_ID_RESERVED_DHCP_PORT}"},{"line_number":354,"context_line":"        self.callbacks._is_dhcp_agent_bound_to_network \u003d \\"},{"line_number":355,"context_line":"            self._fake__is_dhcp_agent_bound_to_network_false"},{"line_number":356,"context_line":"        self.assertRaises(exceptions.DhcpPortInUse,"},{"line_number":357,"context_line":"                          self.callbacks.update_dhcp_port,"},{"line_number":358,"context_line":"                          mock.Mock(),"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_239e94b7","line":355,"updated":"2018-10-17 09:17:53.000000000","message":"ditto","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"75fd6ad7226fc9dfff1b071334c790cb56d3b6e5","unresolved":false,"context_lines":[{"line_number":352,"context_line":"        self.plugin.get_port.return_value \u003d {"},{"line_number":353,"context_line":"            \u0027device_id\u0027: constants.DEVICE_ID_RESERVED_DHCP_PORT}"},{"line_number":354,"context_line":"        self.callbacks._is_dhcp_agent_bound_to_network \u003d \\"},{"line_number":355,"context_line":"            self._fake__is_dhcp_agent_bound_to_network_false"},{"line_number":356,"context_line":"        self.assertRaises(exceptions.DhcpPortInUse,"},{"line_number":357,"context_line":"                          self.callbacks.update_dhcp_port,"},{"line_number":358,"context_line":"                          mock.Mock(),"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_5bcff427","line":355,"in_reply_to":"3f79a3b5_239e94b7","updated":"2018-10-17 13:03:56.000000000","message":"Done","commit_id":"525f04dd613ffa0487653c47c9562ee1e9acb9e2"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"5ea2cf8f8862b7c4577f22d106cd6b89f2cf2d3f","unresolved":false,"context_lines":[{"line_number":198,"context_line":"        self.plugin.update_port.side_effect \u003d n_exc.PortNotFound(port_id\u003d\u002766\u0027)"},{"line_number":199,"context_line":"        with mock.patch.object(self.callbacks,"},{"line_number":200,"context_line":"                               \u0027_is_dhcp_agent_hosting_network\u0027,"},{"line_number":201,"context_line":"                               return_value\u003dTrue):"},{"line_number":202,"context_line":"            self.assertIsNone(self.callbacks.update_dhcp_port("},{"line_number":203,"context_line":"                context\u003d\u0027ctx\u0027, host\u003d\u0027host\u0027, port_id\u003d\u002766\u0027,"},{"line_number":204,"context_line":"                port\u003d{\u0027port\u0027: {\u0027network_id\u0027: \u0027a\u0027}}))"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_5268ce86","line":201,"updated":"2018-10-23 01:04:32.000000000","message":"Maybe it\u0027s better to put this default return value of True in setUp() then just tweak the one case you need False?  I don\u0027t think that will cause a race.","commit_id":"1f790c08b56585451dab7cbbdfee2f17b9f0918e"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"0a8ad8b8e96c6801ce04ea7fe802986362f71ab4","unresolved":false,"context_lines":[{"line_number":198,"context_line":"        self.plugin.update_port.side_effect \u003d n_exc.PortNotFound(port_id\u003d\u002766\u0027)"},{"line_number":199,"context_line":"        with mock.patch.object(self.callbacks,"},{"line_number":200,"context_line":"                               \u0027_is_dhcp_agent_hosting_network\u0027,"},{"line_number":201,"context_line":"                               return_value\u003dTrue):"},{"line_number":202,"context_line":"            self.assertIsNone(self.callbacks.update_dhcp_port("},{"line_number":203,"context_line":"                context\u003d\u0027ctx\u0027, host\u003d\u0027host\u0027, port_id\u003d\u002766\u0027,"},{"line_number":204,"context_line":"                port\u003d{\u0027port\u0027: {\u0027network_id\u0027: \u0027a\u0027}}))"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f79a3b5_756374ac","line":201,"in_reply_to":"3f79a3b5_5268ce86","updated":"2018-10-23 02:45:02.000000000","message":"Good idea. Moved this to setUp().","commit_id":"1f790c08b56585451dab7cbbdfee2f17b9f0918e"}]}
