)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"2a406f1386e88af7bd2f65102f208e1f7cc82b4e","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     watanabe.isao \u003czou.yun@jp.fujitsu.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-12-25 09:13:17 +0900"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Cleanup/add log to auto scheduler"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This is a cleanup adding debug log to auto_scheduler of"},{"line_number":10,"context_line":"dhcp_agent_scheduler.py."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3a961159_4f10f159","line":7,"updated":"2014-12-25 01:01:53.000000000","message":"This patch don\u0027t cleanup log so \u0027Add log to auto scheduler\u0027 is correct.","commit_id":"b1f87ce1ee697188b77fde462688fa68904f9655"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"2a406f1386e88af7bd2f65102f208e1f7cc82b4e","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Cleanup/add log to auto scheduler"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This is a cleanup adding debug log to auto_scheduler of"},{"line_number":10,"context_line":"dhcp_agent_scheduler.py."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I10cb5adb32a2fe18a301038f349b2e3504980abb"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3a961159_5207b418","line":10,"updated":"2014-12-25 01:01:53.000000000","message":"You should add commit message about what\u0027s the log for OR write launchpad.","commit_id":"b1f87ce1ee697188b77fde462688fa68904f9655"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"145467cac97c8a197b53471b8a89eaa143fdefa1","unresolved":false,"context_lines":[{"line_number":3,"context_line":"AuthorDate: 2014-12-24 17:21:15 +0900"},{"line_number":4,"context_line":"Commit:     watanabe.isao \u003czou.yun@jp.fujitsu.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-01-08 13:38:27 +0900"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"A cleanup of dhcp_agent_scheduler.py"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This is a cleanup move the double coding into a separate method and"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"3a961159_e6a56db5","line":6,"updated":"2015-01-08 08:57:18.000000000","message":"This isn\u0027t a cleanup, this patch is about adding logging to an event that was previously unlogged.","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"851da8c80bc23b5cbe814c0d74476bfe747996a9","unresolved":false,"context_lines":[{"line_number":12,"context_line":"Also, this cleanup enable auto_schedule_networks() to have the same"},{"line_number":13,"context_line":"debug log output as schedule() when the network is not going to"},{"line_number":14,"context_line":"bind any more DHCP agents due to already binding enough agents"},{"line_number":15,"context_line":"(agents number is more than dhcp_agent_per_network paramater)."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I10cb5adb32a2fe18a301038f349b2e3504980abb"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"3a961159_cd7a54f0","line":15,"updated":"2015-01-08 06:32:23.000000000","message":"parameter","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"08e0a0c02deaf3c7b8904088b11d707484a0bd6b","unresolved":false,"context_lines":[{"line_number":12,"context_line":"Also, this cleanup enable auto_schedule_networks() to have the same"},{"line_number":13,"context_line":"debug log output as schedule() when the network is not going to"},{"line_number":14,"context_line":"bind any more DHCP agents due to already binding enough agents"},{"line_number":15,"context_line":"(agents number is more than dhcp_agent_per_network paramater)."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I10cb5adb32a2fe18a301038f349b2e3504980abb"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"3a961159_6d7320e7","line":15,"in_reply_to":"3a961159_cd7a54f0","updated":"2015-01-08 06:52:24.000000000","message":"Thanks a lot.","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"}],"neutron/scheduler/dhcp_agent_scheduler.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"bcd6f7093fc2892167a699bcb2e4947f4dacfb75","unresolved":false,"context_lines":[{"line_number":68,"context_line":"            dhcp_agents \u003d plugin.get_dhcp_agents_hosting_networks("},{"line_number":69,"context_line":"                context, [network[\u0027id\u0027]], active\u003dTrue)"},{"line_number":70,"context_line":"            if len(dhcp_agents) \u003e\u003d agents_per_network:"},{"line_number":71,"context_line":"                LOG.debug(\u0027Network %s is already hosted\u0027,"},{"line_number":72,"context_line":"                          network[\u0027id\u0027])"},{"line_number":73,"context_line":"                return"},{"line_number":74,"context_line":"            n_agents \u003d agents_per_network - len(dhcp_agents)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_967833c5","line":71,"updated":"2014-12-24 20:10:06.000000000","message":"this line is fine, put it back please","commit_id":"dd19dd35ac8bad300e5a670b6b44d483f3dc4760"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"17c2757339cfe8ad0fe2f88ee9b27e2f131361b0","unresolved":false,"context_lines":[{"line_number":130,"context_line":"                        continue"},{"line_number":131,"context_line":"                    bindings_to_add.append((dhcp_agent, net_id))"},{"line_number":132,"context_line":"                    LOG.debug(\u0027Auto schedule network %s to DHCP agent %s\u0027,"},{"line_number":133,"context_line":"                        dhcp_agent.id, net_id)"},{"line_number":134,"context_line":"        # do it outside transaction so particular scheduling results don\u0027t"},{"line_number":135,"context_line":"        # make other to fail"},{"line_number":136,"context_line":"        for agent, net_id in bindings_to_add:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_a4e8a4b3","line":133,"updated":"2014-12-24 10:46:55.000000000","message":"swapped arguments?\nbetter to use a keyword dict.","commit_id":"dd19dd35ac8bad300e5a670b6b44d483f3dc4760"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"bcd6f7093fc2892167a699bcb2e4947f4dacfb75","unresolved":false,"context_lines":[{"line_number":130,"context_line":"                        continue"},{"line_number":131,"context_line":"                    bindings_to_add.append((dhcp_agent, net_id))"},{"line_number":132,"context_line":"                    LOG.debug(\u0027Auto schedule network %s to DHCP agent %s\u0027,"},{"line_number":133,"context_line":"                        dhcp_agent.id, net_id)"},{"line_number":134,"context_line":"        # do it outside transaction so particular scheduling results don\u0027t"},{"line_number":135,"context_line":"        # make other to fail"},{"line_number":136,"context_line":"        for agent, net_id in bindings_to_add:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_b6736fe5","line":133,"in_reply_to":"3a961159_a4e8a4b3","updated":"2014-12-24 20:10:06.000000000","message":"+1","commit_id":"dd19dd35ac8bad300e5a670b6b44d483f3dc4760"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"6f7bf68d3fa6272069aa3cb7a7ba429f318192bd","unresolved":false,"context_lines":[{"line_number":130,"context_line":"                        continue"},{"line_number":131,"context_line":"                    bindings_to_add.append((dhcp_agent, net_id))"},{"line_number":132,"context_line":"                    LOG.debug(\u0027Auto schedule network %s to DHCP agent %s\u0027,"},{"line_number":133,"context_line":"                        dhcp_agent.id, net_id)"},{"line_number":134,"context_line":"        # do it outside transaction so particular scheduling results don\u0027t"},{"line_number":135,"context_line":"        # make other to fail"},{"line_number":136,"context_line":"        for agent, net_id in bindings_to_add:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_6f868ddd","line":133,"in_reply_to":"3a961159_b6736fe5","updated":"2014-12-25 00:22:49.000000000","message":"I found a  debug log already exist in _schedule_bind_network. So I will remove these two lines.","commit_id":"dd19dd35ac8bad300e5a670b6b44d483f3dc4760"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"5b88b6da0fea000ecb3bf9ae86d0ee5cd7f3ba26","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                    agents \u003d plugin.get_dhcp_agents_hosting_networks("},{"line_number":124,"context_line":"                        context, [net_id], active\u003dTrue)"},{"line_number":125,"context_line":"                    if len(agents) \u003e\u003d agents_per_network:"},{"line_number":126,"context_line":"                        LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":127,"context_line":"                            net_id)"},{"line_number":128,"context_line":"                        continue"},{"line_number":129,"context_line":"                    if any(dhcp_agent.id \u003d\u003d agent.id for agent in agents):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_57021070","line":126,"updated":"2014-12-30 08:21:12.000000000","message":"I think better approach is to move common code including the log message into a separate method and reuse from both schedule() and auto_schedule_networks().","commit_id":"c86cff95e5754c0bf1c0fe39e7848382955ab22c"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"e5d28a1eafbdc6169a330383e2f05c5f91f2e6b2","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                    agents \u003d plugin.get_dhcp_agents_hosting_networks("},{"line_number":124,"context_line":"                        context, [net_id], active\u003dTrue)"},{"line_number":125,"context_line":"                    if len(agents) \u003e\u003d agents_per_network:"},{"line_number":126,"context_line":"                        LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":127,"context_line":"                            net_id)"},{"line_number":128,"context_line":"                        continue"},{"line_number":129,"context_line":"                    if any(dhcp_agent.id \u003d\u003d agent.id for agent in agents):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_f7ee4721","line":126,"in_reply_to":"3a961159_0e0cb93a","updated":"2015-01-06 00:37:05.000000000","message":"Lines 123-127(8) is too big for this fix. Do you think it is ok, if I clean up the double check logic in another fix, and just add one log in this fix?","commit_id":"c86cff95e5754c0bf1c0fe39e7848382955ab22c"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"82ffe9efa227f17622831233f503e6e620036c6e","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                    agents \u003d plugin.get_dhcp_agents_hosting_networks("},{"line_number":124,"context_line":"                        context, [net_id], active\u003dTrue)"},{"line_number":125,"context_line":"                    if len(agents) \u003e\u003d agents_per_network:"},{"line_number":126,"context_line":"                        LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":127,"context_line":"                            net_id)"},{"line_number":128,"context_line":"                        continue"},{"line_number":129,"context_line":"                    if any(dhcp_agent.id \u003d\u003d agent.id for agent in agents):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_5e4cdd76","line":126,"in_reply_to":"3a961159_57021070","updated":"2014-12-30 19:59:28.000000000","message":"+1","commit_id":"c86cff95e5754c0bf1c0fe39e7848382955ab22c"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"1cfab938b142e882dc16b30d9b578fe61e4b4fce","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                    agents \u003d plugin.get_dhcp_agents_hosting_networks("},{"line_number":124,"context_line":"                        context, [net_id], active\u003dTrue)"},{"line_number":125,"context_line":"                    if len(agents) \u003e\u003d agents_per_network:"},{"line_number":126,"context_line":"                        LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":127,"context_line":"                            net_id)"},{"line_number":128,"context_line":"                        continue"},{"line_number":129,"context_line":"                    if any(dhcp_agent.id \u003d\u003d agent.id for agent in agents):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_9ef1be97","line":126,"in_reply_to":"3a961159_57021070","updated":"2015-01-05 01:08:22.000000000","message":"I cannot find any code raising a message in /neutron/scheduler/. But, let\u0027s fix this as your saying first, and see what others will response.","commit_id":"c86cff95e5754c0bf1c0fe39e7848382955ab22c"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"11e3725b1adde88cd78ea7be3cab0b126080fc88","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                    agents \u003d plugin.get_dhcp_agents_hosting_networks("},{"line_number":124,"context_line":"                        context, [net_id], active\u003dTrue)"},{"line_number":125,"context_line":"                    if len(agents) \u003e\u003d agents_per_network:"},{"line_number":126,"context_line":"                        LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":127,"context_line":"                            net_id)"},{"line_number":128,"context_line":"                        continue"},{"line_number":129,"context_line":"                    if any(dhcp_agent.id \u003d\u003d agent.id for agent in agents):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_be003a03","line":126,"in_reply_to":"3a961159_9ef1be97","updated":"2015-01-05 02:00:25.000000000","message":"Sorry, Ihar Hrachyshka. I have misunderstand your meaning. However, may I ask which part do you mean is a common part, please? Because, the check of dhcp_agents_per_network of schedule() and auto_schedule_networks() is in different logic -- one in a for loop, another is not.","commit_id":"c86cff95e5754c0bf1c0fe39e7848382955ab22c"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"685c2260d09f0078dce23dbf6b0058480c8e1299","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                    agents \u003d plugin.get_dhcp_agents_hosting_networks("},{"line_number":124,"context_line":"                        context, [net_id], active\u003dTrue)"},{"line_number":125,"context_line":"                    if len(agents) \u003e\u003d agents_per_network:"},{"line_number":126,"context_line":"                        LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":127,"context_line":"                            net_id)"},{"line_number":128,"context_line":"                        continue"},{"line_number":129,"context_line":"                    if any(dhcp_agent.id \u003d\u003d agent.id for agent in agents):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_0e0cb93a","line":126,"in_reply_to":"3a961159_be003a03","updated":"2015-01-05 09:57:08.000000000","message":"Lines 123-127(8).","commit_id":"c86cff95e5754c0bf1c0fe39e7848382955ab22c"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"307c4eae73c43a216b7c71de87ffab34c7d0f313","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        if len(dhcp_agents) \u003e\u003d agents_per_network:"},{"line_number":64,"context_line":"            LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":65,"context_line":"                network_id)"},{"line_number":66,"context_line":"            bind_flag \u003d 1"},{"line_number":67,"context_line":"        return bind_flag, dhcp_agents, agents_per_network"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"    def schedule(self, plugin, context, network):"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_86ddb016","line":66,"updated":"2015-01-07 04:56:28.000000000","message":"Instead of returning 3 vars, you could just return dhcp_agents and remaining_required.\nThen callers can check if remaining_required \u003d\u003d 0 to determine if they need to continue and then they don\u0027t have to calculate it themselves.","commit_id":"d2b0ca4b151a3748c9602e7d1da8ad5e73f193f5"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"400e0f31a655b02512d64e5ab30328999de29e07","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        if len(dhcp_agents) \u003e\u003d agents_per_network:"},{"line_number":64,"context_line":"            LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":65,"context_line":"                network_id)"},{"line_number":66,"context_line":"            bind_flag \u003d 1"},{"line_number":67,"context_line":"        return bind_flag, dhcp_agents, agents_per_network"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"    def schedule(self, plugin, context, network):"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_86bcd06d","line":66,"in_reply_to":"3a961159_86ddb016","updated":"2015-01-07 05:19:16.000000000","message":"Done","commit_id":"d2b0ca4b151a3748c9602e7d1da8ad5e73f193f5"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"21feffc7550bbad7f5a692dec6dd17083bf74da4","unresolved":false,"context_lines":[{"line_number":63,"context_line":"            LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":64,"context_line":"                network_id)"},{"line_number":65,"context_line":"        n_agents \u003d agents_per_network - len(dhcp_agents)"},{"line_number":66,"context_line":"        return n_agents, dhcp_agents"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    def schedule(self, plugin, context, network):"},{"line_number":69,"context_line":"        \"\"\"Schedule the network to active DHCP agent(s)."}],"source_content_type":"text/x-python","patch_set":5,"id":"3a961159_e97f0b15","line":66,"updated":"2015-01-07 23:46:22.000000000","message":"I think returning tuples should be avoided if possible; since you return something that could be inferred by a config variable (which could even be a class attribute if you think that the alias gets in the way), I\u0027d suggest you return just \u0027dhcp_agents\u0027.\n\nBut more importantly, this method doesn\u0027t \u0027check\u0027 anything! So perhaps this should be called get_dhcp_agents_per_network.","commit_id":"8a8bce1de6700dae688be5428955f07a2abe3ca5"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"35596aaff3ee4dffe120751c524f83a4ccc8d851","unresolved":false,"context_lines":[{"line_number":63,"context_line":"            LOG.debug(\u0027Network %s is hosted already\u0027,"},{"line_number":64,"context_line":"                network_id)"},{"line_number":65,"context_line":"        n_agents \u003d agents_per_network - len(dhcp_agents)"},{"line_number":66,"context_line":"        return n_agents, dhcp_agents"},{"line_number":67,"context_line":""},{"line_number":68,"context_line":"    def schedule(self, plugin, context, network):"},{"line_number":69,"context_line":"        \"\"\"Schedule the network to active DHCP agent(s)."}],"source_content_type":"text/x-python","patch_set":5,"id":"3a961159_4c910d51","line":66,"in_reply_to":"3a961159_e97f0b15","updated":"2015-01-08 00:30:22.000000000","message":"Done","commit_id":"8a8bce1de6700dae688be5428955f07a2abe3ca5"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"a72c5ddeed682e48c2772bd474b3868ddf3df813","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":77,"context_line":"            dhcp_agents \u003d self._get_dhcp_agents_per_network(plugin,"},{"line_number":78,"context_line":"                context, network[\u0027id\u0027])"},{"line_number":79,"context_line":"            if not dhcp_agents:"},{"line_number":80,"context_line":"                return"},{"line_number":81,"context_line":"            n_agents \u003d agents_per_network - len(dhcp_agents)"},{"line_number":82,"context_line":"            enabled_dhcp_agents \u003d plugin.get_agents_db("}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_1b42d53d","line":79,"updated":"2015-01-08 04:24:20.000000000","message":"Wrong logic. Please do not review this Patch Set.","commit_id":"a324dc7a558ffe3bdb7d4ee9395a24cc0f053891"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"145467cac97c8a197b53471b8a89eaa143fdefa1","unresolved":false,"context_lines":[{"line_number":54,"context_line":"                      \u0027hosted by DHCP agent %(agent_id)s\u0027,"},{"line_number":55,"context_line":"                      {\u0027network_id\u0027: network_id,"},{"line_number":56,"context_line":"                       \u0027agent_id\u0027: agent})"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def _get_dhcp_agents_per_network(self, plugin, context, network_id):"},{"line_number":59,"context_line":"        agents_per_network \u003d cfg.CONF.dhcp_agents_per_network"},{"line_number":60,"context_line":"        dhcp_agents \u003d plugin.get_dhcp_agents_hosting_networks("}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_a697e543","line":57,"updated":"2015-01-08 08:57:18.000000000","message":"_get_dhcp_agents_per_network -\u003e\n_get_active_dhcp_agents_for_network\n\nThe new unit is missing a unit test.","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"45106363e87c8fb58b9974b0a48720477f376f90","unresolved":false,"context_lines":[{"line_number":54,"context_line":"                      \u0027hosted by DHCP agent %(agent_id)s\u0027,"},{"line_number":55,"context_line":"                      {\u0027network_id\u0027: network_id,"},{"line_number":56,"context_line":"                       \u0027agent_id\u0027: agent})"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def _get_dhcp_agents_per_network(self, plugin, context, network_id):"},{"line_number":59,"context_line":"        agents_per_network \u003d cfg.CONF.dhcp_agents_per_network"},{"line_number":60,"context_line":"        dhcp_agents \u003d plugin.get_dhcp_agents_hosting_networks("}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_8a0c8e94","line":57,"in_reply_to":"3a961159_a697e543","updated":"2015-01-09 08:55:10.000000000","message":"I will give the new method a new purpose and anew name. And yes, a unit test will be added.","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"145467cac97c8a197b53471b8a89eaa143fdefa1","unresolved":false,"context_lines":[{"line_number":73,"context_line":""},{"line_number":74,"context_line":"        #TODO(gongysh) don\u0027t schedule the networks with only"},{"line_number":75,"context_line":"        # subnets whose enable_dhcp is false"},{"line_number":76,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":77,"context_line":"            dhcp_agents \u003d self._get_dhcp_agents_per_network(plugin,"},{"line_number":78,"context_line":"                context, network[\u0027id\u0027])"},{"line_number":79,"context_line":"            if len(dhcp_agents) \u003e\u003d agents_per_network:"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_06335962","line":76,"updated":"2015-01-08 08:57:18.000000000","message":"I think that *currently* the patch actually makes things worse. It\u0027s more complicated, and I find the logging logic and output weird in line 62. I think that a method called \u0027get_dhcp_agents_per_network\u0027 would interact with the DB and return what was asked from it. Why would it perform any additional logic? Why would it \u0027know\u0027 anything about \u0027dhcp_agents_per_network\u0027? It\u0027s overstepping it\u0027s bounds.\n\nI think that it\u0027s better to actually add the missing logging to line 133, code duplication and all. I mean, this patch tries to avoid code duplication but it actually adds LoCs and complexity. I see that you\u0027ve already went though a few iterations and got feedback (Often conflicting! Isn\u0027t that fun) from numerous people. I can\u0027t find a simpler way to achieve what you want, other than just adding the logging. You can consider adding a tiny function (max_dhcp_agents_per_network_reached) that receives the number of dhcp_agents for a network, and the agents_per_network parameter, and performs the check, logs, and returns True/False.","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"45106363e87c8fb58b9974b0a48720477f376f90","unresolved":false,"context_lines":[{"line_number":73,"context_line":""},{"line_number":74,"context_line":"        #TODO(gongysh) don\u0027t schedule the networks with only"},{"line_number":75,"context_line":"        # subnets whose enable_dhcp is false"},{"line_number":76,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":77,"context_line":"            dhcp_agents \u003d self._get_dhcp_agents_per_network(plugin,"},{"line_number":78,"context_line":"                context, network[\u0027id\u0027])"},{"line_number":79,"context_line":"            if len(dhcp_agents) \u003e\u003d agents_per_network:"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_0a417ea5","line":76,"in_reply_to":"3a961159_06335962","updated":"2015-01-09 08:55:10.000000000","message":"Yes, as you see, I want to add all your suggestion into my fix and it come to a confliction at the end. However, I really want to try my best to make this code clearer. I would like to send another patch set. Thank you for your time and review.","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"},{"author":{"_account_id":7715,"name":"Hirofumi Ichihara","email":"ichihara.hirofumi@gmail.com","username":"Hirofumi-Ichihara"},"change_message_id":"851da8c80bc23b5cbe814c0d74476bfe747996a9","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":77,"context_line":"            dhcp_agents \u003d self._get_dhcp_agents_per_network(plugin,"},{"line_number":78,"context_line":"                context, network[\u0027id\u0027])"},{"line_number":79,"context_line":"            if len(dhcp_agents) \u003e\u003d agents_per_network:"},{"line_number":80,"context_line":"                return"},{"line_number":81,"context_line":"            n_agents \u003d agents_per_network - len(dhcp_agents)"},{"line_number":82,"context_line":"            enabled_dhcp_agents \u003d plugin.get_agents_db("}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_6d224002","line":79,"updated":"2015-01-08 06:32:23.000000000","message":"I feel lengthy that this comparison is the same as L.62.","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"08e0a0c02deaf3c7b8904088b11d707484a0bd6b","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":77,"context_line":"            dhcp_agents \u003d self._get_dhcp_agents_per_network(plugin,"},{"line_number":78,"context_line":"                context, network[\u0027id\u0027])"},{"line_number":79,"context_line":"            if len(dhcp_agents) \u003e\u003d agents_per_network:"},{"line_number":80,"context_line":"                return"},{"line_number":81,"context_line":"            n_agents \u003d agents_per_network - len(dhcp_agents)"},{"line_number":82,"context_line":"            enabled_dhcp_agents \u003d plugin.get_agents_db("}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_cd641424","line":79,"in_reply_to":"3a961159_6d224002","updated":"2015-01-08 06:52:24.000000000","message":"Me too. But I really don\u0027t know how to shorten the code, also not to return tuples, which is required by Armando Migliaccio in Patch Set 5.","commit_id":"d4001cf57a995b28d17e6853342d4fad0f958ed0"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"407e5db5422302226edb2ee39b432632595026b8","unresolved":false,"context_lines":[{"line_number":55,"context_line":"                      {\u0027network_id\u0027: network_id,"},{"line_number":56,"context_line":"                       \u0027agent_id\u0027: agent})"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def _get_bind_able_dhcp_agents_for_network(self, plugin, context,"},{"line_number":59,"context_line":"                                               all_agents, network_id):"},{"line_number":60,"context_line":"        agents_per_network \u003d cfg.CONF.dhcp_agents_per_network"},{"line_number":61,"context_line":"        dhcp_agents \u003d plugin.get_dhcp_agents_hosting_networks("}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_600f8139","line":58,"updated":"2015-01-09 11:07:34.000000000","message":"bindable is a single word.","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"a8eca67cd1abe896b83514c417886eeadbad946a","unresolved":false,"context_lines":[{"line_number":55,"context_line":"                      {\u0027network_id\u0027: network_id,"},{"line_number":56,"context_line":"                       \u0027agent_id\u0027: agent})"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    def _get_bind_able_dhcp_agents_for_network(self, plugin, context,"},{"line_number":59,"context_line":"                                               all_agents, network_id):"},{"line_number":60,"context_line":"        agents_per_network \u003d cfg.CONF.dhcp_agents_per_network"},{"line_number":61,"context_line":"        dhcp_agents \u003d plugin.get_dhcp_agents_hosting_networks("}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_43594134","line":58,"in_reply_to":"3a961159_600f8139","updated":"2015-01-14 00:47:38.000000000","message":"Done","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"407e5db5422302226edb2ee39b432632595026b8","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            and agent not in dhcp_agents"},{"line_number":73,"context_line":"        ]"},{"line_number":74,"context_line":"        if not active_dhcp_agents:"},{"line_number":75,"context_line":"            LOG.warn(_LW(\u0027No more_bind_able DHCP agents\u0027))"},{"line_number":76,"context_line":"            return []"},{"line_number":77,"context_line":"        n_agents \u003d min(len(active_dhcp_agents), n_agents)"},{"line_number":78,"context_line":"        return random.sample(active_dhcp_agents, n_agents)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_401c4577","line":75,"updated":"2015-01-09 11:07:34.000000000","message":"Error is wrong.","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"a8eca67cd1abe896b83514c417886eeadbad946a","unresolved":false,"context_lines":[{"line_number":72,"context_line":"            and agent not in dhcp_agents"},{"line_number":73,"context_line":"        ]"},{"line_number":74,"context_line":"        if not active_dhcp_agents:"},{"line_number":75,"context_line":"            LOG.warn(_LW(\u0027No more_bind_able DHCP agents\u0027))"},{"line_number":76,"context_line":"            return []"},{"line_number":77,"context_line":"        n_agents \u003d min(len(active_dhcp_agents), n_agents)"},{"line_number":78,"context_line":"        return random.sample(active_dhcp_agents, n_agents)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_833a49c2","line":75,"in_reply_to":"3a961159_401c4577","updated":"2015-01-14 00:47:38.000000000","message":"Done","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"4618944cf9c0039c2352894cf93b62e95e3ce481","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            if not net_ids:"},{"line_number":114,"context_line":"                LOG.debug(\u0027No non-hosted networks\u0027)"},{"line_number":115,"context_line":"                return False"},{"line_number":116,"context_line":"            query \u003d context.session.query(agents_db.Agent)"},{"line_number":117,"context_line":"            query \u003d query.filter(agents_db.Agent.agent_type \u003d\u003d"},{"line_number":118,"context_line":"                                 constants.AGENT_TYPE_DHCP,"},{"line_number":119,"context_line":"                                 agents_db.Agent.host \u003d\u003d host,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_cf4a21ad","line":116,"updated":"2015-01-09 14:39:01.000000000","message":"We could also use get_agents_db() here, as in schedule()","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"0befe191c5c36fb17a7acdc5fca691e28fcc3642","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            if not net_ids:"},{"line_number":114,"context_line":"                LOG.debug(\u0027No non-hosted networks\u0027)"},{"line_number":115,"context_line":"                return False"},{"line_number":116,"context_line":"            query \u003d context.session.query(agents_db.Agent)"},{"line_number":117,"context_line":"            query \u003d query.filter(agents_db.Agent.agent_type \u003d\u003d"},{"line_number":118,"context_line":"                                 constants.AGENT_TYPE_DHCP,"},{"line_number":119,"context_line":"                                 agents_db.Agent.host \u003d\u003d host,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_f954e7c7","line":116,"in_reply_to":"3a961159_20f504ed","updated":"2015-01-20 08:28:55.000000000","message":"Hello, Ihar Hrachyshka.\n\nI tried to use the \"query\" one instead of get_agents_db() in schedule(), and every test looks OK. I will send another patch set. Please recheck.","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"a8eca67cd1abe896b83514c417886eeadbad946a","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            if not net_ids:"},{"line_number":114,"context_line":"                LOG.debug(\u0027No non-hosted networks\u0027)"},{"line_number":115,"context_line":"                return False"},{"line_number":116,"context_line":"            query \u003d context.session.query(agents_db.Agent)"},{"line_number":117,"context_line":"            query \u003d query.filter(agents_db.Agent.agent_type \u003d\u003d"},{"line_number":118,"context_line":"                                 constants.AGENT_TYPE_DHCP,"},{"line_number":119,"context_line":"                                 agents_db.Agent.host \u003d\u003d host,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_e3722daf","line":116,"in_reply_to":"3a961159_cf4a21ad","updated":"2015-01-14 00:47:38.000000000","message":"Done","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"af4dc96bbfac207ab8ecf0c5f342e1b410375e66","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            if not net_ids:"},{"line_number":114,"context_line":"                LOG.debug(\u0027No non-hosted networks\u0027)"},{"line_number":115,"context_line":"                return False"},{"line_number":116,"context_line":"            query \u003d context.session.query(agents_db.Agent)"},{"line_number":117,"context_line":"            query \u003d query.filter(agents_db.Agent.agent_type \u003d\u003d"},{"line_number":118,"context_line":"                                 constants.AGENT_TYPE_DHCP,"},{"line_number":119,"context_line":"                                 agents_db.Agent.host \u003d\u003d host,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_20f504ed","line":116,"in_reply_to":"3a961159_e3722daf","updated":"2015-01-14 05:00:45.000000000","message":"Hello, Ihar Hrachyshka. \n\nI tried to use get_agents_db() in auto_schedule_networks() then reduce the double code. But it seams like it is better to leave the code as it is.\n\nReason 1: Some unit test depends on the query session. Once I changed the code, the OK turns to Fails. This means I need to fix the unit tests, too. And more behind it.\n\nReason 2: auto_schedule_networks() use the input host to get the dhcp_agents, which is different from schedule(). schedule() gets all dhcp_agents. So I need to double write the code of getting dhcp_agents in the _get_bindable_dhcp_agents_for_network(). This means the code will not be shorten very much. And I get no benefit from the change.\n\nIf I\u0027m missing any point, please correct me.","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"}],"neutron/tests/unit/test_dhcp_scheduler.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"4618944cf9c0039c2352894cf93b62e95e3ce481","unresolved":false,"context_lines":[{"line_number":94,"context_line":"        scheduler \u003d dhcp_agent_scheduler.ChanceScheduler()"},{"line_number":95,"context_line":"        result \u003d scheduler._get_bind_able_dhcp_agents_for_network(plugin,"},{"line_number":96,"context_line":"            self.ctx, agents, self.network_id)"},{"line_number":97,"context_line":"        self.assertEqual(agents, result)"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    def test_get_bind_able_dhcp_agents_for_network_fails(self):"},{"line_number":100,"context_line":"        plugin \u003d mock.MagicMock()"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_af4dd5c7","line":97,"updated":"2015-01-09 14:39:01.000000000","message":"This check depends on lists having the same order. I don\u0027t think we should rely on it and instead sort() lists before comparing them.","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"},{"author":{"_account_id":14039,"name":"watanabe isao","email":"watanabe.isao.openstack@gmail.com","username":"watanabe.isao"},"change_message_id":"a8eca67cd1abe896b83514c417886eeadbad946a","unresolved":false,"context_lines":[{"line_number":94,"context_line":"        scheduler \u003d dhcp_agent_scheduler.ChanceScheduler()"},{"line_number":95,"context_line":"        result \u003d scheduler._get_bind_able_dhcp_agents_for_network(plugin,"},{"line_number":96,"context_line":"            self.ctx, agents, self.network_id)"},{"line_number":97,"context_line":"        self.assertEqual(agents, result)"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    def test_get_bind_able_dhcp_agents_for_network_fails(self):"},{"line_number":100,"context_line":"        plugin \u003d mock.MagicMock()"}],"source_content_type":"text/x-python","patch_set":8,"id":"3a961159_dedb461f","line":97,"in_reply_to":"3a961159_af4dd5c7","updated":"2015-01-14 00:47:38.000000000","message":"Yes, that right.","commit_id":"c3ec204cb09a58d4667f2fa28ee18451d12b0e23"}]}
