)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9970,"name":"John Kasperski","email":"jckasper@linux.vnet.ibm.com","username":"jckasper"},"change_message_id":"2db180e97557ee280899355fe12ae1427dccb68c","unresolved":false,"context_lines":[{"line_number":10,"context_line":"unhelpfully mixed up with the code for updating its subnet IDs and"},{"line_number":11,"context_line":"fixed IP addresses.  Clarify that by splitting the port-finding logic"},{"line_number":12,"context_line":"out into a separate _get_existing_dhcp_port subroutine."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I2a537560dc7a37299f4b7b4cd508d9309bbe1209"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"3a50d1a3_bea147fa","line":13,"updated":"2015-07-28 03:29:32.000000000","message":"Bug # or blue print ?","commit_id":"9b6ab107e7cb31528dc4ea1c4e72b1ebe9a9a02f"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"c57952fca105e9c3357ea825d4738db485a6a296","unresolved":false,"context_lines":[{"line_number":10,"context_line":"unhelpfully mixed up with the code for updating its subnet IDs and"},{"line_number":11,"context_line":"fixed IP addresses.  Clarify that by splitting the port-finding logic"},{"line_number":12,"context_line":"out into a separate _get_existing_dhcp_port subroutine."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I2a537560dc7a37299f4b7b4cd508d9309bbe1209"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"3a50d1a3_d348c45e","line":13,"in_reply_to":"3a50d1a3_bea147fa","updated":"2015-07-28 08:07:25.000000000","message":"Thanks, I\u0027ll add this.","commit_id":"9b6ab107e7cb31528dc4ea1c4e72b1ebe9a9a02f"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"aa9a38f2788d10af6fb84e2c8a3241d072f0de6f","unresolved":false,"context_lines":[{"line_number":11,"context_line":"fixed IP addresses.  Clarify that by splitting the port-finding logic"},{"line_number":12,"context_line":"out into a separate _get_existing_dhcp_port subroutine."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Related-Bug: #1472704"},{"line_number":15,"context_line":"Change-Id: I2a537560dc7a37299f4b7b4cd508d9309bbe1209"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"3a50d1a3_aa8c61d7","line":14,"updated":"2015-07-29 08:12:30.000000000","message":"why does this patch relate to bug #1472704","commit_id":"4144dc49e5a7b2842c81d0765803980f9d9d57d5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a142652800351b6cd2d32a5bdca02a72e6f3499f","unresolved":false,"context_lines":[{"line_number":11,"context_line":"fixed IP addresses.  Clarify that by splitting the port-finding logic"},{"line_number":12,"context_line":"out into a separate _get_existing_dhcp_port subroutine."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Related-Bug: #1472704"},{"line_number":15,"context_line":"Change-Id: I2a537560dc7a37299f4b7b4cd508d9309bbe1209"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"3a50d1a3_6531aaa1","line":14,"in_reply_to":"3a50d1a3_aa8c61d7","updated":"2015-07-29 09:07:57.000000000","message":"It\u0027s an enabler for follow-up changes (which partially address this bug)","commit_id":"4144dc49e5a7b2842c81d0765803980f9d9d57d5"}],"neutron/agent/linux/dhcp.py":[{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"e5b3e03ad5f4754bd5b61e4b9b7a2bd3435bd803","unresolved":false,"context_lines":[{"line_number":990,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":991,"context_line":"                return port"},{"line_number":992,"context_line":""},{"line_number":993,"context_line":"        # Otherwise return None."},{"line_number":994,"context_line":"        return None"},{"line_number":995,"context_line":""},{"line_number":996,"context_line":"    def setup_dhcp_port(self, network):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a50d1a3_b38e582c","line":993,"updated":"2015-07-28 08:17:43.000000000","message":"I think no need to return None","commit_id":"9b6ab107e7cb31528dc4ea1c4e72b1ebe9a9a02f"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"6c2eeb7d8d1c01caec11c093f126c6dc11b7a502","unresolved":false,"context_lines":[{"line_number":990,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":991,"context_line":"                return port"},{"line_number":992,"context_line":""},{"line_number":993,"context_line":"        # Otherwise return None."},{"line_number":994,"context_line":"        return None"},{"line_number":995,"context_line":""},{"line_number":996,"context_line":"    def setup_dhcp_port(self, network):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a50d1a3_4114c9e7","line":993,"in_reply_to":"3a50d1a3_b38e582c","updated":"2015-07-28 15:11:38.000000000","message":"Done","commit_id":"9b6ab107e7cb31528dc4ea1c4e72b1ebe9a9a02f"},{"author":{"_account_id":9970,"name":"John Kasperski","email":"jckasper@linux.vnet.ibm.com","username":"jckasper"},"change_message_id":"2db180e97557ee280899355fe12ae1427dccb68c","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"                   if subnet.enable_dhcp}"},{"line_number":1005,"context_line":""},{"line_number":1006,"context_line":"        # Get the DHCP port, if it already exists."},{"line_number":1007,"context_line":"        dhcp_port \u003d self._get_existing_dhcp_port(network)"},{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        if dhcp_port:"},{"line_number":1010,"context_line":"            # Compare what the subnets should be against what is"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a50d1a3_feb34f4b","line":1007,"updated":"2015-07-28 03:29:32.000000000","message":"Since device_id is already obtained on line 1000, could pass it in as parameter instead of retrieving it again on line 985.","commit_id":"9b6ab107e7cb31528dc4ea1c4e72b1ebe9a9a02f"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"c57952fca105e9c3357ea825d4738db485a6a296","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"                   if subnet.enable_dhcp}"},{"line_number":1005,"context_line":""},{"line_number":1006,"context_line":"        # Get the DHCP port, if it already exists."},{"line_number":1007,"context_line":"        dhcp_port \u003d self._get_existing_dhcp_port(network)"},{"line_number":1008,"context_line":""},{"line_number":1009,"context_line":"        if dhcp_port:"},{"line_number":1010,"context_line":"            # Compare what the subnets should be against what is"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a50d1a3_136aacb3","line":1007,"in_reply_to":"3a50d1a3_feb34f4b","updated":"2015-07-28 08:07:25.000000000","message":"Done","commit_id":"9b6ab107e7cb31528dc4ea1c4e72b1ebe9a9a02f"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"d8b3bc78da941b7e0ec8f53d102523eef1811526","unresolved":false,"context_lines":[{"line_number":988,"context_line":"                return port"},{"line_number":989,"context_line":""},{"line_number":990,"context_line":"        # Otherwise return None."},{"line_number":991,"context_line":"        return None"},{"line_number":992,"context_line":""},{"line_number":993,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":994,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"3a50d1a3_17c5a75a","line":991,"updated":"2015-07-28 13:33:25.000000000","message":"not needed as was mentioned in a previos patch set","commit_id":"d2e6352d9ac93fde75e28fc4ca4e50fd8a58aa74"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"7420d84dfd9186e24b42b394f9185c8abc4f7a72","unresolved":false,"context_lines":[{"line_number":988,"context_line":"                return port"},{"line_number":989,"context_line":""},{"line_number":990,"context_line":"        # Otherwise return None."},{"line_number":991,"context_line":"        return None"},{"line_number":992,"context_line":""},{"line_number":993,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":994,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"3a50d1a3_e15e35e8","line":991,"in_reply_to":"3a50d1a3_17c5a75a","updated":"2015-07-28 15:10:30.000000000","message":"Done","commit_id":"d2e6352d9ac93fde75e28fc4ca4e50fd8a58aa74"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"d8b3bc78da941b7e0ec8f53d102523eef1811526","unresolved":false,"context_lines":[{"line_number":997,"context_line":"        device_id \u003d self.get_device_id(network)"},{"line_number":998,"context_line":""},{"line_number":999,"context_line":"        # Get the set of DHCP-enabled subnets on this network."},{"line_number":1000,"context_line":"        subnets \u003d {subnet.id: subnet for subnet in network.subnets"},{"line_number":1001,"context_line":"                   if subnet.enable_dhcp}"},{"line_number":1002,"context_line":""},{"line_number":1003,"context_line":"        # Get the DHCP port, if it already exists."}],"source_content_type":"text/x-python","patch_set":4,"id":"3a50d1a3_577d6f1a","line":1000,"updated":"2015-07-28 13:33:25.000000000","message":"nit: dhcp_enabled_subnets for clarity","commit_id":"d2e6352d9ac93fde75e28fc4ca4e50fd8a58aa74"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"7420d84dfd9186e24b42b394f9185c8abc4f7a72","unresolved":false,"context_lines":[{"line_number":997,"context_line":"        device_id \u003d self.get_device_id(network)"},{"line_number":998,"context_line":""},{"line_number":999,"context_line":"        # Get the set of DHCP-enabled subnets on this network."},{"line_number":1000,"context_line":"        subnets \u003d {subnet.id: subnet for subnet in network.subnets"},{"line_number":1001,"context_line":"                   if subnet.enable_dhcp}"},{"line_number":1002,"context_line":""},{"line_number":1003,"context_line":"        # Get the DHCP port, if it already exists."}],"source_content_type":"text/x-python","patch_set":4,"id":"3a50d1a3_a154adc5","line":1000,"in_reply_to":"3a50d1a3_577d6f1a","updated":"2015-07-28 15:10:30.000000000","message":"Done","commit_id":"d2e6352d9ac93fde75e28fc4ca4e50fd8a58aa74"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a142652800351b6cd2d32a5bdca02a72e6f3499f","unresolved":false,"context_lines":[{"line_number":987,"context_line":"        dhcp_port \u003d None"},{"line_number":988,"context_line":"        for port in network.ports:"},{"line_number":989,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":990,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":991,"context_line":"                dhcp_enabled_subnet_ids \u003d set(subnets)"},{"line_number":992,"context_line":"                port_fixed_ips \u003d []"},{"line_number":993,"context_line":"                for fixed_ip in port.fixed_ips:"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_30b19ee0","side":"PARENT","line":990,"updated":"2015-07-29 09:07:57.000000000","message":"i am a bit surprised we don\u0027t check device_owner \u003d\u003d network:dhcp","commit_id":"95f88313444cd9eb40f0470d2733ab7ff1086fce"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"8b9fb5bb6a0270c08e20f19e3c82782ff8306d8e","unresolved":false,"context_lines":[{"line_number":987,"context_line":"        dhcp_port \u003d None"},{"line_number":988,"context_line":"        for port in network.ports:"},{"line_number":989,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":990,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":991,"context_line":"                dhcp_enabled_subnet_ids \u003d set(subnets)"},{"line_number":992,"context_line":"                port_fixed_ips \u003d []"},{"line_number":993,"context_line":"                for fixed_ip in port.fixed_ips:"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_6be5f135","side":"PARENT","line":990,"in_reply_to":"3a50d1a3_30b19ee0","updated":"2015-07-29 12:57:23.000000000","message":"It\u0027s not clear to me that there isn\u0027t a good reason for checking device_id instead, and I\u0027d rather not make that change here.  (Clearly, if someone wants to propose a patch to make that change, they can do so...)","commit_id":"95f88313444cd9eb40f0470d2733ab7ff1086fce"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"9ff918c735694ea382ef31a30235917f52c5ce81","unresolved":false,"context_lines":[{"line_number":987,"context_line":"        dhcp_port \u003d None"},{"line_number":988,"context_line":"        for port in network.ports:"},{"line_number":989,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":990,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":991,"context_line":"                dhcp_enabled_subnet_ids \u003d set(subnets)"},{"line_number":992,"context_line":"                port_fixed_ips \u003d []"},{"line_number":993,"context_line":"                for fixed_ip in port.fixed_ips:"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_020a0a79","side":"PARENT","line":990,"in_reply_to":"3a50d1a3_6be5f135","updated":"2015-07-29 14:18:11.000000000","message":"My remark is out of change scope\n\nChecking device_id is required as you can have multiple dhcp port for a specific network when it\u0027s deployed on multiple dhcp agents","commit_id":"95f88313444cd9eb40f0470d2733ab7ff1086fce"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a142652800351b6cd2d32a5bdca02a72e6f3499f","unresolved":false,"context_lines":[{"line_number":980,"context_line":"    def _get_existing_dhcp_port(self, network, device_id):"},{"line_number":981,"context_line":"        \"\"\"Get DHCP port for the specified network, if it already exists.\"\"\""},{"line_number":982,"context_line":""},{"line_number":983,"context_line":"        # If we have a port with the ID that the DHCP port should"},{"line_number":984,"context_line":"        # have, return it."},{"line_number":985,"context_line":"        for port in network.ports:"},{"line_number":986,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_0597863a","line":983,"updated":"2015-07-29 09:07:57.000000000","message":"imo, this comment is useless (ie: L985-987 are clear enough)","commit_id":"4144dc49e5a7b2842c81d0765803980f9d9d57d5"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"e30b79411cea83eb5b5660505dc513b9d7736d0c","unresolved":false,"context_lines":[{"line_number":980,"context_line":"    def _get_existing_dhcp_port(self, network, device_id):"},{"line_number":981,"context_line":"        \"\"\"Get DHCP port for the specified network, if it already exists.\"\"\""},{"line_number":982,"context_line":""},{"line_number":983,"context_line":"        # If we have a port with the ID that the DHCP port should"},{"line_number":984,"context_line":"        # have, return it."},{"line_number":985,"context_line":"        for port in network.ports:"},{"line_number":986,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_712e4544","line":983,"in_reply_to":"3a50d1a3_0597863a","updated":"2015-07-29 11:12:46.000000000","message":"OK, I\u0027ll remove that comment in next upload.","commit_id":"4144dc49e5a7b2842c81d0765803980f9d9d57d5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a142652800351b6cd2d32a5bdca02a72e6f3499f","unresolved":false,"context_lines":[{"line_number":987,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":988,"context_line":"                return port"},{"line_number":989,"context_line":""},{"line_number":990,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":991,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""},{"line_number":992,"context_line":""},{"line_number":993,"context_line":"        # The ID that the DHCP port will have (or already has)."}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_b02dae90","line":990,"updated":"2015-07-29 09:07:57.000000000","message":"It seems to be a lot of changes without really clarifying setup_dhcp_port and it gets worse with follow-up change[1]. I would prefer you split this method, perhaps something like:\n\n\n def setup_dhcp_port(self, network):\n    device_id \u003d self.get_device_id(network)\n    dhcp_enabled_subnets \u003d ...\n\n    dhcp_port \u003d self.get_network_port(network, device_id)\n    if dhcp_port:\n      dhcp_port \u003d self.setup_existing_port(network, device_id, dhcp_enabled_subnets)\n    else:\n      dhcp_port \u003d self.setup_reserved_port(network, device_id)\n      if not dhcp_port:\n         dhcp_port \u003d self.setup_new_port(network, device_id, dhcp_enabled_subnets)\n\n    if not dhcp_port:\n      raise exceptions.Conflict\n\n    # Convert subnet_id to subnet dict\n    ...\n    return dhcp_port\n\nbecause the same pattern is used over and over, it seems better to do:\n\n def setup_dhcp_port(self, network):\n    device_id \u003d self.get_device_id(network)\n    dhcp_enabled_subnets \u003d ...\n\n    methods \u003d (self.setup_existing_port, self.setup_reserved_port, self.setup_new_port)\n    for method in methods:\n      dhcp_port \u003d method(network, device_id, dhcp_enabled_subnets)\n      if dhcp_port:\n        break\n    else:\n      raise exceptions.Conflict\n\n    # Convert subnet_id to subnet dict\n    ...\n    return dhcp_port\n\n\n[1] https://review.openstack.org/#/c/206078/4/neutron/agent/linux/dhcp.py","commit_id":"4144dc49e5a7b2842c81d0765803980f9d9d57d5"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"e30b79411cea83eb5b5660505dc513b9d7736d0c","unresolved":false,"context_lines":[{"line_number":987,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":988,"context_line":"                return port"},{"line_number":989,"context_line":""},{"line_number":990,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":991,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""},{"line_number":992,"context_line":""},{"line_number":993,"context_line":"        # The ID that the DHCP port will have (or already has)."}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_1193415c","line":990,"in_reply_to":"3a50d1a3_b02dae90","updated":"2015-07-29 11:12:46.000000000","message":"Yes, I agree that that would be a nice structure.  Although I\u0027m worried that other reviewers might think differently, and I could end up just changing this kind of thing over and over again...\n\nBut actually I\u0027m sufficiently convinced to just do this now - so please watch for new upload soon.","commit_id":"4144dc49e5a7b2842c81d0765803980f9d9d57d5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a142652800351b6cd2d32a5bdca02a72e6f3499f","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"                    raise exceptions.Conflict()"},{"line_number":1034,"context_line":""},{"line_number":1035,"context_line":"        # check for a reserved DHCP port"},{"line_number":1036,"context_line":"        if dhcp_port is None:"},{"line_number":1037,"context_line":"            LOG.debug(\u0027DHCP port %(device_id)s on network %(network_id)s\u0027"},{"line_number":1038,"context_line":"                      \u0027 does not yet exist. Checking for a reserved port.\u0027,"},{"line_number":1039,"context_line":"                      {\u0027device_id\u0027: device_id, \u0027network_id\u0027: network.id})"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_85a87621","line":1036,"updated":"2015-07-29 09:07:57.000000000","message":"you can replace:\n\n  if dhcp_port is None:\n\nby:\n\n  else:\n\nbecause:\n\n* if dhcp_port is None in L1002 then L1003 condition is not verified\n* if dhcp_port is not None in L1002 then  L1032 ensures to stop execution if dhcp_port is None","commit_id":"4144dc49e5a7b2842c81d0765803980f9d9d57d5"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"e30b79411cea83eb5b5660505dc513b9d7736d0c","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"                    raise exceptions.Conflict()"},{"line_number":1034,"context_line":""},{"line_number":1035,"context_line":"        # check for a reserved DHCP port"},{"line_number":1036,"context_line":"        if dhcp_port is None:"},{"line_number":1037,"context_line":"            LOG.debug(\u0027DHCP port %(device_id)s on network %(network_id)s\u0027"},{"line_number":1038,"context_line":"                      \u0027 does not yet exist. Checking for a reserved port.\u0027,"},{"line_number":1039,"context_line":"                      {\u0027device_id\u0027: device_id, \u0027network_id\u0027: network.id})"}],"source_content_type":"text/x-python","patch_set":5,"id":"3a50d1a3_d16f195e","line":1036,"in_reply_to":"3a50d1a3_85a87621","updated":"2015-07-29 11:12:46.000000000","message":"This comment will be made irrelevant, by the bigger change that you suggested above.","commit_id":"4144dc49e5a7b2842c81d0765803980f9d9d57d5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"7971707dc5a5814a832c9aa33ee09572a101532d","unresolved":false,"context_lines":[{"line_number":977,"context_line":""},{"line_number":978,"context_line":"            device.route.delete_gateway(gateway)"},{"line_number":979,"context_line":""},{"line_number":980,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":981,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""},{"line_number":982,"context_line":""},{"line_number":983,"context_line":"        device_id \u003d self.get_device_id(network)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_7d560f2b","side":"PARENT","line":980,"updated":"2015-07-29 14:36:53.000000000","message":"Am i blind or there is no unittest for this code?","commit_id":"12aa832ede1e27e68d055fedf699de53ec57746d"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"c073399d9842861596a80fffbeb90e56fe75694d","unresolved":false,"context_lines":[{"line_number":977,"context_line":""},{"line_number":978,"context_line":"            device.route.delete_gateway(gateway)"},{"line_number":979,"context_line":""},{"line_number":980,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":981,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""},{"line_number":982,"context_line":""},{"line_number":983,"context_line":"        device_id \u003d self.get_device_id(network)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_321751a4","side":"PARENT","line":980,"in_reply_to":"3a50d1a3_7d560f2b","updated":"2015-07-29 15:08:07.000000000","message":"Yes, unfortunately it appears that there is no existing unit test at all for the DeviceManager class!","commit_id":"12aa832ede1e27e68d055fedf699de53ec57746d"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"7971707dc5a5814a832c9aa33ee09572a101532d","unresolved":false,"context_lines":[{"line_number":981,"context_line":"        \"\"\"Set up the existing DHCP port, if there is one.\"\"\""},{"line_number":982,"context_line":""},{"line_number":983,"context_line":"        # Look for an existing DHCP for this network."},{"line_number":984,"context_line":"        for port in network.ports:"},{"line_number":985,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":986,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":987,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_7d1e0fbc","line":984,"updated":"2015-07-29 14:36:53.000000000","message":"imo, it\u0027s more readable to reduce indentation when possible\n\n  for port in network.ports:\n    if ...:\n      break\n  else:\n    return None\n\n  ...","commit_id":"7e5311fbd45b147ebc578a3bc4beb2b5668cd7a5"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"c073399d9842861596a80fffbeb90e56fe75694d","unresolved":false,"context_lines":[{"line_number":981,"context_line":"        \"\"\"Set up the existing DHCP port, if there is one.\"\"\""},{"line_number":982,"context_line":""},{"line_number":983,"context_line":"        # Look for an existing DHCP for this network."},{"line_number":984,"context_line":"        for port in network.ports:"},{"line_number":985,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":986,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":987,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_6fc1764d","line":984,"in_reply_to":"3a50d1a3_7d1e0fbc","updated":"2015-07-29 15:08:07.000000000","message":"OK....","commit_id":"7e5311fbd45b147ebc578a3bc4beb2b5668cd7a5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"7971707dc5a5814a832c9aa33ee09572a101532d","unresolved":false,"context_lines":[{"line_number":1046,"context_line":"            fixed_ips\u003d[dict(subnet_id\u003ds) for s in dhcp_subnets])"},{"line_number":1047,"context_line":"        port \u003d self.plugin.create_dhcp_port({\u0027port\u0027: port_dict})"},{"line_number":1048,"context_line":"        if not port:"},{"line_number":1049,"context_line":"            raise exceptions.Conflict()"},{"line_number":1050,"context_line":"        return port"},{"line_number":1051,"context_line":""},{"line_number":1052,"context_line":"    def setup_dhcp_port(self, network):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_9db2fb47","line":1049,"updated":"2015-07-29 14:36:53.000000000","message":"the check is already done in setup_dhcp_port","commit_id":"7e5311fbd45b147ebc578a3bc4beb2b5668cd7a5"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"c073399d9842861596a80fffbeb90e56fe75694d","unresolved":false,"context_lines":[{"line_number":1046,"context_line":"            fixed_ips\u003d[dict(subnet_id\u003ds) for s in dhcp_subnets])"},{"line_number":1047,"context_line":"        port \u003d self.plugin.create_dhcp_port({\u0027port\u0027: port_dict})"},{"line_number":1048,"context_line":"        if not port:"},{"line_number":1049,"context_line":"            raise exceptions.Conflict()"},{"line_number":1050,"context_line":"        return port"},{"line_number":1051,"context_line":""},{"line_number":1052,"context_line":"    def setup_dhcp_port(self, network):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_ef8266fe","line":1049,"in_reply_to":"3a50d1a3_9db2fb47","updated":"2015-07-29 15:08:07.000000000","message":"No it isn\u0027t.  Why do you say that?","commit_id":"7e5311fbd45b147ebc578a3bc4beb2b5668cd7a5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"7971707dc5a5814a832c9aa33ee09572a101532d","unresolved":false,"context_lines":[{"line_number":1074,"context_line":""},{"line_number":1075,"context_line":"        # We must now have a port.  (Otherwise the preceding code has"},{"line_number":1076,"context_line":"        # already raised a Conflict exception.)"},{"line_number":1077,"context_line":"        assert dhcp_port"},{"line_number":1078,"context_line":""},{"line_number":1079,"context_line":"        # Convert subnet_id to subnet dict"},{"line_number":1080,"context_line":"        fixed_ips \u003d [dict(subnet_id\u003dfixed_ip.subnet_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_8204da17","line":1077,"updated":"2015-07-29 14:36:53.000000000","message":"beurk, prefer a more meaningful and lazy implementation :\n\n  for ...\n  else:\n    raise exception.Conflict","commit_id":"7e5311fbd45b147ebc578a3bc4beb2b5668cd7a5"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"c073399d9842861596a80fffbeb90e56fe75694d","unresolved":false,"context_lines":[{"line_number":1074,"context_line":""},{"line_number":1075,"context_line":"        # We must now have a port.  (Otherwise the preceding code has"},{"line_number":1076,"context_line":"        # already raised a Conflict exception.)"},{"line_number":1077,"context_line":"        assert dhcp_port"},{"line_number":1078,"context_line":""},{"line_number":1079,"context_line":"        # Convert subnet_id to subnet dict"},{"line_number":1080,"context_line":"        fixed_ips \u003d [dict(subnet_id\u003dfixed_ip.subnet_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a50d1a3_52745d34","line":1077,"in_reply_to":"3a50d1a3_8204da17","updated":"2015-07-29 15:08:07.000000000","message":"What does \"beurk\" mean?\n\nI think you haven\u0027t understood the \"assert\" here.  This is an assertion in the sense of an internal code consistency check - in other words it is a check that will never ever fail, unless someone changes the code in an incorrect way, or a cosmic ray causes dhcp_port to change from non-None to None at line 1074 :-)\n\nSpecifically, it is quite different from the uses of \"raise exceptions.Conflict()\", which are plausible runtime errors indicating that, for some reason, the Neutron server couldn\u0027t process its update_dhcp_port or create_dhcp_port calls.\n\nAlso please note that I have been careful here to preserve the exact existing behaviour.  Specifically, note that the previous code does not check for update_dhcp_port returning None in the reserved port case, and so does not raise a Conflict exception in that case.\n\nBecause of that, it would be wrong - or at least a change in behaviour - to remove the \"raise\" calls from the subroutines, and instead add\n\n    if not dhcp_port:\n        raise exceptions.Conflict()\n\nin setup_dhcp_port.  Behaviour would be different - for example - if the DHCP port already existed, but the update_dhcp_port call returned None.\n\nI appreciate hearing about the for ... else ... construct, as I didn\u0027t know about that.  However, it would also be less maintainable to change the current code to:\n\n    for ...\n    else:\n        assert False\n\nbecause that leaves the possibility that someone might add or change the last _setup... method such that it can return None, and hence result in dhcp_port being None.\n\nIn summary, I believe that your points here are mistaken, and that the code is already exactly correct as it is.","commit_id":"7e5311fbd45b147ebc578a3bc4beb2b5668cd7a5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"35c99715e40abc60221e37c296eea544a35d5305","unresolved":false,"context_lines":[{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"        # We must now have a port.  (Otherwise the preceding code has"},{"line_number":1079,"context_line":"        # already raised a Conflict exception.)"},{"line_number":1080,"context_line":"        assert dhcp_port"},{"line_number":1081,"context_line":""},{"line_number":1082,"context_line":"        # Convert subnet_id to subnet dict"},{"line_number":1083,"context_line":"        fixed_ips \u003d [dict(subnet_id\u003dfixed_ip.subnet_id,"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a50d1a3_35fc09b4","line":1080,"updated":"2015-07-29 21:01:44.000000000","message":"IMO, using assert to ensure some implementation properties is a bad practice. First they ensure nothing in general as optimized bytecode doesn\u0027t check assertions:\n\n  blah:~$ python -c \u0027assert 1\u003d\u003d2\u0027\n  Traceback (most recent call last):\n    File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e\n  AssertionError\n\n  blah:~$ python -O -c \u0027assert 1\u003d\u003d2\u0027\n\nSecondly they provide really low level stacktrace information\n\n\nMoreover the pattern:\n\n  for setup_method in ...:\n     ...\n  assert dhcp_port\n\nASSUMES about setup_methods will raise Conflict when needed, where:\n  \n  for setup_method in ...:\n     ...\n     if dhcp_port:\n        break\n  else:\n    raise exception.Conflict\n\nENSURES to raise Conflict when needed.","commit_id":"10d81387d7bf279ffd5bccb9d669a33215c3bea5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"19ec079d5046bea2bb6197808596fe8a60514c34","unresolved":false,"context_lines":[{"line_number":986,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":987,"context_line":"                break"},{"line_number":988,"context_line":"        else:"},{"line_number":989,"context_line":"            port \u003d None"},{"line_number":990,"context_line":""},{"line_number":991,"context_line":"        if port:"},{"line_number":992,"context_line":"            # Compare what the subnets should be against what is"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_75b915cb","line":989,"updated":"2015-07-30 11:12:23.000000000","message":"you can do\n\n else:\n   return None\n\nit avoids to check port in L991","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"5c5c8051115dbe306cbdb95a6dcaca5b15043aa8","unresolved":false,"context_lines":[{"line_number":986,"context_line":"            if port_device_id \u003d\u003d device_id:"},{"line_number":987,"context_line":"                break"},{"line_number":988,"context_line":"        else:"},{"line_number":989,"context_line":"            port \u003d None"},{"line_number":990,"context_line":""},{"line_number":991,"context_line":"        if port:"},{"line_number":992,"context_line":"            # Compare what the subnets should be against what is"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_34ed9d8e","line":989,"in_reply_to":"3a50d1a3_75b915cb","updated":"2015-07-31 10:40:08.000000000","message":"Nice, I\u0027ll do this in my next revision.","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"44ff18cff56b76ffaa045978cc18cb36732f0112","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1034,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1035,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1036,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    def _setup_new_dhcp_port(self, network, device_id, dhcp_subnets):"},{"line_number":1039,"context_line":"        \"\"\"Create and set up new DHCP port for the specified network.\"\"\""}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_e85523fa","line":1036,"updated":"2015-07-31 07:37:42.000000000","message":"don\u0027t we need to update fixed ips with dhcp_subnets?","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"cb77de1db3ba74f268c410e78e2be2dbf0fbba31","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1034,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1035,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1036,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    def _setup_new_dhcp_port(self, network, device_id, dhcp_subnets):"},{"line_number":1039,"context_line":"        \"\"\"Create and set up new DHCP port for the specified network.\"\"\""}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_2c61d1d3","line":1036,"in_reply_to":"3a50d1a3_26da5018","updated":"2015-07-31 12:44:22.000000000","message":"But surely (1) we ought to be sure about whether there is a bug here, before changing the code speculatively, and (2) if there is a bug, it should be fixed under a separate piece of work from this restructuring change?\n\nSo I really can\u0027t see an argument at all for changing this detail as part of this patch.","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"8fb9672a09b329ac0af7c75e84e0b4e668091042","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1034,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1035,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1036,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    def _setup_new_dhcp_port(self, network, device_id, dhcp_subnets):"},{"line_number":1039,"context_line":"        \"\"\"Create and set up new DHCP port for the specified network.\"\"\""}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_cf213fa0","line":1036,"in_reply_to":"3a50d1a3_2c61d1d3","updated":"2015-07-31 13:01:43.000000000","message":"Agree","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"7d914056dae4065605d279884db73c58054211ed","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1034,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1035,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1036,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    def _setup_new_dhcp_port(self, network, device_id, dhcp_subnets):"},{"line_number":1039,"context_line":"        \"\"\"Create and set up new DHCP port for the specified network.\"\"\""}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_cc270d62","line":1036,"in_reply_to":"3a50d1a3_2c61d1d3","updated":"2015-07-31 12:53:09.000000000","message":"imo, it should be done in a specific change as this change \"only\" reorganizes the code without changing the logic","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"56020f9291d257b86c6e8ed98dd18c7e337ed591","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1034,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1035,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1036,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    def _setup_new_dhcp_port(self, network, device_id, dhcp_subnets):"},{"line_number":1039,"context_line":"        \"\"\"Create and set up new DHCP port for the specified network.\"\"\""}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_26da5018","line":1036,"in_reply_to":"3a50d1a3_944831b5","updated":"2015-07-31 12:16:59.000000000","message":"I\u0027d not rely on reserved port to already have all needed fixed ips. This is probably a bug in the old code. I think the logic for fixed ips should be at least the same as in _setup_existing_dhcp_port.","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"5c5c8051115dbe306cbdb95a6dcaca5b15043aa8","unresolved":false,"context_lines":[{"line_number":1033,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1034,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1035,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1036,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1037,"context_line":""},{"line_number":1038,"context_line":"    def _setup_new_dhcp_port(self, network, device_id, dhcp_subnets):"},{"line_number":1039,"context_line":"        \"\"\"Create and set up new DHCP port for the specified network.\"\"\""}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_944831b5","line":1036,"in_reply_to":"3a50d1a3_e85523fa","updated":"2015-07-31 10:40:08.000000000","message":"Yes, I noticed and wondered that too.  But I\u0027m just following exactly what the existing code does in this case - please see lines 1024-1026 in the old code.\n\nI don\u0027t yet fully understand the reserved port case.  It seems though that it\u0027s used when a network is descheduled from a particular DHCP agent - perhaps because that agent appears temporarily to have gone down.  And then, I guess, rescheduled to that DHCP agent when it comes back up again?\n\nSo perhaps the logic is that no updating of fixed_ips and subnets should be needed in the reserved port case, because the port already had correct fixed_ips and subnets just before it became reserved.","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"44ff18cff56b76ffaa045978cc18cb36732f0112","unresolved":false,"context_lines":[{"line_number":1038,"context_line":"    def _setup_new_dhcp_port(self, network, device_id, dhcp_subnets):"},{"line_number":1039,"context_line":"        \"\"\"Create and set up new DHCP port for the specified network.\"\"\""},{"line_number":1040,"context_line":"        LOG.debug(\u0027DHCP port %(device_id)s on network %(network_id)s\u0027"},{"line_number":1041,"context_line":"                  \u0027 does not yet exist.\u0027, {\u0027device_id\u0027: device_id,"},{"line_number":1042,"context_line":"                                           \u0027network_id\u0027: network.id})"},{"line_number":1043,"context_line":"        port_dict \u003d dict("},{"line_number":1044,"context_line":"            name\u003d\u0027\u0027,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_683353f7","line":1041,"updated":"2015-07-31 07:37:42.000000000","message":"nit: may also add \u0027Creating new one.\u0027 for consistency with 1029","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"5c5c8051115dbe306cbdb95a6dcaca5b15043aa8","unresolved":false,"context_lines":[{"line_number":1038,"context_line":"    def _setup_new_dhcp_port(self, network, device_id, dhcp_subnets):"},{"line_number":1039,"context_line":"        \"\"\"Create and set up new DHCP port for the specified network.\"\"\""},{"line_number":1040,"context_line":"        LOG.debug(\u0027DHCP port %(device_id)s on network %(network_id)s\u0027"},{"line_number":1041,"context_line":"                  \u0027 does not yet exist.\u0027, {\u0027device_id\u0027: device_id,"},{"line_number":1042,"context_line":"                                           \u0027network_id\u0027: network.id})"},{"line_number":1043,"context_line":"        port_dict \u003d dict("},{"line_number":1044,"context_line":"            name\u003d\u0027\u0027,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a50d1a3_549709eb","line":1041,"in_reply_to":"3a50d1a3_683353f7","updated":"2015-07-31 10:40:08.000000000","message":"Nice, I\u0027ll do this in my next revision.","commit_id":"9c6aa3596c25a1454e10c8bec21e79f800db3327"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"71470b85106bf4d2e465d522f19430fabe6d62fd","unresolved":false,"context_lines":[{"line_number":1052,"context_line":"        for port in network.ports:"},{"line_number":1053,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":1054,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1055,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1056,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1057,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1058,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"fa1b9901_b913225c","line":1055,"updated":"2015-08-17 21:21:42.000000000","message":"the original code is:\n\n dhcp_port \u003d self.plugin.update_dhcp_port(...)\n if dhcp_port:\n   break\n\nso the equivalent code should be:\n\n dhcp_port \u003d self.plugin.update_dhcp_port(...)\n if dhcp_port:\n   return dhcp_port\n\nIs it normal? If yes, how do we ensure dhcp_port !\u003dNone?","commit_id":"e106af5c73d200f4f8a94492c0f438cff13c1f81"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"151f42225c795c832bbd2dbc2f0e55959ac44963","unresolved":false,"context_lines":[{"line_number":1052,"context_line":"        for port in network.ports:"},{"line_number":1053,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":1054,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1055,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1056,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1057,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1058,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"fa1b9901_f920a1f9","line":1055,"in_reply_to":"fa1b9901_1918f51c","updated":"2015-08-18 10:11:53.000000000","message":"See your point now, not sure however in what case plugin will return None. I guess it will raise an error in case of unsuccessful update.","commit_id":"e106af5c73d200f4f8a94492c0f438cff13c1f81"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"8d296477736d107cc261ed4fc2efdf6eec928b38","unresolved":false,"context_lines":[{"line_number":1052,"context_line":"        for port in network.ports:"},{"line_number":1053,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":1054,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1055,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1056,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1057,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1058,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"fa1b9901_1918f51c","line":1055,"in_reply_to":"fa1b9901_4c0eb435","updated":"2015-08-18 10:04:16.000000000","message":"yes but only if we assume there is at most one port per network with device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT","commit_id":"e106af5c73d200f4f8a94492c0f438cff13c1f81"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"da13a8175cfe3541c7db0965bee12f64ce3a7d4f","unresolved":false,"context_lines":[{"line_number":1052,"context_line":"        for port in network.ports:"},{"line_number":1053,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":1054,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1055,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1056,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1057,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1058,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"fa1b9901_4c0eb435","line":1055,"in_reply_to":"fa1b9901_b913225c","updated":"2015-08-18 05:52:04.000000000","message":"I believe 1092-1097 preserves equality of the code","commit_id":"e106af5c73d200f4f8a94492c0f438cff13c1f81"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"ac375dfd0e274954abc544ae34733bc4ffafb391","unresolved":false,"context_lines":[{"line_number":1052,"context_line":"        for port in network.ports:"},{"line_number":1053,"context_line":"            port_device_id \u003d getattr(port, \u0027device_id\u0027, None)"},{"line_number":1054,"context_line":"            if port_device_id \u003d\u003d constants.DEVICE_ID_RESERVED_DHCP_PORT:"},{"line_number":1055,"context_line":"                return self.plugin.update_dhcp_port("},{"line_number":1056,"context_line":"                    port.id, {\u0027port\u0027: {\u0027network_id\u0027: network.id,"},{"line_number":1057,"context_line":"                                       \u0027device_id\u0027: device_id}})"},{"line_number":1058,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"fa1b9901_cbd86056","line":1055,"in_reply_to":"fa1b9901_f920a1f9","updated":"2015-08-18 10:23:27.000000000","message":"I think Cedric is correct.  I\u0027ll add a test to cover the relevant scenario - i.e. where a network has two reserved ports, and update_dhcp_port fails for the first one; then verify that the new code does behave differently in that case; then fix that.","commit_id":"e106af5c73d200f4f8a94492c0f438cff13c1f81"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"293867a8940a5cf7979636999e9c72233a12dea5","unresolved":false,"context_lines":[{"line_number":1073,"context_line":"        port \u003d self.plugin.create_dhcp_port({\u0027port\u0027: port_dict})"},{"line_number":1074,"context_line":"        if not port:"},{"line_number":1075,"context_line":"            raise exceptions.Conflict()"},{"line_number":1076,"context_line":"        return port"},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":1079,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_f10b5522","line":1076,"updated":"2015-08-20 14:19:59.000000000","message":"These three lines seem redundant.  If we fail to create a new port, it\u0027s fine to return None to the caller, as they will raise if that happens.","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"2662abd060fb88284dfed0d429f7a66545b5e74b","unresolved":false,"context_lines":[{"line_number":1073,"context_line":"        port \u003d self.plugin.create_dhcp_port({\u0027port\u0027: port_dict})"},{"line_number":1074,"context_line":"        if not port:"},{"line_number":1075,"context_line":"            raise exceptions.Conflict()"},{"line_number":1076,"context_line":"        return port"},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":1079,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_e2102c02","line":1076,"in_reply_to":"fa1b9901_69bd03d7","updated":"2015-08-21 11:56:54.000000000","message":"Done, thanks!","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"8f89670f56edd01a69fc549a4dd4f8ba68d5917e","unresolved":false,"context_lines":[{"line_number":1073,"context_line":"        port \u003d self.plugin.create_dhcp_port({\u0027port\u0027: port_dict})"},{"line_number":1074,"context_line":"        if not port:"},{"line_number":1075,"context_line":"            raise exceptions.Conflict()"},{"line_number":1076,"context_line":"        return port"},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":1079,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_69bd03d7","line":1076,"in_reply_to":"fa1b9901_a185805a","updated":"2015-08-20 22:42:07.000000000","message":"+1 :)","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"004096dafcf2516de61f44c4efe3e0d7641ea005","unresolved":false,"context_lines":[{"line_number":1073,"context_line":"        port \u003d self.plugin.create_dhcp_port({\u0027port\u0027: port_dict})"},{"line_number":1074,"context_line":"        if not port:"},{"line_number":1075,"context_line":"            raise exceptions.Conflict()"},{"line_number":1076,"context_line":"        return port"},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":1079,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_a185805a","line":1076,"in_reply_to":"fa1b9901_b425cb09","updated":"2015-08-20 16:58:40.000000000","message":"Well, both _setup_existing_dhcp_port() and _setup_reserved_dhcp_port() can return None, but they only raise if the update of an existing port fails, because in that case we don\u0027t want the caller to continue and accidentally create a new one.\n\nTo me the reason to remove this is that there is no way to hit this and L1101 in a production environment, only in a synthetic unit test, and I think it\u0027s better to catch it below since it will cover current, and any future callers that might get added.\n\nThat\u0027s my $.02, don\u0027t know what Cedric thinks as he\u0027s been pretty active on this review as well.","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"ae2828fffaebca3654172427f66db5c7bbcd6959","unresolved":false,"context_lines":[{"line_number":1073,"context_line":"        port \u003d self.plugin.create_dhcp_port({\u0027port\u0027: port_dict})"},{"line_number":1074,"context_line":"        if not port:"},{"line_number":1075,"context_line":"            raise exceptions.Conflict()"},{"line_number":1076,"context_line":"        return port"},{"line_number":1077,"context_line":""},{"line_number":1078,"context_line":"    def setup_dhcp_port(self, network):"},{"line_number":1079,"context_line":"        \"\"\"Create/update DHCP port for the host if needed and return port.\"\"\""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_b425cb09","line":1076,"in_reply_to":"fa1b9901_f10b5522","updated":"2015-08-20 14:44:28.000000000","message":"Well yes, that\u0027s true, but only by virtue of _setup_new_dhcp_port being the _last_ method that setup_dhcp_port will try.  (One can\u0027t make a similar argument for _setup_existing_dhcp_port, for example.)\n\nSo I think this is a maintainability question.  Is it fundamental that _setup_new_dhcp_port will always be the last method tried, or is it plausible that further _setup methods might be added in future _after_ _setup_new_dhcp_port?  In the latter case, I\u0027d say there\u0027s a case for retaining these lines so that there will always be a Conflict exception if the server tries but fails to create a new DHCP port.\n\nIn fact I suppose it is fundamental - unless there is ever some new recovery method specifically _for_ the case where the server fails to create a new port - and in that case it would obviously be desirable to stop raising a Conlict() in _setup_new_dhcp_port.  So, I agree with you.","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"293867a8940a5cf7979636999e9c72233a12dea5","unresolved":false,"context_lines":[{"line_number":1098,"context_line":"            if dhcp_port:"},{"line_number":1099,"context_line":"                break"},{"line_number":1100,"context_line":"        else:"},{"line_number":1101,"context_line":"            raise exceptions.Conflict()"},{"line_number":1102,"context_line":""},{"line_number":1103,"context_line":"        # Convert subnet_id to subnet dict"},{"line_number":1104,"context_line":"        fixed_ips \u003d [dict(subnet_id\u003dfixed_ip.subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_be24ccc4","line":1101,"updated":"2015-08-20 14:19:59.000000000","message":"I don\u0027t think this will ever get called as _setup_new_dhcp_port() will never return None, see my other comment.","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"004096dafcf2516de61f44c4efe3e0d7641ea005","unresolved":false,"context_lines":[{"line_number":1098,"context_line":"            if dhcp_port:"},{"line_number":1099,"context_line":"                break"},{"line_number":1100,"context_line":"        else:"},{"line_number":1101,"context_line":"            raise exceptions.Conflict()"},{"line_number":1102,"context_line":""},{"line_number":1103,"context_line":"        # Convert subnet_id to subnet dict"},{"line_number":1104,"context_line":"        fixed_ips \u003d [dict(subnet_id\u003dfixed_ip.subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_5b3a57e8","line":1101,"in_reply_to":"fa1b9901_34ce9b2e","updated":"2015-08-20 16:58:40.000000000","message":"Yes, this would have to stay.","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"8f89670f56edd01a69fc549a4dd4f8ba68d5917e","unresolved":false,"context_lines":[{"line_number":1098,"context_line":"            if dhcp_port:"},{"line_number":1099,"context_line":"                break"},{"line_number":1100,"context_line":"        else:"},{"line_number":1101,"context_line":"            raise exceptions.Conflict()"},{"line_number":1102,"context_line":""},{"line_number":1103,"context_line":"        # Convert subnet_id to subnet dict"},{"line_number":1104,"context_line":"        fixed_ips \u003d [dict(subnet_id\u003dfixed_ip.subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_e9fcb3b9","line":1101,"in_reply_to":"fa1b9901_5b3a57e8","updated":"2015-08-20 22:42:07.000000000","message":"+1, it ensures dhcp_port is not None even if we update/add/remove setup_methods","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"ae2828fffaebca3654172427f66db5c7bbcd6959","unresolved":false,"context_lines":[{"line_number":1098,"context_line":"            if dhcp_port:"},{"line_number":1099,"context_line":"                break"},{"line_number":1100,"context_line":"        else:"},{"line_number":1101,"context_line":"            raise exceptions.Conflict()"},{"line_number":1102,"context_line":""},{"line_number":1103,"context_line":"        # Convert subnet_id to subnet dict"},{"line_number":1104,"context_line":"        fixed_ips \u003d [dict(subnet_id\u003dfixed_ip.subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_34ce9b2e","line":1101,"in_reply_to":"fa1b9901_be24ccc4","updated":"2015-08-20 14:44:28.000000000","message":"But if we delete the Conflict() raising in _setup_new_dhcp_port(), presumably you agree that it should be retained here?","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"2662abd060fb88284dfed0d429f7a66545b5e74b","unresolved":false,"context_lines":[{"line_number":1098,"context_line":"            if dhcp_port:"},{"line_number":1099,"context_line":"                break"},{"line_number":1100,"context_line":"        else:"},{"line_number":1101,"context_line":"            raise exceptions.Conflict()"},{"line_number":1102,"context_line":""},{"line_number":1103,"context_line":"        # Convert subnet_id to subnet dict"},{"line_number":1104,"context_line":"        fixed_ips \u003d [dict(subnet_id\u003dfixed_ip.subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_e227cc60","line":1101,"in_reply_to":"fa1b9901_e9fcb3b9","updated":"2015-08-21 11:56:54.000000000","message":"Thanks both for confirming.","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"}],"neutron/tests/unit/agent/linux/test_dhcp.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"7e582205dcf23cdebe14c50b1056d224b1271169","unresolved":false,"context_lines":[{"line_number":1856,"context_line":"        mgr \u003d dhcp.DeviceManager(self.conf, plugin)"},{"line_number":1857,"context_line":"        load_interface_driver.assert_called_with(self.conf)"},{"line_number":1858,"context_line":""},{"line_number":1859,"context_line":"        # Setup with no existing DHCP port - except a new DHCP port to"},{"line_number":1860,"context_line":"        # be created."},{"line_number":1861,"context_line":"        network \u003d FakeDeviceManagerNetwork()"},{"line_number":1862,"context_line":"        network.tenant_id \u003d \u0027Tenant A\u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a50d1a3_d452e712","line":1859,"updated":"2015-08-03 12:38:36.000000000","message":"nit: expect","commit_id":"46bc8f4261d9adbe7f1a190f50c8d3163dda09e0"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"67a8a3cc76fef556030dfe72ff044dc6612c8e59","unresolved":false,"context_lines":[{"line_number":1856,"context_line":"        mgr \u003d dhcp.DeviceManager(self.conf, plugin)"},{"line_number":1857,"context_line":"        load_interface_driver.assert_called_with(self.conf)"},{"line_number":1858,"context_line":""},{"line_number":1859,"context_line":"        # Setup with no existing DHCP port - except a new DHCP port to"},{"line_number":1860,"context_line":"        # be created."},{"line_number":1861,"context_line":"        network \u003d FakeDeviceManagerNetwork()"},{"line_number":1862,"context_line":"        network.tenant_id \u003d \u0027Tenant A\u0027"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_f75f7773","line":1859,"in_reply_to":"3a50d1a3_d452e712","updated":"2015-08-17 14:04:20.000000000","message":"Thanks, I\u0027ll fix this.","commit_id":"46bc8f4261d9adbe7f1a190f50c8d3163dda09e0"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"7e582205dcf23cdebe14c50b1056d224b1271169","unresolved":false,"context_lines":[{"line_number":1888,"context_line":""},{"line_number":1889,"context_line":"        # Now call setup again.  This time we go through the existing"},{"line_number":1890,"context_line":"        # port code path, and the driver\u0027s init_l3 method is called"},{"line_number":1891,"context_line":"        # again."},{"line_number":1892,"context_line":"        mgr.setup(network)"},{"line_number":1893,"context_line":"        mgr.driver.init_l3.assert_called_with(\u0027ns-XXX\u0027,"},{"line_number":1894,"context_line":"                                              mock.ANY,"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a50d1a3_d4942738","line":1891,"updated":"2015-08-03 12:38:36.000000000","message":"may also reset plugin.create_dhcp_port and check it wasn\u0027t called","commit_id":"46bc8f4261d9adbe7f1a190f50c8d3163dda09e0"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"67a8a3cc76fef556030dfe72ff044dc6612c8e59","unresolved":false,"context_lines":[{"line_number":1888,"context_line":""},{"line_number":1889,"context_line":"        # Now call setup again.  This time we go through the existing"},{"line_number":1890,"context_line":"        # port code path, and the driver\u0027s init_l3 method is called"},{"line_number":1891,"context_line":"        # again."},{"line_number":1892,"context_line":"        mgr.setup(network)"},{"line_number":1893,"context_line":"        mgr.driver.init_l3.assert_called_with(\u0027ns-XXX\u0027,"},{"line_number":1894,"context_line":"                                              mock.ANY,"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_b79edf05","line":1891,"in_reply_to":"3a50d1a3_d4942738","updated":"2015-08-17 14:04:20.000000000","message":"Good idea, I\u0027ll do that.","commit_id":"46bc8f4261d9adbe7f1a190f50c8d3163dda09e0"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"7e582205dcf23cdebe14c50b1056d224b1271169","unresolved":false,"context_lines":[{"line_number":1896,"context_line":"        cidrs \u003d set(mgr.driver.init_l3.call_args[0][1])"},{"line_number":1897,"context_line":"        self.assertEqual(cidrs, set([\u0027unique-IP-address/24\u0027,"},{"line_number":1898,"context_line":"                                     \u0027unique-IP-address/64\u0027]))"},{"line_number":1899,"context_line":"        mgr.driver.init_l3.reset()"},{"line_number":1900,"context_line":""},{"line_number":1901,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.ip_lib\u0027)"},{"line_number":1902,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a50d1a3_54a1f792","line":1899,"updated":"2015-08-03 12:38:36.000000000","message":"not needed","commit_id":"46bc8f4261d9adbe7f1a190f50c8d3163dda09e0"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"67a8a3cc76fef556030dfe72ff044dc6612c8e59","unresolved":false,"context_lines":[{"line_number":1896,"context_line":"        cidrs \u003d set(mgr.driver.init_l3.call_args[0][1])"},{"line_number":1897,"context_line":"        self.assertEqual(cidrs, set([\u0027unique-IP-address/24\u0027,"},{"line_number":1898,"context_line":"                                     \u0027unique-IP-address/64\u0027]))"},{"line_number":1899,"context_line":"        mgr.driver.init_l3.reset()"},{"line_number":1900,"context_line":""},{"line_number":1901,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.ip_lib\u0027)"},{"line_number":1902,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"}],"source_content_type":"text/x-python","patch_set":11,"id":"fa1b9901_1768ebf4","line":1899,"in_reply_to":"3a50d1a3_54a1f792","updated":"2015-08-17 14:04:20.000000000","message":"OK, will remove.","commit_id":"46bc8f4261d9adbe7f1a190f50c8d3163dda09e0"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"cca608b48d0a6ebda4f6404b059da096a2a924b9","unresolved":false,"context_lines":[{"line_number":52,"context_line":"# an instance as a dict."},{"line_number":53,"context_line":"class Dictable(object):"},{"line_number":54,"context_line":"    def __getitem__(self, k):"},{"line_number":55,"context_line":"        return self.__class__.__dict__.get(k)"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"class FakeDhcpPort(object):"}],"source_content_type":"text/x-python","patch_set":12,"id":"1a4dcd0f_c5cda4b8","line":55,"updated":"2015-08-04 17:43:21.000000000","message":"use:\n\n return getattr(self, k)","commit_id":"8177e9fa675b3a94b57ff02fe1d80407983de331"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"6061fcd1cab14a5c07e00f3ae1b80cc012a35486","unresolved":false,"context_lines":[{"line_number":1878,"context_line":"            self.conf, FakeV4MetadataNetwork()))"},{"line_number":1879,"context_line":""},{"line_number":1880,"context_line":""},{"line_number":1881,"context_line":"class TestDeviceManager(TestConfBase):"},{"line_number":1882,"context_line":""},{"line_number":1883,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.ip_lib\u0027)"},{"line_number":1884,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"}],"source_content_type":"text/x-python","patch_set":15,"id":"fa1b9901_ff52bedc","line":1881,"updated":"2015-08-18 12:18:40.000000000","message":"Some (all?) tests are not really unittest because they call mgr.setup(network) in order to test the behavior of methods called by setup ...let me propose a rework in a follow-up change","commit_id":"d28d7e1800a1e8b92c6ba3875e5dc9a4b1e2d527"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"89e2d84fa94a9789e7a61874a1cc54f68c672c5b","unresolved":false,"context_lines":[{"line_number":1878,"context_line":"            self.conf, FakeV4MetadataNetwork()))"},{"line_number":1879,"context_line":""},{"line_number":1880,"context_line":""},{"line_number":1881,"context_line":"class TestDeviceManager(TestConfBase):"},{"line_number":1882,"context_line":""},{"line_number":1883,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.ip_lib\u0027)"},{"line_number":1884,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"}],"source_content_type":"text/x-python","patch_set":15,"id":"fa1b9901_f6abc087","line":1881,"in_reply_to":"fa1b9901_ff52bedc","updated":"2015-08-18 14:36:33.000000000","message":"The way I see this, the \u0027unit\u0027 under test is the DeviceManager class, bounded by:\n\n- the \u0027public\u0027 interface that DeviceManager provides for \u0027s public interface for DhcpBase (+ its subclasses) to call\n\n- the interface between DeviceManager and the configured interface driver\n\n- the interface between DeviceManager and the plugin.\n\nI would prefer not to make the \u0027unit\u0027 smaller than that, because I think that would overconstrain the internal implementation of the DeviceManager code, and so add cost to any future DeviceManager refactoring work.","commit_id":"d28d7e1800a1e8b92c6ba3875e5dc9a4b1e2d527"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"6061fcd1cab14a5c07e00f3ae1b80cc012a35486","unresolved":false,"context_lines":[{"line_number":1939,"context_line":""},{"line_number":1940,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.ip_lib\u0027)"},{"line_number":1941,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"},{"line_number":1942,"context_line":"    def test_setup_reserved(self, load_interface_driver, ip_lib):"},{"line_number":1943,"context_line":"        \"\"\"Test reserved port case of DeviceManager\u0027s DHCP port setup"},{"line_number":1944,"context_line":"        logic."},{"line_number":1945,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":15,"id":"fa1b9901_9fbaa2e0","line":1942,"updated":"2015-08-18 12:18:40.000000000","message":"Typically this test could directly test _setup_reserved_dhcp_port ... it reduces a lot the things to mock (self.plugin.update_dhcp_port) and clarifies which part of the code is covered","commit_id":"d28d7e1800a1e8b92c6ba3875e5dc9a4b1e2d527"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"89e2d84fa94a9789e7a61874a1cc54f68c672c5b","unresolved":false,"context_lines":[{"line_number":1939,"context_line":""},{"line_number":1940,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.ip_lib\u0027)"},{"line_number":1941,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"},{"line_number":1942,"context_line":"    def test_setup_reserved(self, load_interface_driver, ip_lib):"},{"line_number":1943,"context_line":"        \"\"\"Test reserved port case of DeviceManager\u0027s DHCP port setup"},{"line_number":1944,"context_line":"        logic."},{"line_number":1945,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":15,"id":"fa1b9901_567dcce5","line":1942,"in_reply_to":"fa1b9901_9fbaa2e0","updated":"2015-08-18 14:36:33.000000000","message":"I would prefer not to do this, for the general reason given above.  Specifically, I think that future refactoring work should be free to improve the internal DeviceManager code - which might include renaming or reorganizing the _setup* methods - without finding that those changes cause unit test failures.","commit_id":"d28d7e1800a1e8b92c6ba3875e5dc9a4b1e2d527"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"6061fcd1cab14a5c07e00f3ae1b80cc012a35486","unresolved":false,"context_lines":[{"line_number":1974,"context_line":""},{"line_number":1975,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.ip_lib\u0027)"},{"line_number":1976,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"},{"line_number":1977,"context_line":"    def test_setup_reserved_2(self, load_interface_driver, ip_lib):"},{"line_number":1978,"context_line":"        \"\"\"Test scenario where a network has two reserved ports, and"},{"line_number":1979,"context_line":"        update_dhcp_port fails for the first of those."},{"line_number":1980,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":15,"id":"fa1b9901_1fcf7280","line":1977,"updated":"2015-08-18 12:18:40.000000000","message":"itto","commit_id":"d28d7e1800a1e8b92c6ba3875e5dc9a4b1e2d527"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"89e2d84fa94a9789e7a61874a1cc54f68c672c5b","unresolved":false,"context_lines":[{"line_number":1974,"context_line":""},{"line_number":1975,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.ip_lib\u0027)"},{"line_number":1976,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"},{"line_number":1977,"context_line":"    def test_setup_reserved_2(self, load_interface_driver, ip_lib):"},{"line_number":1978,"context_line":"        \"\"\"Test scenario where a network has two reserved ports, and"},{"line_number":1979,"context_line":"        update_dhcp_port fails for the first of those."},{"line_number":1980,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":15,"id":"fa1b9901_767810f3","line":1977,"in_reply_to":"fa1b9901_1fcf7280","updated":"2015-08-18 14:36:33.000000000","message":"+ similarly here, of course.","commit_id":"d28d7e1800a1e8b92c6ba3875e5dc9a4b1e2d527"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"055278e6614ed4818c98a7ad80bcdc2ed9f3aa00","unresolved":false,"context_lines":[{"line_number":1977,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"},{"line_number":1978,"context_line":"    def test_setup_reserved_2(self, load_interface_driver, ip_lib):"},{"line_number":1979,"context_line":"        \"\"\"Test scenario where a network has two reserved ports, and"},{"line_number":1980,"context_line":"        update_dhcp_port fails for the first of those."},{"line_number":1981,"context_line":"        \"\"\""},{"line_number":1982,"context_line":""},{"line_number":1983,"context_line":"        # Create DeviceManager."}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_e87898f4","line":1980,"updated":"2015-08-19 08:10:31.000000000","message":"What is the case when None is returned in case of failure? From code it looks like update_port() will either return updated port or raise exception. So I\u0027m not sure this case deserves a test and special handling. I might be missing something","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"},{"author":{"_account_id":13734,"name":"Nell Jerram","email":"nell@tigera.io","username":"neiljerram"},"change_message_id":"916de4ec4bcf401780ef8a8670b4af469376c093","unresolved":false,"context_lines":[{"line_number":1977,"context_line":"    @mock.patch(\u0027neutron.agent.linux.dhcp.common_utils.load_interface_driver\u0027)"},{"line_number":1978,"context_line":"    def test_setup_reserved_2(self, load_interface_driver, ip_lib):"},{"line_number":1979,"context_line":"        \"\"\"Test scenario where a network has two reserved ports, and"},{"line_number":1980,"context_line":"        update_dhcp_port fails for the first of those."},{"line_number":1981,"context_line":"        \"\"\""},{"line_number":1982,"context_line":""},{"line_number":1983,"context_line":"        # Create DeviceManager."}],"source_content_type":"text/x-python","patch_set":16,"id":"fa1b9901_5e9a9e64","line":1980,"in_reply_to":"fa1b9901_e87898f4","updated":"2015-08-19 08:38:46.000000000","message":"I don\u0027t know precisely, but I imagine there might be several server-side conditions, such as DB deadlocks, or multiple DHCP agents trying to do incompatible updates at the same time for the same network (in the HA case) that might motivate the server just to give up and say \u0027no, couldn\u0027t do that\u0027.  So I think safer just to preserve the exact preexisting behaviour here.\n\nYou might be right about not having a specific test for this, though; so perhaps we should delete it.  Can I ask what other reviewers think?","commit_id":"1374624a8fba2f562ba36c4fdabf73f3fcaf514f"}]}
