)]}'
{"neutron/agent/dhcp_agent.py":[{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"46e23669cdc2b37d1e1c9d4ce9a23c007a708908","unresolved":false,"context_lines":[{"line_number":245,"context_line":"                self.disable_isolated_metadata_proxy(network)"},{"line_number":246,"context_line":"            if self.call_driver(\u0027disable\u0027, network):"},{"line_number":247,"context_line":"                self.cache.remove(network)"},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"    def refresh_dhcp_helper(self, network_id):"},{"line_number":250,"context_line":"        \"\"\"Refresh or disable DHCP for a network depending on the current state"},{"line_number":251,"context_line":"        of the network."}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_fcbad4df","line":248,"updated":"2014-08-27 09:19:20.000000000","message":"We have another case we may need to think of, not sure if it\u0027s covered by dhcp updates.\n\nWhat about the case when a network starts isolated, and then becomes unisolated (router added). Or the other way around (network starts unisolated, and becomes isolated, -router removed-)","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"f60562d21c8accc1fdf67e99c70c9df1f7d39898","unresolved":false,"context_lines":[{"line_number":245,"context_line":"                self.disable_isolated_metadata_proxy(network)"},{"line_number":246,"context_line":"            if self.call_driver(\u0027disable\u0027, network):"},{"line_number":247,"context_line":"                self.cache.remove(network)"},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"    def refresh_dhcp_helper(self, network_id):"},{"line_number":250,"context_line":"        \"\"\"Refresh or disable DHCP for a network depending on the current state"},{"line_number":251,"context_line":"        of the network."}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_00455e6f","line":248,"in_reply_to":"1abeadc6_60aa92d3","updated":"2014-08-27 13:15:19.000000000","message":"Agreed, let\u0027s do it in small steps.","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"c1192de10442024eed1b2c489cd74eef0c43f06e","unresolved":false,"context_lines":[{"line_number":245,"context_line":"                self.disable_isolated_metadata_proxy(network)"},{"line_number":246,"context_line":"            if self.call_driver(\u0027disable\u0027, network):"},{"line_number":247,"context_line":"                self.cache.remove(network)"},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"    def refresh_dhcp_helper(self, network_id):"},{"line_number":250,"context_line":"        \"\"\"Refresh or disable DHCP for a network depending on the current state"},{"line_number":251,"context_line":"        of the network."}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_4b205749","line":248,"in_reply_to":"1abeadc6_60aa92d3","updated":"2014-08-27 13:31:42.000000000","message":"That\u0027s fair enough to me. At now, if we have a gateway in a subnet, dnsmasq does not advertise the additional route even when the gateway is removed. I thnk it can be done later.","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"0a761f5505ebd9fef69b27a330b4870d2833a595","unresolved":false,"context_lines":[{"line_number":245,"context_line":"                self.disable_isolated_metadata_proxy(network)"},{"line_number":246,"context_line":"            if self.call_driver(\u0027disable\u0027, network):"},{"line_number":247,"context_line":"                self.cache.remove(network)"},{"line_number":248,"context_line":""},{"line_number":249,"context_line":"    def refresh_dhcp_helper(self, network_id):"},{"line_number":250,"context_line":"        \"\"\"Refresh or disable DHCP for a network depending on the current state"},{"line_number":251,"context_line":"        of the network."}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_60aa92d3","line":248,"in_reply_to":"1abeadc6_fcbad4df","updated":"2014-08-27 12:56:35.000000000","message":"This is a bigger issue with the dhcp_agent that I\u0027m not handling. I began implementing this but ended up tossing the idea because it was way too complicated and required too much of a refactor on the code.\n\nFor example, if I update the current subnet with --no-gateway flag, the proxy will still be enabled, because no CIDR changes were made. There is too much inconsistency here that is out of the scope of my code and requires a much larger refactor.","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"}],"neutron/agent/linux/dhcp.py":[{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"46e23669cdc2b37d1e1c9d4ce9a23c007a708908","unresolved":false,"context_lines":[{"line_number":173,"context_line":"    def check_version(cls):"},{"line_number":174,"context_line":"        \"\"\"Execute version checks on DHCP server.\"\"\""},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"        raise NotImplementedError"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"class DhcpLocalProcess(DhcpBase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_c1ed35b9","line":176,"updated":"2014-08-27 09:19:20.000000000","message":"Missing:\n    @classmethod\n    def should_enable_metadata(cls, conf, network):\n        \"\"\" ..... \"\"\"\n        raise NotImplementedError","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"f60562d21c8accc1fdf67e99c70c9df1f7d39898","unresolved":false,"context_lines":[{"line_number":173,"context_line":"    def check_version(cls):"},{"line_number":174,"context_line":"        \"\"\"Execute version checks on DHCP server.\"\"\""},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"        raise NotImplementedError"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"class DhcpLocalProcess(DhcpBase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_e01b027e","line":176,"in_reply_to":"1abeadc6_65cc6462","updated":"2014-08-27 13:15:19.000000000","message":"I believe the methods we call should be set here as a reference, so this base serves as a guide to new drivers, so they know what they need to implement for being a driver...","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"0a761f5505ebd9fef69b27a330b4870d2833a595","unresolved":false,"context_lines":[{"line_number":173,"context_line":"    def check_version(cls):"},{"line_number":174,"context_line":"        \"\"\"Execute version checks on DHCP server.\"\"\""},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"        raise NotImplementedError"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"class DhcpLocalProcess(DhcpBase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_65cc6462","line":176,"in_reply_to":"1abeadc6_c1ed35b9","updated":"2014-08-27 12:56:35.000000000","message":"I\u0027m not sure I agree with you here. Not all the functions declared in Dnsmasq are also declared here... it seems like a \"weak rule\" of somekind.\nCan you elaborate on why do you think it is needed?","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"e31183c57042f7824d70f64c84e6f2c3a817188e","unresolved":false,"context_lines":[{"line_number":173,"context_line":"    def check_version(cls):"},{"line_number":174,"context_line":"        \"\"\"Execute version checks on DHCP server.\"\"\""},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"        raise NotImplementedError"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"class DhcpLocalProcess(DhcpBase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_ebecc32b","line":176,"in_reply_to":"1abeadc6_e01b027e","updated":"2014-08-27 13:21:45.000000000","message":"Done","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"c1192de10442024eed1b2c489cd74eef0c43f06e","unresolved":false,"context_lines":[{"line_number":173,"context_line":"    def check_version(cls):"},{"line_number":174,"context_line":"        \"\"\"Execute version checks on DHCP server.\"\"\""},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"        raise NotImplementedError"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"class DhcpLocalProcess(DhcpBase):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_2baf9b95","line":176,"in_reply_to":"1abeadc6_e01b027e","updated":"2014-08-27 13:31:42.000000000","message":"Sounds reasonable to have public methods called out side of the class documented here.","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"46e23669cdc2b37d1e1c9d4ce9a23c007a708908","unresolved":false,"context_lines":[{"line_number":730,"context_line":"        \"\"\"True if there exists a subnet for which a metadata proxy is needed"},{"line_number":731,"context_line":"        \"\"\""},{"line_number":732,"context_line":"        return any([cls._enable_metadata("},{"line_number":733,"context_line":"                conf, network, subnet) for subnet in network.subnets])"},{"line_number":734,"context_line":""},{"line_number":735,"context_line":"    @classmethod"},{"line_number":736,"context_line":"    def lease_update(cls):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_01d72d24","line":733,"updated":"2014-08-27 09:19:20.000000000","message":"\u003e\u003e\u003e def f(x):\n\n...     print x\n\n...     return x\u003d\u003d4\n\n... \n\n\u003e\u003e\u003e any(f(x) for x in range(10))\n\n0\n\n1\n\n2\n\n3\n\n4\n\nTrue\n\n\u003e\u003e\u003e any([f(x) for x in range(10)])\n\n0\n\n1\n\n2\n\n3\n\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\nTrue\n\n\nLittle optimization, if you remove the [ ] in the for, you will avoid the list from being created in advance to \"any\", and the whole operation becomes a bit lazier. Saving some cpu cycles.","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"0a761f5505ebd9fef69b27a330b4870d2833a595","unresolved":false,"context_lines":[{"line_number":730,"context_line":"        \"\"\"True if there exists a subnet for which a metadata proxy is needed"},{"line_number":731,"context_line":"        \"\"\""},{"line_number":732,"context_line":"        return any([cls._enable_metadata("},{"line_number":733,"context_line":"                conf, network, subnet) for subnet in network.subnets])"},{"line_number":734,"context_line":""},{"line_number":735,"context_line":"    @classmethod"},{"line_number":736,"context_line":"    def lease_update(cls):"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_852fc0a0","line":733,"in_reply_to":"1abeadc6_01d72d24","updated":"2014-08-27 12:56:35.000000000","message":"You are correct - now I have a list comprehension when you suggest a generator comprehension!","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"5c3d59044c2d2c1fa8e8c16054e622a6b2917a9e","unresolved":false,"context_lines":[{"line_number":733,"context_line":"    @classmethod"},{"line_number":734,"context_line":"    def should_enable_metadata(cls, conf, network):"},{"line_number":735,"context_line":"        \"\"\"True if there exists a subnet for which a metadata proxy is needed"},{"line_number":736,"context_line":"        \"\"\""},{"line_number":737,"context_line":"        return any(cls._enable_metadata(conf, network, subnet)"},{"line_number":738,"context_line":"                   for subnet in network.subnets)"},{"line_number":739,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_495f750f","line":736,"updated":"2014-08-27 17:54:15.000000000","message":"This saves code but I\u0027m not sure how much this makes sense. \n_enable_metadata(subnet) was used because the question  \u0027Should I inject the host route\u0027 is per subnet, while _enable_metadata(network) asks the question: Should I enable the proxy for this network. Lines 726 and 727 are not relevant in this case. You want to enable the proxy if:\n\ndef _no_gateways(network):\n    return all(subnet.gateway_ip is None for subnet in network.subnets)\n\ndef _no_routers(network):\n    return all(port.device_owner !\u003d router for port in network.ports)\n\nreturn _no_gateways(network) or _no_routers(network)\n\nI think that for readability and performance sake it\u0027s worth coding up a different function here. _enable_metadata is just very confusing as it is written now when it\u0027s used in the \u0027should_enable_metadata\u0027 context.","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"4e3b04bd1b41f339c5eb17e6e4a5521b21da4120","unresolved":false,"context_lines":[{"line_number":733,"context_line":"    @classmethod"},{"line_number":734,"context_line":"    def should_enable_metadata(cls, conf, network):"},{"line_number":735,"context_line":"        \"\"\"True if there exists a subnet for which a metadata proxy is needed"},{"line_number":736,"context_line":"        \"\"\""},{"line_number":737,"context_line":"        return any(cls._enable_metadata(conf, network, subnet)"},{"line_number":738,"context_line":"                   for subnet in network.subnets)"},{"line_number":739,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_2f122709","line":736,"in_reply_to":"1abeadc6_170d943e","updated":"2014-08-28 07:22:51.000000000","message":"_no_gateways - agree, and if I will rewrite the code I will put it in (otherwise it might even complicate the code further imo).\n\n_no_routers - you are correct; the scenario I gave was an incorrect one. How about this one:\n- Two subnets in one network.\n- One subnet is connected to a neutron router and has a VM which has a leg in the other subnet as well (it is configured with ip forwarding).\n- The other subnet\u0027s gateway_ip is configured to be the VM mentioned above, which does ip forwarding at will.\n\nWhile the second subnet is not isolated, it isn\u0027t controlled by a neutron router and therefor do need a metadata proxy provided by the DHCP.. :)\n\nAlso, upon further reading of the for loop, I can\u0027t take it out as I mentioned in my previous comment, because it\u0027s dependent on outside variables (so can\u0027t be cached): subnet.id (L727).","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"652dcdedc1336488b6ce0ac909ea1f6ad64bd228","unresolved":false,"context_lines":[{"line_number":733,"context_line":"    @classmethod"},{"line_number":734,"context_line":"    def should_enable_metadata(cls, conf, network):"},{"line_number":735,"context_line":"        \"\"\"True if there exists a subnet for which a metadata proxy is needed"},{"line_number":736,"context_line":"        \"\"\""},{"line_number":737,"context_line":"        return any(cls._enable_metadata(conf, network, subnet)"},{"line_number":738,"context_line":"                   for subnet in network.subnets)"},{"line_number":739,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_7e7dae1b","line":736,"in_reply_to":"1abeadc6_2f122709","updated":"2014-08-28 08:29:13.000000000","message":"You\u0027re right. The query for router ports has to be per subnet, and we\u0027re back with the logic in _enable_metadata. You could optimize this bit by first building a mapping between a subnet and its ports, but I don\u0027t think that performance alone warrants a rewrite here.","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"7dedc25abbffc4bfefbe3dbfb1c6c8580b1d4a84","unresolved":false,"context_lines":[{"line_number":733,"context_line":"    @classmethod"},{"line_number":734,"context_line":"    def should_enable_metadata(cls, conf, network):"},{"line_number":735,"context_line":"        \"\"\"True if there exists a subnet for which a metadata proxy is needed"},{"line_number":736,"context_line":"        \"\"\""},{"line_number":737,"context_line":"        return any(cls._enable_metadata(conf, network, subnet)"},{"line_number":738,"context_line":"                   for subnet in network.subnets)"},{"line_number":739,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_b795c034","line":736,"in_reply_to":"1abeadc6_495f750f","updated":"2014-08-27 19:02:43.000000000","message":"Regarding _no_gateways: how about a case in which a network has 2 subnets - one has a gateway_ip (and is connected to a neutron router), and the other\u0027s gateway_ip \u003d\u003d None? In this case we do want to use the proxy - there exists an isolated subnet (the second). The correct code should be:\n\ndef _no_gateways(network):\n    return any(subnet.gateway_ip is None for subnet in network.subnets)\n\nRegarding _no_routers: your suggestion means that if I have a network which is connected to a physical router (and the port is marked as ROUTER_INTF), we shouldn\u0027t spawn a proxy process, but the logic is incorrect (a subnet which has a single vm and a port to an external router should have a metadata proxy provided by the DHCP).\n\nThinking about it though, the \u0027for port in network.ports\u0027 is the same for each subnet that is ran (we check for all the ports of a network, not the specified subnet), so I\u0027ll modify the code to do that for block outside the scope of this \u0027any\u0027 (reducing O(n^3) to O(n^2)+k).\n\nIf anyone has further suggestions, I\u0027ll be happy to hear them XD","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"96fa22c1247fb1ca537133bb36d00b1575765273","unresolved":false,"context_lines":[{"line_number":733,"context_line":"    @classmethod"},{"line_number":734,"context_line":"    def should_enable_metadata(cls, conf, network):"},{"line_number":735,"context_line":"        \"\"\"True if there exists a subnet for which a metadata proxy is needed"},{"line_number":736,"context_line":"        \"\"\""},{"line_number":737,"context_line":"        return any(cls._enable_metadata(conf, network, subnet)"},{"line_number":738,"context_line":"                   for subnet in network.subnets)"},{"line_number":739,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_be03c60e","line":736,"in_reply_to":"1abeadc6_7e7dae1b","updated":"2014-08-28 08:48:09.000000000","message":"So I\u0027m leaving the code as is, until a better way to do this reveals itself to us, or until the code is pushed - whichever comes first :)","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"c1c63511df5fa95c4077c21ed96272685d2156a1","unresolved":false,"context_lines":[{"line_number":733,"context_line":"    @classmethod"},{"line_number":734,"context_line":"    def should_enable_metadata(cls, conf, network):"},{"line_number":735,"context_line":"        \"\"\"True if there exists a subnet for which a metadata proxy is needed"},{"line_number":736,"context_line":"        \"\"\""},{"line_number":737,"context_line":"        return any(cls._enable_metadata(conf, network, subnet)"},{"line_number":738,"context_line":"                   for subnet in network.subnets)"},{"line_number":739,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_170d943e","line":736,"in_reply_to":"1abeadc6_b795c034","updated":"2014-08-27 19:11:45.000000000","message":"Regarding _no_gateways you\u0027re correct, but it\u0027s name would then be \u0027any_gateways(network)\u0027 of course :)\n\nAbout _no_routers: If a subnet has a gateway and is connected to a physical router it would have no Neutron port to represent that router.","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"28947a6865658fca87ed201deb474005f0184174","unresolved":false,"context_lines":[{"line_number":726,"context_line":"        the subnet, and the port\u0027s ip address matches that of the subnet\u0027s"},{"line_number":727,"context_line":"        gateway. The port must be owned by a nuetron router."},{"line_number":728,"context_line":"        \"\"\""},{"line_number":729,"context_line":"        isolated_subnets \u003d collections.defaultdict(lambda: True)"},{"line_number":730,"context_line":"        subnets \u003d dict((subnet.id, subnet) for subnet in network.subnets)"},{"line_number":731,"context_line":""},{"line_number":732,"context_line":"        for port in network.ports:"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa98f980_4c31baeb","line":729,"updated":"2014-09-01 09:57:49.000000000","message":"Why do you need to use collection.defaultdict? I think a set works for the purpose.  Is defaultdict() more efficient than set?\n\n  isolated_subnets \u003d set([])\n  for alloc in port.fixed_ips:\n    if ....:\n        isolated_subnets.add(alloc.subnet_id)\n\n  return isolated_subnets\n\n  def should_enable_meta(...):\n     ...\n     return any(subnet.id in isolated_subnets for subnet in network.subnets)","commit_id":"065e167c700cc0a729c89ea982700329f9876afa"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"f55a6772b51995d7f7c6a3461313374563243a2d","unresolved":false,"context_lines":[{"line_number":726,"context_line":"        the subnet, and the port\u0027s ip address matches that of the subnet\u0027s"},{"line_number":727,"context_line":"        gateway. The port must be owned by a nuetron router."},{"line_number":728,"context_line":"        \"\"\""},{"line_number":729,"context_line":"        isolated_subnets \u003d collections.defaultdict(lambda: True)"},{"line_number":730,"context_line":"        subnets \u003d dict((subnet.id, subnet) for subnet in network.subnets)"},{"line_number":731,"context_line":""},{"line_number":732,"context_line":"        for port in network.ports:"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa98f980_e2799294","line":729,"in_reply_to":"fa98f980_31f84e7c","updated":"2014-09-01 12:15:47.000000000","message":"Thanks for the clarification. I got it. We can use set() to retrieve a set of \"all non-isolated subnets\" and use \"any(xxx not in subnet for subnets)\", but the defaultdict looks better and simpler. Many \"not\" makes it difficult to understand.","commit_id":"065e167c700cc0a729c89ea982700329f9876afa"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"709da02cb28dbd62c9df5a10d8d684dd4fae1414","unresolved":false,"context_lines":[{"line_number":726,"context_line":"        the subnet, and the port\u0027s ip address matches that of the subnet\u0027s"},{"line_number":727,"context_line":"        gateway. The port must be owned by a nuetron router."},{"line_number":728,"context_line":"        \"\"\""},{"line_number":729,"context_line":"        isolated_subnets \u003d collections.defaultdict(lambda: True)"},{"line_number":730,"context_line":"        subnets \u003d dict((subnet.id, subnet) for subnet in network.subnets)"},{"line_number":731,"context_line":""},{"line_number":732,"context_line":"        for port in network.ports:"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa98f980_31f84e7c","line":729,"in_reply_to":"fa98f980_4c31baeb","updated":"2014-09-01 11:02:18.000000000","message":"Efficiency is a non-issue here, set and defaultdict have the same amortized O(n) for relevant operations. Currently the code is looking for non-isolated subnets, while you\u0027re suggesting to look for isolated subnets. This code is surprisingly delicate and the change is pretty difficult to make.","commit_id":"065e167c700cc0a729c89ea982700329f9876afa"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"eda227b260547a8f53cc3f6d78e0253fa7a01221","unresolved":false,"context_lines":[{"line_number":726,"context_line":"        the subnet, and the port\u0027s ip address matches that of the subnet\u0027s"},{"line_number":727,"context_line":"        gateway. The port must be owned by a nuetron router."},{"line_number":728,"context_line":"        \"\"\""},{"line_number":729,"context_line":"        isolated_subnets \u003d collections.defaultdict(lambda: True)"},{"line_number":730,"context_line":"        subnets \u003d dict((subnet.id, subnet) for subnet in network.subnets)"},{"line_number":731,"context_line":""},{"line_number":732,"context_line":"        for port in network.ports:"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa98f980_91bbba0d","line":729,"in_reply_to":"fa98f980_4c31baeb","updated":"2014-09-01 10:55:16.000000000","message":"Using a set here will change the logical flow of the code - instead of \"all subnets are isolated unless proven otherwise\", it all be \"all of these subnets are non-isolated - if your subnet is not in this list, it is isolated\".\n\nMe and amuller took a lot of iterations to reach this code, and \"defaultdict\" seemed natural. I think your suggested code might work (need to write it to make sure)...\n\nAny reason why you want this change?","commit_id":"065e167c700cc0a729c89ea982700329f9876afa"}],"neutron/tests/unit/test_dhcp_agent.py":[{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"46e23669cdc2b37d1e1c9d4ce9a23c007a708908","unresolved":false,"context_lines":[{"line_number":527,"context_line":"                                     enable_isolated_metadata\u003dTrue,"},{"line_number":528,"context_line":"                                     is_isolated_network\u003dTrue)"},{"line_number":529,"context_line":"        finally:"},{"line_number":530,"context_line":"            fake_subnet1.gateway_ip \u003d \u0027172.9.9.1\u0027"},{"line_number":531,"context_line":""},{"line_number":532,"context_line":"    def test_enable_dhcp_helper_enable_metadata_nonisolated_network(self):"},{"line_number":533,"context_line":"        fake_port1.device_owner \u003d \"network:router_interface\""}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_1cedd025","line":530,"updated":"2014-08-27 09:19:20.000000000","message":"I would deepcopy isolated_network, \nand then modify isolated_network.subnets[0].gateway_ip\n\nso this \u0027172.9.9.1\u0027 won\u0027t be dependend on the above dictionary... \n\nOr, just make an isolated_network_without_gateway_ip","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"0a761f5505ebd9fef69b27a330b4870d2833a595","unresolved":false,"context_lines":[{"line_number":527,"context_line":"                                     enable_isolated_metadata\u003dTrue,"},{"line_number":528,"context_line":"                                     is_isolated_network\u003dTrue)"},{"line_number":529,"context_line":"        finally:"},{"line_number":530,"context_line":"            fake_subnet1.gateway_ip \u003d \u0027172.9.9.1\u0027"},{"line_number":531,"context_line":""},{"line_number":532,"context_line":"    def test_enable_dhcp_helper_enable_metadata_nonisolated_network(self):"},{"line_number":533,"context_line":"        fake_port1.device_owner \u003d \"network:router_interface\""}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_8558a057","line":530,"in_reply_to":"1abeadc6_1cedd025","updated":"2014-08-27 12:56:35.000000000","message":"Really like this :) thanks","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"46e23669cdc2b37d1e1c9d4ce9a23c007a708908","unresolved":false,"context_lines":[{"line_number":536,"context_line":"                                     enable_isolated_metadata\u003dTrue,"},{"line_number":537,"context_line":"                                     is_isolated_network\u003dFalse)"},{"line_number":538,"context_line":"        finally:"},{"line_number":539,"context_line":"            fake_port1.device_owner \u003d \"\""},{"line_number":540,"context_line":""},{"line_number":541,"context_line":"    def test_enable_dhcp_helper(self):"},{"line_number":542,"context_line":"        self._enable_dhcp_helper(fake_network)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_bce77c3f","line":539,"updated":"2014-08-27 09:19:20.000000000","message":"same here.","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"0a761f5505ebd9fef69b27a330b4870d2833a595","unresolved":false,"context_lines":[{"line_number":536,"context_line":"                                     enable_isolated_metadata\u003dTrue,"},{"line_number":537,"context_line":"                                     is_isolated_network\u003dFalse)"},{"line_number":538,"context_line":"        finally:"},{"line_number":539,"context_line":"            fake_port1.device_owner \u003d \"\""},{"line_number":540,"context_line":""},{"line_number":541,"context_line":"    def test_enable_dhcp_helper(self):"},{"line_number":542,"context_line":"        self._enable_dhcp_helper(fake_network)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1abeadc6_a553dc37","line":539,"in_reply_to":"1abeadc6_bce77c3f","updated":"2014-08-27 12:56:35.000000000","message":"Done","commit_id":"399abd123c191dc0e492416ab8bd26e9eb017163"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"5c3d59044c2d2c1fa8e8c16054e622a6b2917a9e","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                             admin_state_up\u003dTrue,"},{"line_number":104,"context_line":"                             subnets\u003d[fake_subnet1, fake_subnet2],"},{"line_number":105,"context_line":"                             ports\u003d[fake_port1]))"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"isolated_network \u003d dhcp.NetModel("},{"line_number":108,"context_line":"    True, dict(id\u003d\u002712345678-1234-5678-1234567890ab\u0027,"},{"line_number":109,"context_line":"               tenant_id\u003d\u0027aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_83616e3b","line":106,"updated":"2014-08-27 17:54:15.000000000","message":"Something weird is going on with the indentation here.","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"c1c63511df5fa95c4077c21ed96272685d2156a1","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                             admin_state_up\u003dTrue,"},{"line_number":104,"context_line":"                             subnets\u003d[fake_subnet1, fake_subnet2],"},{"line_number":105,"context_line":"                             ports\u003d[fake_port1]))"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"isolated_network \u003d dhcp.NetModel("},{"line_number":108,"context_line":"    True, dict(id\u003d\u002712345678-1234-5678-1234567890ab\u0027,"},{"line_number":109,"context_line":"               tenant_id\u003d\u0027aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_97644423","line":106,"in_reply_to":"1abeadc6_17b03442","updated":"2014-08-27 19:11:45.000000000","message":"It\u0027s simple, you shouldn\u0027t contribute to Bad Things (TM). Just indent your addition correctly. I wouldn\u0027t fix the other definitions in this patch. If you feel like contributing a separate patch that changes the indentation for the following networks, go ahead.","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"652dcdedc1336488b6ce0ac909ea1f6ad64bd228","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                             admin_state_up\u003dTrue,"},{"line_number":104,"context_line":"                             subnets\u003d[fake_subnet1, fake_subnet2],"},{"line_number":105,"context_line":"                             ports\u003d[fake_port1]))"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"isolated_network \u003d dhcp.NetModel("},{"line_number":108,"context_line":"    True, dict(id\u003d\u002712345678-1234-5678-1234567890ab\u0027,"},{"line_number":109,"context_line":"               tenant_id\u003d\u0027aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_fe4e1e6e","line":106,"in_reply_to":"1abeadc6_6fa17f93","updated":"2014-08-28 08:29:13.000000000","message":"You can probably put the True and the dict on the same line, but there are no guidelines for any of this anyway. I think the current way is clearly odd, other than that, pick whatever seems pretty to you :)","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"7dedc25abbffc4bfefbe3dbfb1c6c8580b1d4a84","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                             admin_state_up\u003dTrue,"},{"line_number":104,"context_line":"                             subnets\u003d[fake_subnet1, fake_subnet2],"},{"line_number":105,"context_line":"                             ports\u003d[fake_port1]))"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"isolated_network \u003d dhcp.NetModel("},{"line_number":108,"context_line":"    True, dict(id\u003d\u002712345678-1234-5678-1234567890ab\u0027,"},{"line_number":109,"context_line":"               tenant_id\u003d\u0027aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_17b03442","line":106,"in_reply_to":"1abeadc6_83616e3b","updated":"2014-08-27 19:02:43.000000000","message":"It seems off, but it is the same as the following 2 network definitions. Tried to conserve consistency in the price of conventions...\n\nAlso, previous definitions also look off according to our styling guidelines, but I don\u0027t think I should presume to fix their indentation problem in this patch.\n\nWhat do you think?","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"4e3b04bd1b41f339c5eb17e6e4a5521b21da4120","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                             admin_state_up\u003dTrue,"},{"line_number":104,"context_line":"                             subnets\u003d[fake_subnet1, fake_subnet2],"},{"line_number":105,"context_line":"                             ports\u003d[fake_port1]))"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"isolated_network \u003d dhcp.NetModel("},{"line_number":108,"context_line":"    True, dict(id\u003d\u002712345678-1234-5678-1234567890ab\u0027,"},{"line_number":109,"context_line":"               tenant_id\u003d\u0027aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_6fa17f93","line":106,"in_reply_to":"1abeadc6_97644423","updated":"2014-08-28 07:22:51.000000000","message":"Is this better? http://pastebin.com/UW9jfmvv","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"96fa22c1247fb1ca537133bb36d00b1575765273","unresolved":false,"context_lines":[{"line_number":103,"context_line":"                             admin_state_up\u003dTrue,"},{"line_number":104,"context_line":"                             subnets\u003d[fake_subnet1, fake_subnet2],"},{"line_number":105,"context_line":"                             ports\u003d[fake_port1]))"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"isolated_network \u003d dhcp.NetModel("},{"line_number":108,"context_line":"    True, dict(id\u003d\u002712345678-1234-5678-1234567890ab\u0027,"},{"line_number":109,"context_line":"               tenant_id\u003d\u0027aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_fe19be88","line":106,"in_reply_to":"1abeadc6_fe4e1e6e","updated":"2014-08-28 08:48:09.000000000","message":"Done","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"5c3d59044c2d2c1fa8e8c16054e622a6b2917a9e","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            \u0027neutron.agent.linux.external_process.ProcessManager\u0027"},{"line_number":494,"context_line":"        )"},{"line_number":495,"context_line":"        self.external_process \u003d self.external_process_p.start()"},{"line_number":496,"context_line":""},{"line_number":497,"context_line":"    def _enable_dhcp_helper(self, network, enable_isolated_metadata \u003d False,"},{"line_number":498,"context_line":"                            is_isolated_network \u003d False):"},{"line_number":499,"context_line":"        if enable_isolated_metadata:"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_a30aea87","line":496,"updated":"2014-08-27 17:54:15.000000000","message":"No spaces before/after the equal sign.","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"96fa22c1247fb1ca537133bb36d00b1575765273","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            \u0027neutron.agent.linux.external_process.ProcessManager\u0027"},{"line_number":494,"context_line":"        )"},{"line_number":495,"context_line":"        self.external_process \u003d self.external_process_p.start()"},{"line_number":496,"context_line":""},{"line_number":497,"context_line":"    def _enable_dhcp_helper(self, network, enable_isolated_metadata \u003d False,"},{"line_number":498,"context_line":"                            is_isolated_network \u003d False):"},{"line_number":499,"context_line":"        if enable_isolated_metadata:"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_1e1f5a6d","line":496,"in_reply_to":"1abeadc6_57b62c3f","updated":"2014-08-28 08:48:09.000000000","message":"Done","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"7dedc25abbffc4bfefbe3dbfb1c6c8580b1d4a84","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            \u0027neutron.agent.linux.external_process.ProcessManager\u0027"},{"line_number":494,"context_line":"        )"},{"line_number":495,"context_line":"        self.external_process \u003d self.external_process_p.start()"},{"line_number":496,"context_line":""},{"line_number":497,"context_line":"    def _enable_dhcp_helper(self, network, enable_isolated_metadata \u003d False,"},{"line_number":498,"context_line":"                            is_isolated_network \u003d False):"},{"line_number":499,"context_line":"        if enable_isolated_metadata:"}],"source_content_type":"text/x-python","patch_set":4,"id":"1abeadc6_57b62c3f","line":496,"in_reply_to":"1abeadc6_a30aea87","updated":"2014-08-27 19:02:43.000000000","message":"Will fix :)","commit_id":"1937881e3a1fdf8ca5df357dd8d028d47160317e"},{"author":{"_account_id":12737,"name":"Jacek Swiderski","email":"jacek.swiderski@codilime.com","username":"Altran"},"change_message_id":"f88a0330e6762aadbacd1ec525faeefde2b76eb5","unresolved":false,"context_lines":[{"line_number":104,"context_line":"                             subnets\u003d[fake_subnet1, fake_subnet2],"},{"line_number":105,"context_line":"                             ports\u003d[fake_port1]))"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"isolated_network \u003d dhcp.NetModel("},{"line_number":108,"context_line":"    True, dict("},{"line_number":109,"context_line":"        id\u003d\u002712345678-1234-5678-1234567890ab\u0027,"},{"line_number":110,"context_line":"        tenant_id\u003d\u0027aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"1abeadc6_f7eac10d","line":107,"updated":"2014-08-28 09:57:09.000000000","message":"Now we have 3 dhcp.NetModel each with different indentation, but alas this is not target of this change.","commit_id":"e3f67e9211f3e5ab0fcd976301b2b7a35d40c90c"}]}
