)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11825,"name":"Sudhakar Babu Gariganti","email":"sudhakar.gariganti@gmail.com","username":"sudhakar-gariganti"},"change_message_id":"87da2460f42a0f13f3734896cab39c8c4f236d19","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Add option to remove networks from dead DHCP agents"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Networks are removed from dead agents after a certain time."},{"line_number":10,"context_line":"Then unhosted networks could be picked up by alive DHCP agents."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The feature is added for all plugins that support DHCP scheduling"},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9aa7fdbe_84b8f4e6","line":10,"updated":"2014-10-29 07:06:50.000000000","message":"From the current DHCP scheduler/agent code, I see that auto_schedule_networks is being called only when the plugin receives a get_active_networks related RPC from any of the DHCP agent. \nAnd on the agent side, active networks information is requested only during a sync_state, which happens only on agent startup/ in case of any exception that happens within the dhcp agent. \n\nGoing with this the networks will not get hosted until something bad happens in any one of the alive DHCP agents. This is basically resulting in an undefinite time for which the network can remain not hosted anywhere.\n\nWe need to include rescheduling as well to make it complete like the dead l3 agent case is handled?\n\nThoughts?","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f9713d450583ba757f3a239bd46e41e4e9876d52","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Add option to remove networks from dead DHCP agents"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Networks are removed from dead agents after a certain time."},{"line_number":10,"context_line":"Then unhosted networks could be picked up by alive DHCP agents."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The feature is added for all plugins that support DHCP scheduling"},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9aa7fdbe_a4aed82d","line":10,"in_reply_to":"9aa7fdbe_84b8f4e6","updated":"2014-10-29 07:27:48.000000000","message":"agree, i\u0027ll take a more close look","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":11825,"name":"Sudhakar Babu Gariganti","email":"sudhakar.gariganti@gmail.com","username":"sudhakar-gariganti"},"change_message_id":"87da2460f42a0f13f3734896cab39c8c4f236d19","unresolved":false,"context_lines":[{"line_number":12,"context_line":"The feature is added for all plugins that support DHCP scheduling"},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I6ab03b1642f54aa1d5de8844d95c758f1cb273f1"},{"line_number":15,"context_line":"Closes-Bug: #1386794"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9aa7fdbe_89ec8d91","line":15,"updated":"2014-10-29 07:06:50.000000000","message":"I feel 1386794 is just a specific case of 1174591 [1]\nAdd a mention of 117459 as well?\n\n[1] https://bugs.launchpad.net/neutron/+bug/1174591","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f9713d450583ba757f3a239bd46e41e4e9876d52","unresolved":false,"context_lines":[{"line_number":12,"context_line":"The feature is added for all plugins that support DHCP scheduling"},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I6ab03b1642f54aa1d5de8844d95c758f1cb273f1"},{"line_number":15,"context_line":"Closes-Bug: #1386794"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9aa7fdbe_64b5d07d","line":15,"in_reply_to":"9aa7fdbe_89ec8d91","updated":"2014-10-29 07:27:48.000000000","message":"Done","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"61d5cd04892148f498e87c717e596cd3a69af1af","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Eugene Nikanorov \u003cenikanorov@mirantis.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-11-11 15:37:27 +0400"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add option to remove networks from dead DHCP agents"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Networks are removed from dead agents after a certain time."},{"line_number":10,"context_line":"Then unhosted networks could be picked up by alive DHCP agents."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5a890539_89e4683c","line":7,"updated":"2014-11-11 12:39:50.000000000","message":"reschedule?","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9686d351ccccaf6fb78e9d932394751d2c01c18b","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Eugene Nikanorov \u003cenikanorov@mirantis.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-11-11 15:37:27 +0400"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add option to remove networks from dead DHCP agents"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Networks are removed from dead agents after a certain time."},{"line_number":10,"context_line":"Then unhosted networks could be picked up by alive DHCP agents."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5a890539_c4ee5722","line":7,"in_reply_to":"5a890539_89e4683c","updated":"2014-11-11 13:23:26.000000000","message":"The new option is really about removal. Rescheduling is then controlled by already existing option.","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"61d5cd04892148f498e87c717e596cd3a69af1af","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Add option to remove networks from dead DHCP agents"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Networks are removed from dead agents after a certain time."},{"line_number":10,"context_line":"Then unhosted networks could be picked up by alive DHCP agents."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The feature is added for all plugins that support DHCP scheduling"},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5a890539_89bb880d","line":10,"updated":"2014-11-11 12:39:50.000000000","message":"please update as well","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9686d351ccccaf6fb78e9d932394751d2c01c18b","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Add option to remove networks from dead DHCP agents"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Networks are removed from dead agents after a certain time."},{"line_number":10,"context_line":"Then unhosted networks could be picked up by alive DHCP agents."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The feature is added for all plugins that support DHCP scheduling"},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"5a890539_e4f35308","line":10,"in_reply_to":"5a890539_89bb880d","updated":"2014-11-11 13:23:26.000000000","message":"rescheduling is optional, hence \u0027could be\u0027","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":9820,"name":"Liping Mao","email":"limao@cisco.com","username":"LipingMao"},"change_message_id":"16abae68834a9d0217f228cdb8c72a701c22dd2f","unresolved":false,"context_lines":[{"line_number":10,"context_line":"Then unhosted networks could be picked up by alive DHCP agents."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The feature is added for all plugins that support DHCP scheduling"},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I6ab03b1642f54aa1d5de8844d95c758f1cb273f1"},{"line_number":15,"context_line":"Closes-Bug: #1386794"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"3a961159_ab72f7e0","line":13,"updated":"2014-12-30 01:15:00.000000000","message":"DocImpact ?","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"17e65d49a00adcefe2ddf6b151eae29daaca54e6","unresolved":false,"context_lines":[{"line_number":10,"context_line":"Then unhosted networks could be picked up by alive DHCP agents."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"The feature is added for all plugins that support DHCP scheduling"},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Change-Id: I6ab03b1642f54aa1d5de8844d95c758f1cb273f1"},{"line_number":15,"context_line":"Closes-Bug: #1386794"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"3a961159_b2bccdb6","line":13,"in_reply_to":"3a961159_ab72f7e0","updated":"2015-01-14 19:41:18.000000000","message":"Done","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"}],"Empty file":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f7708fb62e867f5900675a70adc951c106205cfb","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":14,"id":"5a890539_7472674a","side":"PARENT","updated":"2014-11-13 16:21:59.000000000","message":"cheeky question: Is it a feature or a bug? If you think it\u0027s a feature, as I do, you know what you should do...","commit_id":"e64ca99e77d921b9db78193dd41b589c9a7e985a"}],"etc/neutron.conf":[{"author":{"_account_id":11825,"name":"Sudhakar Babu Gariganti","email":"sudhakar.gariganti@gmail.com","username":"sudhakar-gariganti"},"change_message_id":"87da2460f42a0f13f3734896cab39c8c4f236d19","unresolved":false,"context_lines":[{"line_number":168,"context_line":""},{"line_number":169,"context_line":"# Allow automatic rescheduling of networks from dead DHCP agents with"},{"line_number":170,"context_line":"# admin_state_up set to True to alive agents."},{"line_number":171,"context_line":"# allow_automatic_dhcp_failover \u003d True"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"# Number of DHCP agents scheduled to host a network. This enables redundant"},{"line_number":174,"context_line":"# DHCP agents for configured networks."}],"source_content_type":"text/plain","patch_set":4,"id":"9aa7fdbe_4909c5dc","line":171,"updated":"2014-10-29 07:06:50.000000000","message":"agentscheduler_db is still having default value set to \u0027False\u0027. But showing it True here will be confusing. What is the default value we are going with?","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f9713d450583ba757f3a239bd46e41e4e9876d52","unresolved":false,"context_lines":[{"line_number":168,"context_line":""},{"line_number":169,"context_line":"# Allow automatic rescheduling of networks from dead DHCP agents with"},{"line_number":170,"context_line":"# admin_state_up set to True to alive agents."},{"line_number":171,"context_line":"# allow_automatic_dhcp_failover \u003d True"},{"line_number":172,"context_line":""},{"line_number":173,"context_line":"# Number of DHCP agents scheduled to host a network. This enables redundant"},{"line_number":174,"context_line":"# DHCP agents for configured networks."}],"source_content_type":"text/plain","patch_set":4,"id":"9aa7fdbe_c4abdc1c","line":171,"in_reply_to":"9aa7fdbe_4909c5dc","updated":"2014-10-29 07:27:48.000000000","message":"should be True, nice catch!","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":10237,"name":"Numan Siddique","email":"nusiddiq@redhat.com","username":"numansiddique"},"change_message_id":"0b3e51c0a92d23170cf9b937e109611da5a0b0a2","unresolved":false,"context_lines":[{"line_number":167,"context_line":"# allow_automatic_l3agent_failover \u003d False"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"# Allow automatic removal of networks from dead DHCP agents with"},{"line_number":170,"context_line":"# admin_state_up set to True to alive agents."},{"line_number":171,"context_line":"# Networks could then be rescheduled if network_auto_schedule is True"},{"line_number":172,"context_line":"# allow_automatic_dhcp_failover \u003d True"},{"line_number":173,"context_line":""}],"source_content_type":"text/plain","patch_set":19,"id":"3a961159_e151a264","line":170,"updated":"2014-12-26 09:44:42.000000000","message":"Suggestion: I think you can remove the last few words i.e \"to alive agents.\".\nPresently the sentence is a bit confusing.","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9fe8c49d534252d82e32e0d96cf46ae4ef6ab2ed","unresolved":false,"context_lines":[{"line_number":167,"context_line":"# allow_automatic_l3agent_failover \u003d False"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"# Allow automatic removal of networks from dead DHCP agents with"},{"line_number":170,"context_line":"# admin_state_up set to True to alive agents."},{"line_number":171,"context_line":"# Networks could then be rescheduled if network_auto_schedule is True"},{"line_number":172,"context_line":"# allow_automatic_dhcp_failover \u003d True"},{"line_number":173,"context_line":""}],"source_content_type":"text/plain","patch_set":19,"id":"3a961159_183a74e7","line":170,"in_reply_to":"3a961159_e151a264","updated":"2014-12-30 14:11:33.000000000","message":"ok","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"}],"neutron/agent/dhcp/agent.py":[{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"885d62ebbcdeee22d1a91d486b6fc539698973d2","unresolved":false,"context_lines":[{"line_number":169,"context_line":"            for deleted_id in known_network_ids - active_network_ids:"},{"line_number":170,"context_line":"                try:"},{"line_number":171,"context_line":"                    self.disable_dhcp_helper(deleted_id)"},{"line_number":172,"context_line":"                    eventlet.sleep(0)"},{"line_number":173,"context_line":"                except Exception as e:"},{"line_number":174,"context_line":"                    self.schedule_resync(e, deleted_id)"},{"line_number":175,"context_line":"                    LOG.exception(_LE(\u0027Unable to sync network state on \u0027"}],"source_content_type":"text/x-python","patch_set":25,"id":"1a930d6b_fd0b387a","line":172,"updated":"2015-01-27 13:50:55.000000000","message":"It might be useful, but it seems unrelated to this change.","commit_id":"2251ffa6680254379e56a92c00ed59e5474d902e"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"a87c4acb85027b7cb64a0f1fd3cb6938173f879f","unresolved":false,"context_lines":[{"line_number":169,"context_line":"            for deleted_id in known_network_ids - active_network_ids:"},{"line_number":170,"context_line":"                try:"},{"line_number":171,"context_line":"                    self.disable_dhcp_helper(deleted_id)"},{"line_number":172,"context_line":"                    eventlet.sleep(0)"},{"line_number":173,"context_line":"                except Exception as e:"},{"line_number":174,"context_line":"                    self.schedule_resync(e, deleted_id)"},{"line_number":175,"context_line":"                    LOG.exception(_LE(\u0027Unable to sync network state on \u0027"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa81d914_d3a9de25","line":172,"in_reply_to":"1a930d6b_530a7d26","updated":"2015-01-27 19:56:39.000000000","message":"Yeah, during the startup phase, there are many greenthreads running. We might need to tweak/improve the priority of report_state or something (though it is a separate topic).","commit_id":"2251ffa6680254379e56a92c00ed59e5474d902e"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"dd390c19373acfeec6ba923d14c1a2e088a719a6","unresolved":false,"context_lines":[{"line_number":169,"context_line":"            for deleted_id in known_network_ids - active_network_ids:"},{"line_number":170,"context_line":"                try:"},{"line_number":171,"context_line":"                    self.disable_dhcp_helper(deleted_id)"},{"line_number":172,"context_line":"                    eventlet.sleep(0)"},{"line_number":173,"context_line":"                except Exception as e:"},{"line_number":174,"context_line":"                    self.schedule_resync(e, deleted_id)"},{"line_number":175,"context_line":"                    LOG.exception(_LE(\u0027Unable to sync network state on \u0027"}],"source_content_type":"text/x-python","patch_set":25,"id":"1a930d6b_530a7d26","line":172,"in_reply_to":"1a930d6b_fd0b387a","updated":"2015-01-27 14:29:17.000000000","message":"Oh, it\u0027s really an artifacts of my debugging process. It didn\u0027t help.\nWhat I tried to do here is to let state reporting greenthread to get a piece of eventlet\u0027s attention, but there are too many other threads...\n\nSo I had to give agent some time after it starts.","commit_id":"2251ffa6680254379e56a92c00ed59e5474d902e"}],"neutron/db/agentschedulers_db.py":[{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"42ba85f51088961c9b720ee7c95956d92a46502d","unresolved":false,"context_lines":[{"line_number":45,"context_line":"               help\u003d_(\u0027Driver to use for scheduling network to DHCP agent\u0027)),"},{"line_number":46,"context_line":"    cfg.BoolOpt(\u0027network_auto_schedule\u0027, default\u003dTrue,"},{"line_number":47,"context_line":"                help\u003d_(\u0027Allow auto scheduling networks to DHCP agent.\u0027)),"},{"line_number":48,"context_line":"    cfg.BoolOpt(\u0027allow_automatic_dhcp_failover\u0027, default\u003dFalse,"},{"line_number":49,"context_line":"                help\u003d_(\u0027Automatically reschedule routers from offline DHCP \u0027"},{"line_number":50,"context_line":"                       \u0027agents to online DHCP agents.\u0027)),"},{"line_number":51,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_45e721e4","line":48,"updated":"2014-10-27 14:46:18.000000000","message":"I think having the default here set to True might be better since i think this would be more desirable.","commit_id":"5cd74fba0e0d059942963bcb1cc5cc3e09b62909"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"ca66fbbbcf243d4b258ff98da76ba25bf54ad981","unresolved":false,"context_lines":[{"line_number":45,"context_line":"               help\u003d_(\u0027Driver to use for scheduling network to DHCP agent\u0027)),"},{"line_number":46,"context_line":"    cfg.BoolOpt(\u0027network_auto_schedule\u0027, default\u003dTrue,"},{"line_number":47,"context_line":"                help\u003d_(\u0027Allow auto scheduling networks to DHCP agent.\u0027)),"},{"line_number":48,"context_line":"    cfg.BoolOpt(\u0027allow_automatic_dhcp_failover\u0027, default\u003dFalse,"},{"line_number":49,"context_line":"                help\u003d_(\u0027Automatically reschedule routers from offline DHCP \u0027"},{"line_number":50,"context_line":"                       \u0027agents to online DHCP agents.\u0027)),"},{"line_number":51,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_85de69db","line":48,"in_reply_to":"9aa7fdbe_45e721e4","updated":"2014-10-27 14:50:25.000000000","message":"ok","commit_id":"5cd74fba0e0d059942963bcb1cc5cc3e09b62909"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"42ba85f51088961c9b720ee7c95956d92a46502d","unresolved":false,"context_lines":[{"line_number":116,"context_line":"    network_scheduler \u003d None"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":119,"context_line":"        #if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":120,"context_line":"        #    LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""},{"line_number":121,"context_line":"        #                 \"automatic network rescheduling is disabled.\"))"},{"line_number":122,"context_line":"        #    return"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_050999dd","line":119,"updated":"2014-10-27 14:46:18.000000000","message":"whoops","commit_id":"5cd74fba0e0d059942963bcb1cc5cc3e09b62909"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"ca66fbbbcf243d4b258ff98da76ba25bf54ad981","unresolved":false,"context_lines":[{"line_number":116,"context_line":"    network_scheduler \u003d None"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":119,"context_line":"        #if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":120,"context_line":"        #    LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""},{"line_number":121,"context_line":"        #                 \"automatic network rescheduling is disabled.\"))"},{"line_number":122,"context_line":"        #    return"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_05cb591f","line":119,"in_reply_to":"9aa7fdbe_050999dd","updated":"2014-10-27 14:50:25.000000000","message":"yep, that\u0027s pretty much debug version","commit_id":"5cd74fba0e0d059942963bcb1cc5cc3e09b62909"},{"author":{"_account_id":11825,"name":"Sudhakar Babu Gariganti","email":"sudhakar.gariganti@gmail.com","username":"sudhakar-gariganti"},"change_message_id":"87da2460f42a0f13f3734896cab39c8c4f236d19","unresolved":false,"context_lines":[{"line_number":45,"context_line":"               help\u003d_(\u0027Driver to use for scheduling network to DHCP agent\u0027)),"},{"line_number":46,"context_line":"    cfg.BoolOpt(\u0027network_auto_schedule\u0027, default\u003dTrue,"},{"line_number":47,"context_line":"                help\u003d_(\u0027Allow auto scheduling networks to DHCP agent.\u0027)),"},{"line_number":48,"context_line":"    cfg.BoolOpt(\u0027allow_automatic_dhcp_failover\u0027, default\u003dFalse,"},{"line_number":49,"context_line":"                help\u003d_(\u0027Automatically remove networks from offline DHCP \u0027"},{"line_number":50,"context_line":"                       \u0027agents.\u0027)),"},{"line_number":51,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9aa7fdbe_64b3100b","line":48,"updated":"2014-10-29 07:06:50.000000000","message":"we are going with the default value  \u0027False\u0027 only?","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f9713d450583ba757f3a239bd46e41e4e9876d52","unresolved":false,"context_lines":[{"line_number":45,"context_line":"               help\u003d_(\u0027Driver to use for scheduling network to DHCP agent\u0027)),"},{"line_number":46,"context_line":"    cfg.BoolOpt(\u0027network_auto_schedule\u0027, default\u003dTrue,"},{"line_number":47,"context_line":"                help\u003d_(\u0027Allow auto scheduling networks to DHCP agent.\u0027)),"},{"line_number":48,"context_line":"    cfg.BoolOpt(\u0027allow_automatic_dhcp_failover\u0027, default\u003dFalse,"},{"line_number":49,"context_line":"                help\u003d_(\u0027Automatically remove networks from offline DHCP \u0027"},{"line_number":50,"context_line":"                       \u0027agents.\u0027)),"},{"line_number":51,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9aa7fdbe_e4a8e022","line":48,"in_reply_to":"9aa7fdbe_64b3100b","updated":"2014-10-29 07:27:48.000000000","message":"Done","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":11825,"name":"Sudhakar Babu Gariganti","email":"sudhakar.gariganti@gmail.com","username":"sudhakar-gariganti"},"change_message_id":"87da2460f42a0f13f3734896cab39c8c4f236d19","unresolved":false,"context_lines":[{"line_number":130,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":133,"context_line":"        \"\"\"Reschedule routers from down l3 agents if admin state is up.\"\"\""},{"line_number":134,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":135,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":136,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":4,"id":"9aa7fdbe_a9db117c","line":133,"updated":"2014-10-29 07:06:50.000000000","message":"Change the docstring.","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f9713d450583ba757f3a239bd46e41e4e9876d52","unresolved":false,"context_lines":[{"line_number":130,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":133,"context_line":"        \"\"\"Reschedule routers from down l3 agents if admin state is up.\"\"\""},{"line_number":134,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":135,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":136,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":4,"id":"9aa7fdbe_04a6c453","line":133,"in_reply_to":"9aa7fdbe_a9db117c","updated":"2014-10-29 07:27:48.000000000","message":"Done","commit_id":"ee76ee7a9b44352dd725b3d50e1b7fc557e738a4"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"61d5cd04892148f498e87c717e596cd3a69af1af","unresolved":false,"context_lines":[{"line_number":45,"context_line":"    cfg.BoolOpt(\u0027network_auto_schedule\u0027, default\u003dTrue,"},{"line_number":46,"context_line":"                help\u003d_(\u0027Allow auto scheduling networks to DHCP agent.\u0027)),"},{"line_number":47,"context_line":"    cfg.BoolOpt(\u0027allow_automatic_dhcp_failover\u0027, default\u003dTrue,"},{"line_number":48,"context_line":"                help\u003d_(\u0027Automatically remove networks from offline DHCP \u0027"},{"line_number":49,"context_line":"                       \u0027agents.\u0027)),"},{"line_number":50,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"},{"line_number":51,"context_line":"               help\u003d_(\u0027Number of DHCP agents scheduled to host a network.\u0027)),"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_ae884a23","line":48,"updated":"2014-11-11 12:39:50.000000000","message":"please align with the description in neutron conf, is it rescheduling or only removing from dead agents? seems first","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9686d351ccccaf6fb78e9d932394751d2c01c18b","unresolved":false,"context_lines":[{"line_number":45,"context_line":"    cfg.BoolOpt(\u0027network_auto_schedule\u0027, default\u003dTrue,"},{"line_number":46,"context_line":"                help\u003d_(\u0027Allow auto scheduling networks to DHCP agent.\u0027)),"},{"line_number":47,"context_line":"    cfg.BoolOpt(\u0027allow_automatic_dhcp_failover\u0027, default\u003dTrue,"},{"line_number":48,"context_line":"                help\u003d_(\u0027Automatically remove networks from offline DHCP \u0027"},{"line_number":49,"context_line":"                       \u0027agents.\u0027)),"},{"line_number":50,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"},{"line_number":51,"context_line":"               help\u003d_(\u0027Number of DHCP agents scheduled to host a network.\u0027)),"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_4448a72d","line":48,"in_reply_to":"5a890539_ae884a23","updated":"2014-11-11 13:23:26.000000000","message":"Done","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"61d5cd04892148f498e87c717e596cd3a69af1af","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":129,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Reschedule routers from down l3 agents if admin state is up.\"\"\""},{"line_number":133,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":134,"context_line":"        # give agents extra time to handle transient failures"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_ee6df205","line":131,"updated":"2014-11-11 12:39:50.000000000","message":"def reschedule_networks..?","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9686d351ccccaf6fb78e9d932394751d2c01c18b","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":129,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Reschedule routers from down l3 agents if admin state is up.\"\"\""},{"line_number":133,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":134,"context_line":"        # give agents extra time to handle transient failures"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_04477f20","line":131,"in_reply_to":"5a890539_ee6df205","updated":"2014-11-11 13:23:26.000000000","message":"the main goal is to remove, scheduling is optional","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"61d5cd04892148f498e87c717e596cd3a69af1af","unresolved":false,"context_lines":[{"line_number":129,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Reschedule routers from down l3 agents if admin state is up.\"\"\""},{"line_number":133,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":134,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":135,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_2e5e1a46","line":132,"updated":"2014-11-11 12:39:50.000000000","message":"routers -\u003e networks","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9686d351ccccaf6fb78e9d932394751d2c01c18b","unresolved":false,"context_lines":[{"line_number":129,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Reschedule routers from down l3 agents if admin state is up.\"\"\""},{"line_number":133,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":134,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":135,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_c4d57744","line":132,"in_reply_to":"5a890539_2e5e1a46","updated":"2014-11-11 13:23:26.000000000","message":"Done","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"dc8abff67ace98382f1087a1f6ac99d2965ef613","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":133,"context_line":"        "},{"line_number":134,"context_line":"        Reschedule them if configured so"},{"line_number":135,"context_line":"        \"\"\""},{"line_number":136,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"}],"source_content_type":"text/x-python","patch_set":12,"id":"5a890539_8220be4a","line":133,"updated":"2014-11-11 14:59:37.000000000","message":"whitespace","commit_id":"61b1ab0583eb3cb31022e01ee73cecef758afbfb"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"622a6925989a6766c4d6437d54807ee0ca39349c","unresolved":false,"context_lines":[{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":133,"context_line":"        "},{"line_number":134,"context_line":"        Reschedule them if configured so"},{"line_number":135,"context_line":"        \"\"\""},{"line_number":136,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"}],"source_content_type":"text/x-python","patch_set":12,"id":"5a890539_e51a6c6d","line":133,"in_reply_to":"5a890539_8220be4a","updated":"2014-11-11 15:22:24.000000000","message":"damn!","commit_id":"61b1ab0583eb3cb31022e01ee73cecef758afbfb"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"1e48ba96706b964074ad9b62117e1725fdf62161","unresolved":false,"context_lines":[{"line_number":112,"context_line":"    \"\"\"Mixin class to add DHCP agent scheduler extension to db_base_plugin_v2."},{"line_number":113,"context_line":"    \"\"\""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    network_scheduler \u003d None"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":118,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_334f43bf","line":115,"updated":"2014-11-12 13:46:02.000000000","message":"IIRC exceptions cause the loop to stop until the server is restarted. Kevin\u0027s dealing with that in the routers rescheduling case, what about here?","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"06d758476311666593b74bbdc5cc316639642be0","unresolved":false,"context_lines":[{"line_number":112,"context_line":"    \"\"\"Mixin class to add DHCP agent scheduler extension to db_base_plugin_v2."},{"line_number":113,"context_line":"    \"\"\""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    network_scheduler \u003d None"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":118,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_97cc196c","line":115,"in_reply_to":"5a890539_334f43bf","updated":"2014-11-14 10:54:11.000000000","message":"good point","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"1e48ba96706b964074ad9b62117e1725fdf62161","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    \"\"\""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    network_scheduler \u003d None"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":118,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":119,"context_line":"            LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_932f17f6","line":116,"updated":"2014-11-12 13:46:02.000000000","message":"As you know the exact same method exists in db/l3_agentschedulers_db.L3AgentSchedulerDbMixin, why don\u0027t you change it so it can be used here as well? The only difference is the method invoked in the looping call.","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"06d758476311666593b74bbdc5cc316639642be0","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    \"\"\""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    network_scheduler \u003d None"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":118,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":119,"context_line":"            LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_f7bf1da8","line":116,"in_reply_to":"5a890539_932f17f6","updated":"2014-11-14 10:54:11.000000000","message":"that was on my plan, but out of scope of this patch","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"af837318c420cefbc5e1d879f34ac126ec20a5cd","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    \"\"\""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    network_scheduler \u003d None"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":118,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":119,"context_line":"            LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_27724a11","line":116,"in_reply_to":"5a890539_e8bf38a8","updated":"2014-11-14 15:01:32.000000000","message":"well, ok. I was thinking about it, but just found that while logic is really the same, some small aspects of it like configuration options, log lines, methods to call are different, which makes really simple code quite different despite of logical similarity.","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"d06891e66191101a4b7160b721fc09043f3ef87f","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    \"\"\""},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    network_scheduler \u003d None"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":118,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":119,"context_line":"            LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_e8bf38a8","line":116,"in_reply_to":"5a890539_f7bf1da8","updated":"2014-11-14 12:21:58.000000000","message":"I hate to stress the point, but why is out of scope? You\u0027re introducing new code that is identical in structure to existing code that does the same logical operation.","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f7708fb62e867f5900675a70adc951c106205cfb","unresolved":false,"context_lines":[{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    network_scheduler \u003d None"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":118,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":119,"context_line":"            LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""},{"line_number":120,"context_line":"                         \"automatic network rescheduling is disabled.\"))"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_9490b344","line":117,"updated":"2014-11-13 16:21:59.000000000","message":"I think the bottom line of Assaf\u0027s comment is that the agent scheduler mixins are a pile of rublle at the moment and we should consider reworking them. This is outside the scope of this patch, but I wonder if we should first do such refactoring before adding new features.","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"06d758476311666593b74bbdc5cc316639642be0","unresolved":false,"context_lines":[{"line_number":114,"context_line":""},{"line_number":115,"context_line":"    network_scheduler \u003d None"},{"line_number":116,"context_line":""},{"line_number":117,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":118,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":119,"context_line":"            LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""},{"line_number":120,"context_line":"                         \"automatic network rescheduling is disabled.\"))"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_779ded58","line":117,"in_reply_to":"5a890539_9490b344","updated":"2014-11-14 10:54:11.000000000","message":"Well, obviously there is some similar logic between l3 scheduler and dhcp scheduler, that could be eliminated by refactoring.\n\nBut looking at those methods I see that refactoring is not bringing much benefit to the code as amount of parametrisation will be quite high","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"1e48ba96706b964074ad9b62117e1725fdf62161","unresolved":false,"context_lines":[{"line_number":127,"context_line":"        # neutron server first starts. random to offset multiple servers"},{"line_number":128,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":129,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":133,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_13696725","line":130,"updated":"2014-11-12 13:46:02.000000000","message":"reschedule_routers_from_down_agents exists in the same file. It\u0027s identical up until the DB query, and the body of the down_bindings loop. Seems pretty easy to re-use code here...","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f7708fb62e867f5900675a70adc951c106205cfb","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":129,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        Reschedule them if configured so"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_b493ef4d","line":131,"updated":"2014-11-13 16:21:59.000000000","message":"Agreed","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"06d758476311666593b74bbdc5cc316639642be0","unresolved":false,"context_lines":[{"line_number":128,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":129,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":130,"context_line":""},{"line_number":131,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":132,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        Reschedule them if configured so"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_17d3c960","line":131,"in_reply_to":"5a890539_b493ef4d","updated":"2014-11-14 10:54:11.000000000","message":"I have to disagree, rescheduling and removing is quite different operations.\nMajor goal of this feature is to let deployment decide, whether it wants automatic rescheduling (it\u0027s might not be the case!)\n\nI deliberately changed from \u0027reschedule\u0027 to \u0027remove\u0027 after discussions with devops.","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f7708fb62e867f5900675a70adc951c106205cfb","unresolved":false,"context_lines":[{"line_number":135,"context_line":"        \"\"\""},{"line_number":136,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":137,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":138,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":141,"context_line":"        # detected, sleep for a while to let the agents check in."}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_d49a3b62","line":138,"updated":"2014-11-13 16:21:59.000000000","message":"This should probably be configurable - I won\u0027t mind another, optional, configuration variable","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"06d758476311666593b74bbdc5cc316639642be0","unresolved":false,"context_lines":[{"line_number":135,"context_line":"        \"\"\""},{"line_number":136,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":137,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":138,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":141,"context_line":"        # detected, sleep for a while to let the agents check in."}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_f7671db5","line":138,"in_reply_to":"5a890539_d49a3b62","updated":"2014-11-14 10:54:11.000000000","message":"Right now it\u0027s just the same code as in L3 rescheduling, we might introduce some common parameter here.","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"f7708fb62e867f5900675a70adc951c106205cfb","unresolved":false,"context_lines":[{"line_number":165,"context_line":"                      \u0027dead_time\u0027: agent_dead_limit})"},{"line_number":166,"context_line":"            self.remove_network_from_dhcp_agent(context, binding.dhcp_agent_id,"},{"line_number":167,"context_line":"                                                binding.network_id)"},{"line_number":168,"context_line":"            if cfg.CONF.network_auto_schedule:"},{"line_number":169,"context_line":"                LOG.debug(\"Scheduling unhosted network %s\", binding.network_id)"},{"line_number":170,"context_line":"                try:"},{"line_number":171,"context_line":"                    # TODO(enikanorov): have to issue redundant db query"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_f49d775a","line":168,"updated":"2014-11-13 16:21:59.000000000","message":"Are you sure it is ok to automatically unschedule networks which were not automatically scheduled in the first place?","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"06d758476311666593b74bbdc5cc316639642be0","unresolved":false,"context_lines":[{"line_number":165,"context_line":"                      \u0027dead_time\u0027: agent_dead_limit})"},{"line_number":166,"context_line":"            self.remove_network_from_dhcp_agent(context, binding.dhcp_agent_id,"},{"line_number":167,"context_line":"                                                binding.network_id)"},{"line_number":168,"context_line":"            if cfg.CONF.network_auto_schedule:"},{"line_number":169,"context_line":"                LOG.debug(\"Scheduling unhosted network %s\", binding.network_id)"},{"line_number":170,"context_line":"                try:"},{"line_number":171,"context_line":"                    # TODO(enikanorov): have to issue redundant db query"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_176109a9","line":168,"in_reply_to":"5a890539_f49d775a","updated":"2014-11-14 10:54:11.000000000","message":"If agent is dead and the auto removal option is on - that\u0027s what cloud operator intended to do.\nNow options provide ability to choose both aspects of the process: whether to remove networks and whether to reschedule them","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"fe95bc37f2c653b3c6d4e0ae9936c3b2055a439e","unresolved":false,"context_lines":[{"line_number":47,"context_line":"                help\u003d_(\u0027Allow auto scheduling networks to DHCP agent.\u0027)),"},{"line_number":48,"context_line":"    cfg.BoolOpt(\u0027allow_automatic_dhcp_failover\u0027, default\u003dTrue,"},{"line_number":49,"context_line":"                help\u003d_(\u0027Automatically remove networks from offline DHCP \u0027"},{"line_number":50,"context_line":"                       \u0027agents.\u0027)),"},{"line_number":51,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"},{"line_number":52,"context_line":"               help\u003d_(\u0027Number of DHCP agents scheduled to host a network.\u0027)),"},{"line_number":53,"context_line":"]"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a961159_bbe35a03","line":50,"updated":"2014-12-24 17:28:48.000000000","message":"nit: to online DHCP agents.","commit_id":"20802537140aa5978171b85d7e4af48b9678cdcd"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"0e885bf8b0e6788c434176223c63764cbe10daac","unresolved":false,"context_lines":[{"line_number":47,"context_line":"                help\u003d_(\u0027Allow auto scheduling networks to DHCP agent.\u0027)),"},{"line_number":48,"context_line":"    cfg.BoolOpt(\u0027allow_automatic_dhcp_failover\u0027, default\u003dTrue,"},{"line_number":49,"context_line":"                help\u003d_(\u0027Automatically remove networks from offline DHCP \u0027"},{"line_number":50,"context_line":"                       \u0027agents.\u0027)),"},{"line_number":51,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"},{"line_number":52,"context_line":"               help\u003d_(\u0027Number of DHCP agents scheduled to host a network.\u0027)),"},{"line_number":53,"context_line":"]"}],"source_content_type":"text/x-python","patch_set":18,"id":"3a961159_9b6e9e2d","line":50,"in_reply_to":"3a961159_bbe35a03","updated":"2014-12-24 17:54:54.000000000","message":"That\u0027s would not be exactly correct. Moving networks to online agents will only work if network_auto_schedule is set to True.\n\nOther wise option only triggers \"unscheduling\"\nDo you think it makes sense to rephrase the help for this option?","commit_id":"20802537140aa5978171b85d7e4af48b9678cdcd"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"bf4f16ca33098289e11fac9fb586b714f39e9a60","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    network_scheduler \u003d None"},{"line_number":147,"context_line":""},{"line_number":148,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":149,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":150,"context_line":"            LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""},{"line_number":151,"context_line":"                         \"automatic network rescheduling is disabled.\"))"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a961159_7b63d9aa","line":148,"updated":"2015-01-16 13:47:46.000000000","message":"In plugins which supports both network scheduler and l3 scheduler, there is a conflict in the method name. Both mixin classes have the same name. In addition, this method setups dhcp-agent auto rescheduling only. In monolithic plugins which also support L3-plugin, the method name is not easy to understand. Could you add \"dhcp\" or \"network\" to the method name?","commit_id":"73e732bcbc90f9d06c6b6bce10e5796f3e463ec6"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"fcb4345031ab08ec619ea8175294b4d21b8b2b00","unresolved":false,"context_lines":[{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    network_scheduler \u003d None"},{"line_number":147,"context_line":""},{"line_number":148,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":149,"context_line":"        if not cfg.CONF.allow_automatic_dhcp_failover:"},{"line_number":150,"context_line":"            LOG.info(_LI(\"Skipping periodic DHCP agent status check because \""},{"line_number":151,"context_line":"                         \"automatic network rescheduling is disabled.\"))"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a961159_9b8fa522","line":148,"in_reply_to":"3a961159_7b63d9aa","updated":"2015-01-16 14:40:28.000000000","message":"Ok, good point","commit_id":"73e732bcbc90f9d06c6b6bce10e5796f3e463ec6"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"bf0f0c9a193d603e4456ef9738ad2c4f00e9f965","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        self.setup_agent_status_check(self.remove_networks_from_down_agents)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":157,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        Reschedule them if configured so."},{"line_number":160,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":21,"id":"3a961159_ee955be4","line":157,"range":{"start_line":157,"start_character":27,"end_line":157,"end_character":34},"updated":"2015-01-16 01:43:45.000000000","message":"s/routers //","commit_id":"73e732bcbc90f9d06c6b6bce10e5796f3e463ec6"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"743bec88179b26fff6074fe323956cf1c66886cc","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        self.setup_agent_status_check(self.remove_networks_from_down_agents)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":157,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        Reschedule them if configured so."},{"line_number":160,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":21,"id":"3a961159_3a078f1e","line":157,"in_reply_to":"3a961159_ee955be4","updated":"2015-01-16 12:14:41.000000000","message":"oh.\nthanks.","commit_id":"73e732bcbc90f9d06c6b6bce10e5796f3e463ec6"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":106,"context_line":"                                         original_agent[\u0027host\u0027])"},{"line_number":107,"context_line":"        return result"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    def setup_agent_status_check(self, method):"},{"line_number":110,"context_line":"        self.periodic_agent_loop \u003d loopingcall.FixedIntervalLoopingCall("},{"line_number":111,"context_line":"            method)"},{"line_number":112,"context_line":"        interval \u003d max(cfg.CONF.agent_down_time / 2, 1)"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_cdf6e55c","line":109,"updated":"2015-01-27 01:12:46.000000000","message":"(No action required) A method usually refers to a function associated with a class.  In cases where a callable is required, something more generic like \u0027func\u0027 is a more common name.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"41eb65da275678022e844526e2e1acbb070fc3f0","unresolved":false,"context_lines":[{"line_number":106,"context_line":"                                         original_agent[\u0027host\u0027])"},{"line_number":107,"context_line":"        return result"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    def setup_agent_status_check(self, method):"},{"line_number":110,"context_line":"        self.periodic_agent_loop \u003d loopingcall.FixedIntervalLoopingCall("},{"line_number":111,"context_line":"            method)"},{"line_number":112,"context_line":"        interval \u003d max(cfg.CONF.agent_down_time / 2, 1)"}],"source_content_type":"text/x-python","patch_set":24,"id":"fa81d914_a9e93d1c","line":109,"in_reply_to":"1a930d6b_cdf6e55c","updated":"2015-01-28 12:19:18.000000000","message":"Done","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    def setup_agent_status_check(self, method):"},{"line_number":110,"context_line":"        self.periodic_agent_loop \u003d loopingcall.FixedIntervalLoopingCall("},{"line_number":111,"context_line":"            method)"},{"line_number":112,"context_line":"        interval \u003d max(cfg.CONF.agent_down_time / 2, 1)"},{"line_number":113,"context_line":"        # add random initial delay to allow agents to check in after the"},{"line_number":114,"context_line":"        # neutron server first starts. random to offset multiple servers"},{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_0dbd4db7","line":112,"updated":"2015-01-27 01:12:46.000000000","message":"Should the interval be configurable rather than computed?   It seems kind of arbitrary to divide by 2.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9e9e90519a55937f8cacfab013e093536bef5e4","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    def setup_agent_status_check(self, method):"},{"line_number":110,"context_line":"        self.periodic_agent_loop \u003d loopingcall.FixedIntervalLoopingCall("},{"line_number":111,"context_line":"            method)"},{"line_number":112,"context_line":"        interval \u003d max(cfg.CONF.agent_down_time / 2, 1)"},{"line_number":113,"context_line":"        # add random initial delay to allow agents to check in after the"},{"line_number":114,"context_line":"        # neutron server first starts. random to offset multiple servers"},{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_e199e579","line":112,"in_reply_to":"1a930d6b_0dbd4db7","updated":"2015-01-27 07:46:27.000000000","message":"+1","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"8b7d39e226b1f7d8516277690b3a40e915424a9f","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    def setup_agent_status_check(self, method):"},{"line_number":110,"context_line":"        self.periodic_agent_loop \u003d loopingcall.FixedIntervalLoopingCall("},{"line_number":111,"context_line":"            method)"},{"line_number":112,"context_line":"        interval \u003d max(cfg.CONF.agent_down_time / 2, 1)"},{"line_number":113,"context_line":"        # add random initial delay to allow agents to check in after the"},{"line_number":114,"context_line":"        # neutron server first starts. random to offset multiple servers"},{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_0220a599","line":112,"in_reply_to":"1a930d6b_0dbd4db7","updated":"2015-01-27 13:10:46.000000000","message":"I\u0027m intentionally making it the same as L3, with primary goal to leave l3 functionality as is.\n\nI think later it could be done configurable if that is really needed.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        self.periodic_agent_loop \u003d loopingcall.FixedIntervalLoopingCall("},{"line_number":111,"context_line":"            method)"},{"line_number":112,"context_line":"        interval \u003d max(cfg.CONF.agent_down_time / 2, 1)"},{"line_number":113,"context_line":"        # add random initial delay to allow agents to check in after the"},{"line_number":114,"context_line":"        # neutron server first starts. random to offset multiple servers"},{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":116,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_0d0c6dec","line":113,"updated":"2015-01-27 01:12:46.000000000","message":"(No action required) Consider computing the initial delay in a separate statement so that this comment will more obviously apply to that computation.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"8b7d39e226b1f7d8516277690b3a40e915424a9f","unresolved":false,"context_lines":[{"line_number":110,"context_line":"        self.periodic_agent_loop \u003d loopingcall.FixedIntervalLoopingCall("},{"line_number":111,"context_line":"            method)"},{"line_number":112,"context_line":"        interval \u003d max(cfg.CONF.agent_down_time / 2, 1)"},{"line_number":113,"context_line":"        # add random initial delay to allow agents to check in after the"},{"line_number":114,"context_line":"        # neutron server first starts. random to offset multiple servers"},{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":116,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_2223e1a7","line":113,"in_reply_to":"1a930d6b_0d0c6dec","updated":"2015-01-27 13:10:46.000000000","message":"Done","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":116,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_6d28919a","line":118,"updated":"2015-01-27 01:12:46.000000000","message":"This method is not very focused.  Consider separating out the computation of the dead limit from the computation of the cutoff.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9e9e90519a55937f8cacfab013e093536bef5e4","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":116,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_21e4cddf","line":118,"in_reply_to":"1a930d6b_6d28919a","updated":"2015-01-27 07:46:27.000000000","message":"+1 :)","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"41eb65da275678022e844526e2e1acbb070fc3f0","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":116,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":24,"id":"fa81d914_8973994c","line":118,"in_reply_to":"1a930d6b_6d28919a","updated":"2015-01-28 12:19:18.000000000","message":"Done","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":124,"context_line":"        # detected, sleep for a while to let the agents check in."}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_ed664129","line":121,"updated":"2015-01-27 01:12:46.000000000","message":"Should this be configurable?  It seems kind of arbitrary to multiple the configured value by 2.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"d08ddea1ba018744acd3c6a779ff92695b8fd335","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":124,"context_line":"        # detected, sleep for a while to let the agents check in."}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_33ded1dd","line":121,"in_reply_to":"1a930d6b_e27ab986","updated":"2015-01-27 14:22:18.000000000","message":"If that\u0027s the current behavior for L3 I would be ok with follow up patch allowing configuration for this.\n\nEven moving to [AGENT] section of neutron.conf and obsoleting the old settings could make sense.\n\nIn this state we\u0027re not adding any new settings, which is good if we coalesce them later.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9e9e90519a55937f8cacfab013e093536bef5e4","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":124,"context_line":"        # detected, sleep for a while to let the agents check in."}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_c175c932","line":121,"in_reply_to":"1a930d6b_ed664129","updated":"2015-01-27 07:46:27.000000000","message":"+1","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"8b7d39e226b1f7d8516277690b3a40e915424a9f","unresolved":false,"context_lines":[{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":124,"context_line":"        # detected, sleep for a while to let the agents check in."}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_e27ab986","line":121,"in_reply_to":"1a930d6b_ed664129","updated":"2015-01-27 13:10:46.000000000","message":"I got your point, however I\u0027d prefer to handle adding new cfg parameters separately.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":124,"context_line":"        # detected, sleep for a while to let the agents check in."},{"line_number":125,"context_line":"        tdelta \u003d timeutils.utcnow() - getattr(self, \u0027_clock_jump_canary\u0027,"},{"line_number":126,"context_line":"                                              timeutils.utcnow())"},{"line_number":127,"context_line":"        if timeutils.total_seconds(tdelta) \u003e cfg.CONF.agent_down_time:"},{"line_number":128,"context_line":"            LOG.warn(_LW(\"Time since last DHCP agent reschedule check has \""}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_eda481bb","line":125,"updated":"2015-01-27 01:12:46.000000000","message":"(No action required) Consider using a lazy-loading property to encapsulate the canary.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"41eb65da275678022e844526e2e1acbb070fc3f0","unresolved":false,"context_lines":[{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":124,"context_line":"        # detected, sleep for a while to let the agents check in."},{"line_number":125,"context_line":"        tdelta \u003d timeutils.utcnow() - getattr(self, \u0027_clock_jump_canary\u0027,"},{"line_number":126,"context_line":"                                              timeutils.utcnow())"},{"line_number":127,"context_line":"        if timeutils.total_seconds(tdelta) \u003e cfg.CONF.agent_down_time:"},{"line_number":128,"context_line":"            LOG.warn(_LW(\"Time since last DHCP agent reschedule check has \""}],"source_content_type":"text/x-python","patch_set":24,"id":"fa81d914_8f52b9db","line":125,"in_reply_to":"1a930d6b_eda481bb","updated":"2015-01-28 12:19:18.000000000","message":"I think I\u0027ll leave it as is because otherwise it\u0027s going to take much more lines","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"30323b3517c05a732928569ab582efc1f1ab6397","unresolved":false,"context_lines":[{"line_number":122,"context_line":""},{"line_number":123,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":124,"context_line":"        # detected, sleep for a while to let the agents check in."},{"line_number":125,"context_line":"        tdelta \u003d timeutils.utcnow() - getattr(self, \u0027_clock_jump_canary\u0027,"},{"line_number":126,"context_line":"                                              timeutils.utcnow())"},{"line_number":127,"context_line":"        if timeutils.total_seconds(tdelta) \u003e cfg.CONF.agent_down_time:"},{"line_number":128,"context_line":"            LOG.warn(_LW(\"Time since last DHCP agent reschedule check has \""}],"source_content_type":"text/x-python","patch_set":24,"id":"fa81d914_e39b3ec7","line":125,"in_reply_to":"fa81d914_8f52b9db","updated":"2015-01-28 17:49:21.000000000","message":"Fair enough, but more maintainable code is almost always preferable to fewer lines of less maintainable code.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9e9e90519a55937f8cacfab013e093536bef5e4","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        Reschedule them if configured so."},{"line_number":160,"context_line":"        \"\"\""},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"        cutoff, agent_dead_limit \u003d self.check_wait_down_agents()"},{"line_number":163,"context_line":""},{"line_number":164,"context_line":"        context \u003d n_ctx.get_admin_context()"},{"line_number":165,"context_line":"        down_bindings \u003d ("}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_410c7994","line":162,"updated":"2015-01-27 07:46:27.000000000","message":"as maru said, I would \n\n1) check, \n\n2) wait if needed, \n\nbut in separate functions, because it\u0027s not very obvious what the function \"check_wait_down_agents\" do if you don\u0027t go and read it.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":177,"context_line":"                      \u0027dead_time\u0027: agent_dead_limit})"},{"line_number":178,"context_line":"            self.remove_network_from_dhcp_agent(context, binding.dhcp_agent_id,"},{"line_number":179,"context_line":"                                                binding.network_id)"},{"line_number":180,"context_line":"            if cfg.CONF.network_auto_schedule:"},{"line_number":181,"context_line":"                LOG.info(_LI(\"Scheduling unhosted network %s\"),"},{"line_number":182,"context_line":"                         binding.network_id)"},{"line_number":183,"context_line":"                try:"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_6dd411ec","line":180,"updated":"2015-01-27 01:12:46.000000000","message":"Please refactor lines 181-208 into a separate function (e.g. _schedule_unhosted_network() to improve testability and readability.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9e9e90519a55937f8cacfab013e093536bef5e4","unresolved":false,"context_lines":[{"line_number":177,"context_line":"                      \u0027dead_time\u0027: agent_dead_limit})"},{"line_number":178,"context_line":"            self.remove_network_from_dhcp_agent(context, binding.dhcp_agent_id,"},{"line_number":179,"context_line":"                                                binding.network_id)"},{"line_number":180,"context_line":"            if cfg.CONF.network_auto_schedule:"},{"line_number":181,"context_line":"                LOG.info(_LI(\"Scheduling unhosted network %s\"),"},{"line_number":182,"context_line":"                         binding.network_id)"},{"line_number":183,"context_line":"                try:"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_01643148","line":180,"in_reply_to":"1a930d6b_6dd411ec","updated":"2015-01-27 07:46:27.000000000","message":"+1","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"8b7d39e226b1f7d8516277690b3a40e915424a9f","unresolved":false,"context_lines":[{"line_number":177,"context_line":"                      \u0027dead_time\u0027: agent_dead_limit})"},{"line_number":178,"context_line":"            self.remove_network_from_dhcp_agent(context, binding.dhcp_agent_id,"},{"line_number":179,"context_line":"                                                binding.network_id)"},{"line_number":180,"context_line":"            if cfg.CONF.network_auto_schedule:"},{"line_number":181,"context_line":"                LOG.info(_LI(\"Scheduling unhosted network %s\"),"},{"line_number":182,"context_line":"                         binding.network_id)"},{"line_number":183,"context_line":"                try:"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_62ade9e8","line":180,"in_reply_to":"1a930d6b_6dd411ec","updated":"2015-01-27 13:10:46.000000000","message":"Done","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":201,"context_line":"                                      \u0027host\u0027: agent.host})"},{"line_number":202,"context_line":"                            dhcp_notifier.network_added_to_agent("},{"line_number":203,"context_line":"                                context, binding.network_id, agent.host)"},{"line_number":204,"context_line":"                except Exception:"},{"line_number":205,"context_line":"                    # catching any exception during scheduling"},{"line_number":206,"context_line":"                    LOG.exception(_LE(\"Failed to reschedule network %s\"),"},{"line_number":207,"context_line":"                                  binding.network_id)"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_ed2e41fa","line":204,"updated":"2015-01-27 01:12:46.000000000","message":"What exception is actually suggested here, and is there a more specific one that can be trapped for?","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"41eb65da275678022e844526e2e1acbb070fc3f0","unresolved":false,"context_lines":[{"line_number":201,"context_line":"                                      \u0027host\u0027: agent.host})"},{"line_number":202,"context_line":"                            dhcp_notifier.network_added_to_agent("},{"line_number":203,"context_line":"                                context, binding.network_id, agent.host)"},{"line_number":204,"context_line":"                except Exception:"},{"line_number":205,"context_line":"                    # catching any exception during scheduling"},{"line_number":206,"context_line":"                    LOG.exception(_LE(\"Failed to reschedule network %s\"),"},{"line_number":207,"context_line":"                                  binding.network_id)"}],"source_content_type":"text/x-python","patch_set":24,"id":"fa81d914_fa8215ff","line":204,"in_reply_to":"1a930d6b_53f6fd8f","updated":"2015-01-28 12:19:18.000000000","message":"Done","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"8b7d39e226b1f7d8516277690b3a40e915424a9f","unresolved":false,"context_lines":[{"line_number":201,"context_line":"                                      \u0027host\u0027: agent.host})"},{"line_number":202,"context_line":"                            dhcp_notifier.network_added_to_agent("},{"line_number":203,"context_line":"                                context, binding.network_id, agent.host)"},{"line_number":204,"context_line":"                except Exception:"},{"line_number":205,"context_line":"                    # catching any exception during scheduling"},{"line_number":206,"context_line":"                    LOG.exception(_LE(\"Failed to reschedule network %s\"),"},{"line_number":207,"context_line":"                                  binding.network_id)"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_62708972","line":204,"in_reply_to":"1a930d6b_c180698d","updated":"2015-01-27 13:10:46.000000000","message":"Miguel, capturing such list is not what this try-catch block is trying to solve, see my reply above.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"d08ddea1ba018744acd3c6a779ff92695b8fd335","unresolved":false,"context_lines":[{"line_number":201,"context_line":"                                      \u0027host\u0027: agent.host})"},{"line_number":202,"context_line":"                            dhcp_notifier.network_added_to_agent("},{"line_number":203,"context_line":"                                context, binding.network_id, agent.host)"},{"line_number":204,"context_line":"                except Exception:"},{"line_number":205,"context_line":"                    # catching any exception during scheduling"},{"line_number":206,"context_line":"                    LOG.exception(_LE(\"Failed to reschedule network %s\"),"},{"line_number":207,"context_line":"                                  binding.network_id)"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_53f6fd8f","line":204,"in_reply_to":"1a930d6b_e23d5990","updated":"2015-01-27 14:22:18.000000000","message":"May be some comment about the reasoning would be good, I understand it now, as long as the exception is dumped in the log, that should be ok.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9e9e90519a55937f8cacfab013e093536bef5e4","unresolved":false,"context_lines":[{"line_number":201,"context_line":"                                      \u0027host\u0027: agent.host})"},{"line_number":202,"context_line":"                            dhcp_notifier.network_added_to_agent("},{"line_number":203,"context_line":"                                context, binding.network_id, agent.host)"},{"line_number":204,"context_line":"                except Exception:"},{"line_number":205,"context_line":"                    # catching any exception during scheduling"},{"line_number":206,"context_line":"                    LOG.exception(_LE(\"Failed to reschedule network %s\"),"},{"line_number":207,"context_line":"                                  binding.network_id)"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_c180698d","line":204,"in_reply_to":"1a930d6b_ed2e41fa","updated":"2015-01-27 07:46:27.000000000","message":"Sorry not to be adding any new comments, but capturing a wide open exception will only hide any kind of bug (even unexpected ones that need more attention).\n\nI would make a list of the exceptions that need to be actually captured and only capture those.\n\nIf the worry here is to keep the loopingcall working in the event of unexpected errors, that\u0027s already done by oslo FixedIntervalLoopingCall:\n\nhttps://github.com/openstack/neutron/blob/master/neutron/openstack/common/loopingcall.py#L94","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"8b7d39e226b1f7d8516277690b3a40e915424a9f","unresolved":false,"context_lines":[{"line_number":201,"context_line":"                                      \u0027host\u0027: agent.host})"},{"line_number":202,"context_line":"                            dhcp_notifier.network_added_to_agent("},{"line_number":203,"context_line":"                                context, binding.network_id, agent.host)"},{"line_number":204,"context_line":"                except Exception:"},{"line_number":205,"context_line":"                    # catching any exception during scheduling"},{"line_number":206,"context_line":"                    LOG.exception(_LE(\"Failed to reschedule network %s\"),"},{"line_number":207,"context_line":"                                  binding.network_id)"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_e23d5990","line":204,"in_reply_to":"1a930d6b_ed2e41fa","updated":"2015-01-27 13:10:46.000000000","message":"The reason for broad catching is that this is a part of the loop which would be incorrect to break if processing of one network fails.\n\nSo that\u0027s really a precaution - I could find out a list of exceptions that could be raised by methods inside, but I really want to be safe against everything (especially if it will be changed further) just to be able to process every network.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"885d62ebbcdeee22d1a91d486b6fc539698973d2","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        dhcp_notifier \u003d self.agent_notifiers.get(constants.AGENT_TYPE_DHCP)"},{"line_number":219,"context_line":"        # to save few db calls: store already checked agents in dict"},{"line_number":220,"context_line":"        # id -\u003e is_agent_starting_up"},{"line_number":221,"context_line":"        cache \u003d {}"},{"line_number":222,"context_line":"        for binding in down_bindings:"},{"line_number":223,"context_line":"            agent_id \u003d binding.dhcp_agent[\u0027id\u0027]"},{"line_number":224,"context_line":"            if agent_id not in cache:"}],"source_content_type":"text/x-python","patch_set":25,"id":"1a930d6b_bd661028","line":221,"updated":"2015-01-27 13:50:55.000000000","message":"Please consider changing the variable name to a clearer name. It caches information about an agent is in a startup phase or not.","commit_id":"2251ffa6680254379e56a92c00ed59e5474d902e"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"dd390c19373acfeec6ba923d14c1a2e088a719a6","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        dhcp_notifier \u003d self.agent_notifiers.get(constants.AGENT_TYPE_DHCP)"},{"line_number":219,"context_line":"        # to save few db calls: store already checked agents in dict"},{"line_number":220,"context_line":"        # id -\u003e is_agent_starting_up"},{"line_number":221,"context_line":"        cache \u003d {}"},{"line_number":222,"context_line":"        for binding in down_bindings:"},{"line_number":223,"context_line":"            agent_id \u003d binding.dhcp_agent[\u0027id\u0027]"},{"line_number":224,"context_line":"            if agent_id not in cache:"}],"source_content_type":"text/x-python","patch_set":25,"id":"1a930d6b_93006503","line":221,"in_reply_to":"1a930d6b_bd661028","updated":"2015-01-27 14:29:17.000000000","message":"will do, thanks","commit_id":"2251ffa6680254379e56a92c00ed59e5474d902e"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":116,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_b9228bff","line":118,"updated":"2015-01-27 21:06:33.000000000","message":"As per a comment on PS24, this method needs to be refactored.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        self.periodic_agent_loop.start(interval\u003dinterval,"},{"line_number":116,"context_line":"            initial_delay\u003drandom.randint(interval, interval * 2))"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    def check_wait_down_agents(self):"},{"line_number":119,"context_line":"        LOG.debug(\"Checking down DHCP agents\")"},{"line_number":120,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":121,"context_line":"        agent_dead_limit \u003d cfg.CONF.agent_down_time * 2"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_64120db6","line":118,"in_reply_to":"fa81d914_b9228bff","updated":"2015-01-28 12:19:29.000000000","message":"WIll do. I\u0027ve posted this patch before I read comments on ps24.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    def agent_starting_up(self, context, agent):"},{"line_number":157,"context_line":"        \"\"\"Check if agent was just started."},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        When agent starts and it has many networks to process"},{"line_number":160,"context_line":"        it may fail to send state reports in defined interval and server will"},{"line_number":161,"context_line":"        consider it dead, trying to remove networks from it."},{"line_number":162,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_d99e5f63","line":159,"updated":"2015-01-27 21:06:33.000000000","message":"+1 to improving this docstring.  The statement beginning on this line describes a situation but doesn\u0027t indicate why the relevance of the situation to the method.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":156,"context_line":"    def agent_starting_up(self, context, agent):"},{"line_number":157,"context_line":"        \"\"\"Check if agent was just started."},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"        When agent starts and it has many networks to process"},{"line_number":160,"context_line":"        it may fail to send state reports in defined interval and server will"},{"line_number":161,"context_line":"        consider it dead, trying to remove networks from it."},{"line_number":162,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_cf3111a4","line":159,"in_reply_to":"fa81d914_d99e5f63","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":160,"context_line":"        it may fail to send state reports in defined interval and server will"},{"line_number":161,"context_line":"        consider it dead, trying to remove networks from it."},{"line_number":162,"context_line":"        \"\"\""},{"line_number":163,"context_line":"        n_networks \u003d (context.session.query(NetworkDhcpAgentBinding)."},{"line_number":164,"context_line":"                      filter_by(dhcp_agent_id\u003dagent[\u0027id\u0027]).count())"},{"line_number":165,"context_line":"        # amount of networks assigned to agent affect amount of time we give"},{"line_number":166,"context_line":"        # it so startup (2 sec per network)"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_59826f01","line":163,"updated":"2015-01-27 21:06:33.000000000","message":"n_networks -\u003e network_count\n\nPlease try to avoid arbitrary shortforms that hinder readability.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":160,"context_line":"        it may fail to send state reports in defined interval and server will"},{"line_number":161,"context_line":"        consider it dead, trying to remove networks from it."},{"line_number":162,"context_line":"        \"\"\""},{"line_number":163,"context_line":"        n_networks \u003d (context.session.query(NetworkDhcpAgentBinding)."},{"line_number":164,"context_line":"                      filter_by(dhcp_agent_id\u003dagent[\u0027id\u0027]).count())"},{"line_number":165,"context_line":"        # amount of networks assigned to agent affect amount of time we give"},{"line_number":166,"context_line":"        # it so startup (2 sec per network)"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_441d09bd","line":163,"in_reply_to":"fa81d914_59826f01","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":164,"context_line":"                      filter_by(dhcp_agent_id\u003dagent[\u0027id\u0027]).count())"},{"line_number":165,"context_line":"        # amount of networks assigned to agent affect amount of time we give"},{"line_number":166,"context_line":"        # it so startup (2 sec per network)"},{"line_number":167,"context_line":"        agent_dead_limit \u003d datetime.timedelta("},{"line_number":168,"context_line":"            seconds\u003dcfg.CONF.agent_down_time * 2)"},{"line_number":169,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * n_networks)"},{"line_number":170,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_d9c3bf36","line":167,"updated":"2015-01-27 21:06:33.000000000","message":"Arbitrarily determining the variables that manage timing issues is one thing, but duplicating their incidence throughout the code is another.  Please encapsulate things like the dead limit in helper functions for reuse here and in check_wait_down_agents().","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":164,"context_line":"                      filter_by(dhcp_agent_id\u003dagent[\u0027id\u0027]).count())"},{"line_number":165,"context_line":"        # amount of networks assigned to agent affect amount of time we give"},{"line_number":166,"context_line":"        # it so startup (2 sec per network)"},{"line_number":167,"context_line":"        agent_dead_limit \u003d datetime.timedelta("},{"line_number":168,"context_line":"            seconds\u003dcfg.CONF.agent_down_time * 2)"},{"line_number":169,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * n_networks)"},{"line_number":170,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_a48325cb","line":167,"in_reply_to":"fa81d914_d9c3bf36","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        # it so startup (2 sec per network)"},{"line_number":167,"context_line":"        agent_dead_limit \u003d datetime.timedelta("},{"line_number":168,"context_line":"            seconds\u003dcfg.CONF.agent_down_time * 2)"},{"line_number":169,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * n_networks)"},{"line_number":170,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","},{"line_number":171,"context_line":"                  additional_time)"},{"line_number":172,"context_line":"        return (agent[\u0027started_at\u0027] + agent_dead_limit +"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_59834fcc","line":169,"updated":"2015-01-27 21:06:33.000000000","message":"ditto","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        # it so startup (2 sec per network)"},{"line_number":167,"context_line":"        agent_dead_limit \u003d datetime.timedelta("},{"line_number":168,"context_line":"            seconds\u003dcfg.CONF.agent_down_time * 2)"},{"line_number":169,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * n_networks)"},{"line_number":170,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","},{"line_number":171,"context_line":"                  additional_time)"},{"line_number":172,"context_line":"        return (agent[\u0027started_at\u0027] + agent_dead_limit +"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_c48819ea","line":169,"in_reply_to":"fa81d914_59834fcc","updated":"2015-01-28 12:19:29.000000000","message":"If it\u0027s about multiplier, I really don\u0027t think it makes sense to encapsulate such computation.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"6a49141cb68d4719ab1a04a315f0c43becc99af9","unresolved":false,"context_lines":[{"line_number":169,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * n_networks)"},{"line_number":170,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","},{"line_number":171,"context_line":"                  additional_time)"},{"line_number":172,"context_line":"        return (agent[\u0027started_at\u0027] + agent_dead_limit +"},{"line_number":173,"context_line":"                additional_time \u003e timeutils.utcnow())"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    def _schedule_network(self, context, network_id, dhcp_notifier):"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_7e3ab937","line":172,"updated":"2015-01-27 20:32:34.000000000","message":"nit: would be nice if the docstring above noted what the value meant that it was returning.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":169,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * n_networks)"},{"line_number":170,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","},{"line_number":171,"context_line":"                  additional_time)"},{"line_number":172,"context_line":"        return (agent[\u0027started_at\u0027] + agent_dead_limit +"},{"line_number":173,"context_line":"                additional_time \u003e timeutils.utcnow())"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    def _schedule_network(self, context, network_id, dhcp_notifier):"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_046a311a","line":172,"in_reply_to":"fa81d914_7e3ab937","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    def _schedule_network(self, context, network_id, dhcp_notifier):"},{"line_number":176,"context_line":"        LOG.info(_LI(\"Scheduling unhosted network %s\"),"},{"line_number":177,"context_line":"                network_id)"},{"line_number":178,"context_line":"        try:"},{"line_number":179,"context_line":"            # TODO(enikanorov): have to issue redundant db query"},{"line_number":180,"context_line":"            # to satisfy scheduling interface"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_5958affa","line":177,"updated":"2015-01-27 21:06:33.000000000","message":"(nit) pep8 indent","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    def _schedule_network(self, context, network_id, dhcp_notifier):"},{"line_number":176,"context_line":"        LOG.info(_LI(\"Scheduling unhosted network %s\"),"},{"line_number":177,"context_line":"                network_id)"},{"line_number":178,"context_line":"        try:"},{"line_number":179,"context_line":"            # TODO(enikanorov): have to issue redundant db query"},{"line_number":180,"context_line":"            # to satisfy scheduling interface"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_24773504","line":177,"in_reply_to":"fa81d914_5958affa","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":185,"context_line":"                             \"no eligible agents or it might be \""},{"line_number":186,"context_line":"                             \"already scheduled by another server\"),"},{"line_number":187,"context_line":"                         network_id)"},{"line_number":188,"context_line":"                # move to the next binding"},{"line_number":189,"context_line":"                return"},{"line_number":190,"context_line":"            for agent in agents:"},{"line_number":191,"context_line":"                if dhcp_notifier:"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_79d653c7","line":188,"updated":"2015-01-27 21:06:33.000000000","message":"This comment should be removed - it presumes too much about what the caller.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":185,"context_line":"                             \"no eligible agents or it might be \""},{"line_number":186,"context_line":"                             \"already scheduled by another server\"),"},{"line_number":187,"context_line":"                         network_id)"},{"line_number":188,"context_line":"                # move to the next binding"},{"line_number":189,"context_line":"                return"},{"line_number":190,"context_line":"            for agent in agents:"},{"line_number":191,"context_line":"                if dhcp_notifier:"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_64604d36","line":188,"in_reply_to":"fa81d914_79d653c7","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"6a49141cb68d4719ab1a04a315f0c43becc99af9","unresolved":false,"context_lines":[{"line_number":198,"context_line":"                        context, network_id, agent.host)"},{"line_number":199,"context_line":"        except Exception:"},{"line_number":200,"context_line":"            # catching any exception during scheduling"},{"line_number":201,"context_line":"            LOG.exception(_LE(\"Failed to reschedule network %s\"),"},{"line_number":202,"context_line":"                          network_id)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def remove_networks_from_down_agents(self):"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_7e5f1973","line":201,"updated":"2015-01-27 20:32:34.000000000","message":"should we try to unschedule the network here? What if the network is scheduled on line 181 and we\u0027re not able to send the notification on line 199?","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":198,"context_line":"                        context, network_id, agent.host)"},{"line_number":199,"context_line":"        except Exception:"},{"line_number":200,"context_line":"            # catching any exception during scheduling"},{"line_number":201,"context_line":"            LOG.exception(_LE(\"Failed to reschedule network %s\"),"},{"line_number":202,"context_line":"                          network_id)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def remove_networks_from_down_agents(self):"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_84654147","line":201,"in_reply_to":"fa81d914_7e5f1973","updated":"2015-01-28 12:19:29.000000000","message":"I think it\u0027s ok to leave network scheduled. It will be picked up after DHCP agent state resync","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"6a49141cb68d4719ab1a04a315f0c43becc99af9","unresolved":false,"context_lines":[{"line_number":202,"context_line":"                          network_id)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":205,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":206,"context_line":""},{"line_number":207,"context_line":"        Reschedule them if configured so."},{"line_number":208,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_7ed639c7","line":205,"updated":"2015-01-27 20:32:34.000000000","message":"Looks like you have an extra word \u0027routers\u0027 in the docstring here.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":202,"context_line":"                          network_id)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def remove_networks_from_down_agents(self):"},{"line_number":205,"context_line":"        \"\"\"Remove networks routers from down DHCP agents if admin state is up."},{"line_number":206,"context_line":""},{"line_number":207,"context_line":"        Reschedule them if configured so."},{"line_number":208,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_e4535d6a","line":205,"in_reply_to":"fa81d914_7ed639c7","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":216,"context_line":"            filter(agents_db.Agent.heartbeat_timestamp \u003c cutoff,"},{"line_number":217,"context_line":"                   agents_db.Agent.admin_state_up))"},{"line_number":218,"context_line":"        dhcp_notifier \u003d self.agent_notifiers.get(constants.AGENT_TYPE_DHCP)"},{"line_number":219,"context_line":"        # to save few db calls: store already checked agents in dict"},{"line_number":220,"context_line":"        # id -\u003e is_agent_starting_up"},{"line_number":221,"context_line":"        cache \u003d {}"},{"line_number":222,"context_line":"        for binding in down_bindings:"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_e41c566d","line":219,"updated":"2015-01-27 21:06:33.000000000","message":"Please encapsulate this optimization in a generator instead of cluttering up the method, e.g.\n\ndef filter_bindings(self, bindings):\n  checked_agents \u003d {}\n  for binding in bindings:\n    agent_id \u003d binding.dhcp_agent[\u0027id\u0027]\n    if agent_id not in checked_agents:\n      ...\n    if not checked_agents[agent_id]:\n      yield binding\n\nfiltered_bindings \u003d self.filter_bindings(down_bindings)\nfor binding in filtered_bindings:\n   ...\n\nThis will ensure that the optimization can be maintained and tested separately.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":216,"context_line":"            filter(agents_db.Agent.heartbeat_timestamp \u003c cutoff,"},{"line_number":217,"context_line":"                   agents_db.Agent.admin_state_up))"},{"line_number":218,"context_line":"        dhcp_notifier \u003d self.agent_notifiers.get(constants.AGENT_TYPE_DHCP)"},{"line_number":219,"context_line":"        # to save few db calls: store already checked agents in dict"},{"line_number":220,"context_line":"        # id -\u003e is_agent_starting_up"},{"line_number":221,"context_line":"        cache \u003d {}"},{"line_number":222,"context_line":"        for binding in down_bindings:"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_9a3119ef","line":219,"in_reply_to":"fa81d914_e41c566d","updated":"2015-01-28 12:19:29.000000000","message":"Ok, nice suggestion","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c09a997b6cb15380d377958ebbb7ae27f6d2b2be","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        dhcp_notifier \u003d self.agent_notifiers.get(constants.AGENT_TYPE_DHCP)"},{"line_number":219,"context_line":"        # to save few db calls: store already checked agents in dict"},{"line_number":220,"context_line":"        # id -\u003e is_agent_starting_up"},{"line_number":221,"context_line":"        cache \u003d {}"},{"line_number":222,"context_line":"        for binding in down_bindings:"},{"line_number":223,"context_line":"            agent_id \u003d binding.dhcp_agent[\u0027id\u0027]"},{"line_number":224,"context_line":"            if agent_id not in cache:"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_a41fbe08","line":221,"updated":"2015-01-27 21:06:33.000000000","message":"\u0027cache\u0027 is too generic a term to aid in maintenance.  As per the example above, consider using a name like \u0027checked_agents\u0027 or \u0027agents_to_skip\u0027.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        dhcp_notifier \u003d self.agent_notifiers.get(constants.AGENT_TYPE_DHCP)"},{"line_number":219,"context_line":"        # to save few db calls: store already checked agents in dict"},{"line_number":220,"context_line":"        # id -\u003e is_agent_starting_up"},{"line_number":221,"context_line":"        cache \u003d {}"},{"line_number":222,"context_line":"        for binding in down_bindings:"},{"line_number":223,"context_line":"            agent_id \u003d binding.dhcp_agent[\u0027id\u0027]"},{"line_number":224,"context_line":"            if agent_id not in cache:"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_1a5d2922","line":221,"in_reply_to":"fa81d914_a41fbe08","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"6a49141cb68d4719ab1a04a315f0c43becc99af9","unresolved":false,"context_lines":[{"line_number":242,"context_line":"                                                    binding.network_id)"},{"line_number":243,"context_line":"            except dhcpagentscheduler.NetworkNotHostedByDhcpAgent:"},{"line_number":244,"context_line":"                # measures against concurrent operation"},{"line_number":245,"context_line":"                LOG.debug(\"Network already removed from DHCP agent %s\","},{"line_number":246,"context_line":"                          binding.dhcp_agent_id)"},{"line_number":247,"context_line":"                # still continue and allow concurrent scheduling attempt"},{"line_number":248,"context_line":""}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_7ea47957","line":245,"updated":"2015-01-27 20:32:34.000000000","message":"nit: could be nice to also log  binding.network_id here too.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":242,"context_line":"                                                    binding.network_id)"},{"line_number":243,"context_line":"            except dhcpagentscheduler.NetworkNotHostedByDhcpAgent:"},{"line_number":244,"context_line":"                # measures against concurrent operation"},{"line_number":245,"context_line":"                LOG.debug(\"Network already removed from DHCP agent %s\","},{"line_number":246,"context_line":"                          binding.dhcp_agent_id)"},{"line_number":247,"context_line":"                # still continue and allow concurrent scheduling attempt"},{"line_number":248,"context_line":""}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_9a48395d","line":245,"in_reply_to":"fa81d914_7ea47957","updated":"2015-01-28 12:19:29.000000000","message":"Done","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":"from neutron.common import constants"},{"line_number":28,"context_line":"from neutron.common import utils"},{"line_number":29,"context_line":"from neutron import context as n_ctx"},{"line_number":30,"context_line":"from neutron.db import agents_db"},{"line_number":31,"context_line":"from neutron.db import model_base"},{"line_number":32,"context_line":"from neutron.extensions import agent as ext_agent"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_09531318","line":29,"updated":"2015-01-28 18:26:44.000000000","message":"(No action required) n_ctx -\u003e n_context (avoid arbitrary shortforms)","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":26,"context_line":""},{"line_number":27,"context_line":"from neutron.common import constants"},{"line_number":28,"context_line":"from neutron.common import utils"},{"line_number":29,"context_line":"from neutron import context as n_ctx"},{"line_number":30,"context_line":"from neutron.db import agents_db"},{"line_number":31,"context_line":"from neutron.db import model_base"},{"line_number":32,"context_line":"from neutron.extensions import agent as ext_agent"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_7580c446","line":29,"in_reply_to":"fa81d914_09531318","updated":"2015-01-29 20:24:04.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":49,"context_line":"                help\u003d_(\u0027Automatically remove networks from offline DHCP \u0027"},{"line_number":50,"context_line":"                       \u0027agents.\u0027)),"},{"line_number":51,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"},{"line_number":52,"context_line":"               help\u003d_(\u0027Number of DHCP agents scheduled to host a network.\u0027))"},{"line_number":53,"context_line":"]"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"cfg.CONF.register_opts(AGENTS_SCHEDULER_OPTS)"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_6913af5c","line":52,"updated":"2015-01-28 18:26:44.000000000","message":"Non-functional change, please revert.","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":49,"context_line":"                help\u003d_(\u0027Automatically remove networks from offline DHCP \u0027"},{"line_number":50,"context_line":"                       \u0027agents.\u0027)),"},{"line_number":51,"context_line":"    cfg.IntOpt(\u0027dhcp_agents_per_network\u0027, default\u003d1,"},{"line_number":52,"context_line":"               help\u003d_(\u0027Number of DHCP agents scheduled to host a network.\u0027))"},{"line_number":53,"context_line":"]"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"cfg.CONF.register_opts(AGENTS_SCHEDULER_OPTS)"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_11ecdcc6","line":52,"in_reply_to":"fa81d914_6913af5c","updated":"2015-01-29 20:24:04.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":120,"context_line":"    def _agent_dead_limit_seconds(self):"},{"line_number":121,"context_line":"        return cfg.CONF.agent_down_time * 2"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"    def check_wait_down_agents(self, agent_type):"},{"line_number":124,"context_line":"        LOG.debug(\"Checking down %s agents\", agent_type)"},{"line_number":125,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":126,"context_line":"        agent_dead_limit \u003d self._agent_dead_limit_seconds()"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_e8315d0c","line":123,"updated":"2015-01-28 18:26:44.000000000","message":"This is definitely improved, but I think some documentation is suggested - or a better method name - to make the intent of this method clear.","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":120,"context_line":"    def _agent_dead_limit_seconds(self):"},{"line_number":121,"context_line":"        return cfg.CONF.agent_down_time * 2"},{"line_number":122,"context_line":""},{"line_number":123,"context_line":"    def check_wait_down_agents(self, agent_type):"},{"line_number":124,"context_line":"        LOG.debug(\"Checking down %s agents\", agent_type)"},{"line_number":125,"context_line":"        # give agents extra time to handle transient failures"},{"line_number":126,"context_line":"        agent_dead_limit \u003d self._agent_dead_limit_seconds()"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_f5b91416","line":123,"in_reply_to":"fa81d914_e8315d0c","updated":"2015-01-29 20:24:04.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":127,"context_line":""},{"line_number":128,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":129,"context_line":"        # detected, sleep for a while to let the agents check in."},{"line_number":130,"context_line":"        tdelta \u003d timeutils.utcnow() - getattr(self, \u0027clock_jump_canary\u0027,"},{"line_number":131,"context_line":"                                              timeutils.utcnow())"},{"line_number":132,"context_line":"        if timeutils.total_seconds(tdelta) \u003e cfg.CONF.agent_down_time:"},{"line_number":133,"context_line":"            LOG.warn(_LW(\"Time since last %s agent reschedule check has \""}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_c3739a4b","line":130,"updated":"2015-01-28 18:26:44.000000000","message":"Ooops, clock_jump_canary -\u003e _clock_jump_canary\n\nI guess you started in on my suggestion to use a property and then backed out?","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":127,"context_line":""},{"line_number":128,"context_line":"        # check for an abrupt clock change since last check. if a change is"},{"line_number":129,"context_line":"        # detected, sleep for a while to let the agents check in."},{"line_number":130,"context_line":"        tdelta \u003d timeutils.utcnow() - getattr(self, \u0027clock_jump_canary\u0027,"},{"line_number":131,"context_line":"                                              timeutils.utcnow())"},{"line_number":132,"context_line":"        if timeutils.total_seconds(tdelta) \u003e cfg.CONF.agent_down_time:"},{"line_number":133,"context_line":"            LOG.warn(_LW(\"Time since last %s agent reschedule check has \""}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_31dc80e4","line":130,"in_reply_to":"fa81d914_c3739a4b","updated":"2015-01-29 20:24:04.000000000","message":"True :)\n\nSorry for these silly mistakes through the revisions.\nI just have to use jenkins to run UT job from time to time, because tox doesn\u0027t work locally for me.","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":136,"context_line":"                         \"in case there was a clock adjustment.\"), agent_type)"},{"line_number":137,"context_line":"            time.sleep(agent_dead_limit)"},{"line_number":138,"context_line":"        self._clock_jump_canary \u003d timeutils.utcnow()"},{"line_number":139,"context_line":"        return agent_dead_limit"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"    def get_cutoff_time(self, agent_dead_limit):"},{"line_number":142,"context_line":"        cutoff \u003d timeutils.utcnow() - datetime.timedelta("}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_a3906696","line":139,"updated":"2015-01-28 18:26:44.000000000","message":"It seems pretty arbitrary to return this here.  Consider accepting agent_dead_limit as an argument instead and require the client to pass it in.","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":136,"context_line":"                         \"in case there was a clock adjustment.\"), agent_type)"},{"line_number":137,"context_line":"            time.sleep(agent_dead_limit)"},{"line_number":138,"context_line":"        self._clock_jump_canary \u003d timeutils.utcnow()"},{"line_number":139,"context_line":"        return agent_dead_limit"},{"line_number":140,"context_line":""},{"line_number":141,"context_line":"    def get_cutoff_time(self, agent_dead_limit):"},{"line_number":142,"context_line":"        cutoff \u003d timeutils.utcnow() - datetime.timedelta("}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_11177c52","line":139,"in_reply_to":"fa81d914_a3906696","updated":"2015-01-29 20:24:04.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":165,"context_line":""},{"line_number":166,"context_line":"        Method returns True if agent is in its \u0027starting up\u0027 period."},{"line_number":167,"context_line":"        Return value depends on amount of networks assigned to the agent."},{"line_number":168,"context_line":"        It doesn\u0027t look at latest heartbit timestamp as it is assumed"},{"line_number":169,"context_line":"        that this method is called for agents that are considered dead."},{"line_number":170,"context_line":"        \"\"\""},{"line_number":171,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_a3bea6fd","line":168,"updated":"2015-01-28 18:26:44.000000000","message":"heartbit -\u003e hearbeat","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":165,"context_line":""},{"line_number":166,"context_line":"        Method returns True if agent is in its \u0027starting up\u0027 period."},{"line_number":167,"context_line":"        Return value depends on amount of networks assigned to the agent."},{"line_number":168,"context_line":"        It doesn\u0027t look at latest heartbit timestamp as it is assumed"},{"line_number":169,"context_line":"        that this method is called for agents that are considered dead."},{"line_number":170,"context_line":"        \"\"\""},{"line_number":171,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_63046bc0","line":168,"in_reply_to":"fa81d914_a3bea6fd","updated":"2015-01-29 20:24:04.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                         filter_by(dhcp_agent_id\u003dagent[\u0027id\u0027]).count())"},{"line_number":176,"context_line":"        # amount of networks assigned to agent affect amount of time we give"},{"line_number":177,"context_line":"        # it so startup (2 sec per network)"},{"line_number":178,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * network_count)"},{"line_number":179,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","},{"line_number":180,"context_line":"                  additional_time)"},{"line_number":181,"context_line":"        return (agent[\u0027started_at\u0027] + agent_dead_limit +"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_2310f600","line":178,"updated":"2015-01-28 18:26:44.000000000","message":"2s per network seems entirely arbitrary.  Why was this value chosen?  Maybe use a named constant for the value rather than a magic \u00272\u0027?","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":175,"context_line":"                         filter_by(dhcp_agent_id\u003dagent[\u0027id\u0027]).count())"},{"line_number":176,"context_line":"        # amount of networks assigned to agent affect amount of time we give"},{"line_number":177,"context_line":"        # it so startup (2 sec per network)"},{"line_number":178,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * network_count)"},{"line_number":179,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","},{"line_number":180,"context_line":"                  additional_time)"},{"line_number":181,"context_line":"        return (agent[\u0027started_at\u0027] + agent_dead_limit +"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_a3bbc3e3","line":178,"in_reply_to":"fa81d914_2310f600","updated":"2015-01-29 20:24:04.000000000","message":"For sure this is empirical number. I\u0027ve taken it from my observations on DHCP agent. It usually processes a network faster than in 2 seconds, but I\u0027m giving it extra time just in case.\n\nI think I\u0027ll try to explain it in the comment rather then use named constant just for a single place.","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":178,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * network_count)"},{"line_number":179,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","},{"line_number":180,"context_line":"                  additional_time)"},{"line_number":181,"context_line":"        return (agent[\u0027started_at\u0027] + agent_dead_limit +"},{"line_number":182,"context_line":"                additional_time \u003e timeutils.utcnow())"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _schedule_network(self, context, network_id, dhcp_notifier):"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_83d8c2f0","line":181,"updated":"2015-01-28 18:26:44.000000000","message":"Consider simplifying this statement as follows:\n\nagent_expected_up \u003d agent[\u0027started_at\u0027] + agent_dead_limit + additional_time\nreturn agent_expected_up \u003e timeutils.utcnow()\n\nI still think the determination of when the agent should be expected up is too arbitrary.  :/","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":178,"context_line":"        additional_time \u003d datetime.timedelta(seconds\u003d2 * network_count)"},{"line_number":179,"context_line":"        LOG.debug(\"Checking if agent starts up and giving it additional %s\","},{"line_number":180,"context_line":"                  additional_time)"},{"line_number":181,"context_line":"        return (agent[\u0027started_at\u0027] + agent_dead_limit +"},{"line_number":182,"context_line":"                additional_time \u003e timeutils.utcnow())"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"    def _schedule_network(self, context, network_id, dhcp_notifier):"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_c3e197d1","line":181,"in_reply_to":"fa81d914_83d8c2f0","updated":"2015-01-29 20:24:04.000000000","message":"I think it\u0027s better to be safe with giving an agent additional time. Without it rescheduling can be a thin ice and make things worse.\n\nI also guess that similar issue exists for L3 rescheduling, we just didn\u0027t test it with enough load of routers and small enough \u0027agent_dead_limit\u0027 numbers.","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                             \"already scheduled by another server\"),"},{"line_number":195,"context_line":"                         network_id)"},{"line_number":196,"context_line":"                return"},{"line_number":197,"context_line":"            for agent in agents:"},{"line_number":198,"context_line":"                if dhcp_notifier:"},{"line_number":199,"context_line":"                    LOG.info(_LI(\"Adding network %(net)s to agent \""},{"line_number":200,"context_line":"                                 \"%(agent)%s on host %(host)s\"),"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_23a0f642","line":197,"updated":"2015-01-28 18:26:44.000000000","message":"(No action required) Consider simplifying (less nesting ftw):\n\nif not dhcp_notifier:\n return\nfor agent in agents:\n ...","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":194,"context_line":"                             \"already scheduled by another server\"),"},{"line_number":195,"context_line":"                         network_id)"},{"line_number":196,"context_line":"                return"},{"line_number":197,"context_line":"            for agent in agents:"},{"line_number":198,"context_line":"                if dhcp_notifier:"},{"line_number":199,"context_line":"                    LOG.info(_LI(\"Adding network %(net)s to agent \""},{"line_number":200,"context_line":"                                 \"%(agent)%s on host %(host)s\"),"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_e3369b51","line":197,"in_reply_to":"fa81d914_23a0f642","updated":"2015-01-29 20:24:04.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":210,"context_line":"            LOG.exception(_LE(\"Failed to schedule network %s\"), network_id)"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"    def _filter_bindings(self, context, bindings):"},{"line_number":213,"context_line":"        \"\"\"Skip bindings which agent is dead, but starting up.\"\"\""},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        # to save few db calls: store already checked agents in dict"},{"line_number":216,"context_line":"        # id -\u003e is_agent_starting_up"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_23b71688","line":213,"updated":"2015-01-28 18:26:44.000000000","message":"which -\u003e for which the","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":210,"context_line":"            LOG.exception(_LE(\"Failed to schedule network %s\"), network_id)"},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"    def _filter_bindings(self, context, bindings):"},{"line_number":213,"context_line":"        \"\"\"Skip bindings which agent is dead, but starting up.\"\"\""},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"        # to save few db calls: store already checked agents in dict"},{"line_number":216,"context_line":"        # id -\u003e is_agent_starting_up"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_a32ca303","line":213,"in_reply_to":"fa81d914_23b71688","updated":"2015-01-29 20:24:04.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":221,"context_line":"                if self._agent_starting_up(context, binding.dhcp_agent):"},{"line_number":222,"context_line":"                    # When agent starts and it has many networks to process"},{"line_number":223,"context_line":"                    # it may fail to send state reports in defined interval"},{"line_number":224,"context_line":"                    # and server will consider it dead, trying to remove"},{"line_number":225,"context_line":"                    # networks from it."},{"line_number":226,"context_line":"                    checked_agents[agent_id] \u003d True"},{"line_number":227,"context_line":"                    LOG.debug(\"Agent %s is starting up. Skipping\", agent_id)"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_434a4a81","line":224,"updated":"2015-01-28 18:26:44.000000000","message":"server -\u003e the server\n\ndead, trying -\u003e dead and try\n\nNot sure if this is actually your intent, though.","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":221,"context_line":"                if self._agent_starting_up(context, binding.dhcp_agent):"},{"line_number":222,"context_line":"                    # When agent starts and it has many networks to process"},{"line_number":223,"context_line":"                    # it may fail to send state reports in defined interval"},{"line_number":224,"context_line":"                    # and server will consider it dead, trying to remove"},{"line_number":225,"context_line":"                    # networks from it."},{"line_number":226,"context_line":"                    checked_agents[agent_id] \u003d True"},{"line_number":227,"context_line":"                    LOG.debug(\"Agent %s is starting up. Skipping\", agent_id)"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_0311efab","line":224,"in_reply_to":"fa81d914_434a4a81","updated":"2015-01-29 20:24:04.000000000","message":"yes, it was","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":227,"context_line":"                    LOG.debug(\"Agent %s is starting up. Skipping\", agent_id)"},{"line_number":228,"context_line":"                else:"},{"line_number":229,"context_line":"                    checked_agents[agent_id] \u003d False"},{"line_number":230,"context_line":"            if checked_agents[agent_id]:"},{"line_number":231,"context_line":"                continue"},{"line_number":232,"context_line":"            yield binding"},{"line_number":233,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_c8e2d99e","line":230,"updated":"2015-01-28 18:26:44.000000000","message":"Simplify:\n\nif not checked_agents[agent_id]:\n yield binding","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"383ae19a68c62776feceddb7713fe8d567b0f001","unresolved":false,"context_lines":[{"line_number":227,"context_line":"                    LOG.debug(\"Agent %s is starting up. Skipping\", agent_id)"},{"line_number":228,"context_line":"                else:"},{"line_number":229,"context_line":"                    checked_agents[agent_id] \u003d False"},{"line_number":230,"context_line":"            if checked_agents[agent_id]:"},{"line_number":231,"context_line":"                continue"},{"line_number":232,"context_line":"            yield binding"},{"line_number":233,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_6321cbfa","line":230,"in_reply_to":"fa81d914_c8e2d99e","updated":"2015-01-29 20:24:04.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":259,"context_line":"                self.remove_network_from_dhcp_agent(context,"},{"line_number":260,"context_line":"                                                    binding.dhcp_agent_id,"},{"line_number":261,"context_line":"                                                    binding.network_id)"},{"line_number":262,"context_line":"            except dhcpagentscheduler.NetworkNotHostedByDhcpAgent:"},{"line_number":263,"context_line":"                # measures against concurrent operation"},{"line_number":264,"context_line":"                LOG.debug(\"Network %(net)s already removed from DHCP agent \""},{"line_number":265,"context_line":"                          \"%s(agent)\","}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_28a0d542","line":262,"updated":"2015-01-28 18:26:44.000000000","message":"Much cleaner error handling, thank you.\n\n(No action required) I think we should hold module names to the same standards as variable names (should be underscore separated imho).","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"}],"neutron/db/l3_agentschedulers_db.py":[{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"bf4f16ca33098289e11fac9fb586b714f39e9a60","unresolved":false,"context_lines":[{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    router_scheduler \u003d None"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":77,"context_line":"        if not cfg.CONF.allow_automatic_l3agent_failover:"},{"line_number":78,"context_line":"            LOG.info(_LI(\"Skipping period L3 agent status check because \""},{"line_number":79,"context_line":"                         \"automatic router rescheduling is disabled.\"))"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a961159_9bba45df","line":76,"updated":"2015-01-16 13:47:46.000000000","message":"Per my comment in dhcp-agent-scheduler, it is better to rename this method to avoid potential conflict of method name.","commit_id":"73e732bcbc90f9d06c6b6bce10e5796f3e463ec6"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"fcb4345031ab08ec619ea8175294b4d21b8b2b00","unresolved":false,"context_lines":[{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    router_scheduler \u003d None"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def start_periodic_agent_status_check(self):"},{"line_number":77,"context_line":"        if not cfg.CONF.allow_automatic_l3agent_failover:"},{"line_number":78,"context_line":"            LOG.info(_LI(\"Skipping period L3 agent status check because \""},{"line_number":79,"context_line":"                         \"automatic router rescheduling is disabled.\"))"}],"source_content_type":"text/x-python","patch_set":21,"id":"3a961159_fb98a96a","line":76,"in_reply_to":"3a961159_9bba45df","updated":"2015-01-16 14:40:28.000000000","message":"Done","commit_id":"73e732bcbc90f9d06c6b6bce10e5796f3e463ec6"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9e9e90519a55937f8cacfab013e093536bef5e4","unresolved":false,"context_lines":[{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def reschedule_routers_from_down_agents(self):"},{"line_number":86,"context_line":"        \"\"\"Reschedule routers from down l3 agents if admin state is up.\"\"\""},{"line_number":87,"context_line":"        cutoff, agent_dead_limit \u003d self.check_wait_down_agents()"},{"line_number":88,"context_line":""},{"line_number":89,"context_line":"        context \u003d n_ctx.get_admin_context()"},{"line_number":90,"context_line":"        down_bindings \u003d ("}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_c5887473","line":87,"updated":"2015-01-27 07:46:27.000000000","message":"Good reuse of common code. Thanks.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"6a49141cb68d4719ab1a04a315f0c43becc99af9","unresolved":false,"context_lines":[{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    router_scheduler \u003d None"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def start_periodic_l3_agent_status_check(self):"},{"line_number":77,"context_line":"        if not cfg.CONF.allow_automatic_l3agent_failover:"},{"line_number":78,"context_line":"            LOG.info(_LI(\"Skipping period L3 agent status check because \""},{"line_number":79,"context_line":"                         \"automatic router rescheduling is disabled.\"))"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_3e1da174","line":76,"updated":"2015-01-27 20:32:34.000000000","message":"nit: I don\u0027t think we really need to add l3_  (this file is already named l3_agentschedulers) here but okay.","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"bdb2918ee7df21bed2be89103e904caeb40fefb2","unresolved":false,"context_lines":[{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    router_scheduler \u003d None"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def start_periodic_l3_agent_status_check(self):"},{"line_number":77,"context_line":"        if not cfg.CONF.allow_automatic_l3agent_failover:"},{"line_number":78,"context_line":"            LOG.info(_LI(\"Skipping period L3 agent status check because \""},{"line_number":79,"context_line":"                         \"automatic router rescheduling is disabled.\"))"}],"source_content_type":"text/x-python","patch_set":26,"id":"fa81d914_bab6ddda","line":76,"in_reply_to":"fa81d914_3e1da174","updated":"2015-01-28 12:19:29.000000000","message":"that was really needed to avoid theoretic collision in case of monolithic plugin supporting both l3 and dhcp agent scheduling","commit_id":"44907ca542ef1af71aad4ebc467a055cf65b5c56"}],"neutron/plugins/bigswitch/plugin.py":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"61d5cd04892148f498e87c717e596cd3a69af1af","unresolved":false,"context_lines":[{"line_number":502,"context_line":"        if cfg.CONF.RESTPROXY.sync_data:"},{"line_number":503,"context_line":"            self._send_all_data()"},{"line_number":504,"context_line":""},{"line_number":505,"context_line":"        self.start_periodic_agent_status_check()"},{"line_number":506,"context_line":"        LOG.debug(_(\"NeutronRestProxyV2: initialization done\"))"},{"line_number":507,"context_line":""},{"line_number":508,"context_line":"    def _setup_rpc(self):"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_09ab18d9","line":505,"updated":"2014-11-11 12:39:50.000000000","message":"in this context it\u0027s not clear which agent, maybe rename to start_periodic_dhcp_agent_status_check?","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9686d351ccccaf6fb78e9d932394751d2c01c18b","unresolved":false,"context_lines":[{"line_number":502,"context_line":"        if cfg.CONF.RESTPROXY.sync_data:"},{"line_number":503,"context_line":"            self._send_all_data()"},{"line_number":504,"context_line":""},{"line_number":505,"context_line":"        self.start_periodic_agent_status_check()"},{"line_number":506,"context_line":"        LOG.debug(_(\"NeutronRestProxyV2: initialization done\"))"},{"line_number":507,"context_line":""},{"line_number":508,"context_line":"    def _setup_rpc(self):"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_e40fd3df","line":505,"in_reply_to":"5a890539_09ab18d9","updated":"2014-11-11 13:23:26.000000000","message":"Done","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"}],"neutron/plugins/ml2/plugin.py":[{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"42ba85f51088961c9b720ee7c95956d92a46502d","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        )"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"        LOG.info(_(\"Modular L2 Plugin initialization complete\"))"},{"line_number":137,"context_line":"        self.start_periodic_agent_status_check()"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def _setup_rpc(self):"},{"line_number":140,"context_line":"        self.notifier \u003d rpc.AgentNotifierApi(topics.AGENT)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_e5701542","line":137,"updated":"2014-10-27 14:46:18.000000000","message":"I wonder if we should put this somewhere else so that it works for all plugins or perhaps add it to all the plugins if there isn\u0027t a good common place we can put this.","commit_id":"5cd74fba0e0d059942963bcb1cc5cc3e09b62909"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"ca66fbbbcf243d4b258ff98da76ba25bf54ad981","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        )"},{"line_number":135,"context_line":""},{"line_number":136,"context_line":"        LOG.info(_(\"Modular L2 Plugin initialization complete\"))"},{"line_number":137,"context_line":"        self.start_periodic_agent_status_check()"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def _setup_rpc(self):"},{"line_number":140,"context_line":"        self.notifier \u003d rpc.AgentNotifierApi(topics.AGENT)"}],"source_content_type":"text/x-python","patch_set":2,"id":"9aa7fdbe_45e8017c","line":137,"in_reply_to":"9aa7fdbe_e5701542","updated":"2014-10-27 14:50:25.000000000","message":"yeah, was thinking of this as well.\nI guess I\u0027ll just add this to each of the plugins.","commit_id":"5cd74fba0e0d059942963bcb1cc5cc3e09b62909"}],"neutron/tests/unit/brocade/test_brocade_plugin.py":[{"author":{"_account_id":10237,"name":"Numan Siddique","email":"nusiddiq@redhat.com","username":"numansiddique"},"change_message_id":"0b3e51c0a92d23170cf9b937e109611da5a0b0a2","unresolved":false,"context_lines":[{"line_number":52,"context_line":"        self.dhcp_periodic_p \u003d mock.patch(\u0027neutron.db.agentschedulers_db.\u0027"},{"line_number":53,"context_line":"                                          \u0027DhcpAgentSchedulerDbMixin.\u0027"},{"line_number":54,"context_line":"                                          \u0027start_periodic_agent_status_check\u0027)"},{"line_number":55,"context_line":"        self.patched_dhcp_periodic \u003d self.dhcp_periodic_p.start()"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"class TestBrocadeBasicGet(test_plugin.TestBasicGet,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a961159_24c2d834","line":55,"updated":"2014-12-26 09:44:42.000000000","message":"Suggestion: Is it possible to add the above 2 lines to the base class \u0027test_plugin.NeutronDbPluginV2TestCase\u0027 ?  since most of the plugin test files derive from this.","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9fe8c49d534252d82e32e0d96cf46ae4ef6ab2ed","unresolved":false,"context_lines":[{"line_number":52,"context_line":"        self.dhcp_periodic_p \u003d mock.patch(\u0027neutron.db.agentschedulers_db.\u0027"},{"line_number":53,"context_line":"                                          \u0027DhcpAgentSchedulerDbMixin.\u0027"},{"line_number":54,"context_line":"                                          \u0027start_periodic_agent_status_check\u0027)"},{"line_number":55,"context_line":"        self.patched_dhcp_periodic \u003d self.dhcp_periodic_p.start()"},{"line_number":56,"context_line":""},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"class TestBrocadeBasicGet(test_plugin.TestBasicGet,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a961159_733c79c0","line":55,"in_reply_to":"3a961159_24c2d834","updated":"2014-12-30 14:11:33.000000000","message":"Done","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"}],"neutron/tests/unit/test_dhcp_scheduler.py":[{"author":{"_account_id":10370,"name":"Romil Gupta","email":"romilgupta19@gmail.com","username":"romilg"},"change_message_id":"c6aab1cbf796658d31039106722cac6597e86f31","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        update \u003d {"},{"line_number":135,"context_line":"            \u0027agent\u0027: {"},{"line_number":136,"context_line":"                \u0027heartbeat_timestamp\u0027:"},{"line_number":137,"context_line":"                timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}"},{"line_number":138,"context_line":"        self.update_agent(self.ctx, agent.id, update)"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    def test_remove_networks_from_down_agents(self):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a8c0949_6b3bd6eb","line":137,"updated":"2014-10-30 09:20:24.000000000","message":"Sorry, I think this will look better:\n        update \u003d {\u0027agent\u0027: {\u0027heartbeat_timestamp\u0027:\n                            timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}","commit_id":"658c0f05dbb8499b0014df7adeab4d1bdad9a90c"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"59819be2a31dfd412a052550fb469a75cba70c57","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        update \u003d {"},{"line_number":135,"context_line":"            \u0027agent\u0027: {"},{"line_number":136,"context_line":"                \u0027heartbeat_timestamp\u0027:"},{"line_number":137,"context_line":"                timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}"},{"line_number":138,"context_line":"        self.update_agent(self.ctx, agent.id, update)"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    def test_remove_networks_from_down_agents(self):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a8c0949_ae25cc0b","line":137,"in_reply_to":"7a8c0949_6b3bd6eb","updated":"2014-10-30 09:49:33.000000000","message":"Done","commit_id":"658c0f05dbb8499b0014df7adeab4d1bdad9a90c"},{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"61d5cd04892148f498e87c717e596cd3a69af1af","unresolved":false,"context_lines":[{"line_number":148,"context_line":"            mock.patch.object(self, \u0027schedule_network\u0027)"},{"line_number":149,"context_line":"        ) as (rn, sch):"},{"line_number":150,"context_line":"            self.remove_networks_from_down_agents()"},{"line_number":151,"context_line":"            self.assertTrue(rn.called)"},{"line_number":152,"context_line":"            self.assertTrue(sch.called)"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_49f600d9","line":151,"updated":"2014-11-11 12:39:50.000000000","message":"this is not testing functions logic but only that they were called. I guess that might be testet in scope of l3 rescheduling patch, that\u0027s why I\u0027d think more about refactoring common parts in one place","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"9686d351ccccaf6fb78e9d932394751d2c01c18b","unresolved":false,"context_lines":[{"line_number":148,"context_line":"            mock.patch.object(self, \u0027schedule_network\u0027)"},{"line_number":149,"context_line":"        ) as (rn, sch):"},{"line_number":150,"context_line":"            self.remove_networks_from_down_agents()"},{"line_number":151,"context_line":"            self.assertTrue(rn.called)"},{"line_number":152,"context_line":"            self.assertTrue(sch.called)"}],"source_content_type":"text/x-python","patch_set":11,"id":"5a890539_04e3ff07","line":151,"in_reply_to":"5a890539_49f600d9","updated":"2014-11-11 13:23:26.000000000","message":"right, the function\u0027s logic is not tested because it\u0027s not a goal of this test, which tests remove_networks_from_down_agents method (not \u0027remove_network_from_down_agents\u0027)","commit_id":"76dd80228c6e3f9f4f698f0969a4073e07575fd3"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"1e48ba96706b964074ad9b62117e1725fdf62161","unresolved":false,"context_lines":[{"line_number":134,"context_line":"        update \u003d {\u0027agent\u0027: {\u0027heartbeat_timestamp\u0027:"},{"line_number":135,"context_line":"                            timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}"},{"line_number":136,"context_line":"        self.update_agent(self.ctx, agent.id, update)"},{"line_number":137,"context_line":""},{"line_number":138,"context_line":"    def test_remove_networks_from_down_agents(self):"},{"line_number":139,"context_line":"        plugin \u003d mock.MagicMock()"},{"line_number":140,"context_line":"        plugin.get_subnets.return_value \u003d [{\"network_id\": self.network_id,"}],"source_content_type":"text/x-python","patch_set":14,"id":"5a890539_93671725","line":137,"updated":"2014-11-12 13:46:02.000000000","message":"What about testing that all (IE: Multiple) networks are removed from a dead agent. What about testing that networks are removed only from dead agents? What about testing that networks are rescheduled only if the auto_schedule option is turned on?","commit_id":"73dd15a7f0b444e9e7a49c58c44fa4955d0918fd"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"576736915757f904e7fed7d754f321dfcd0c1265","unresolved":false,"context_lines":[{"line_number":135,"context_line":"        update \u003d {\u0027agent\u0027: {\u0027heartbeat_timestamp\u0027:"},{"line_number":136,"context_line":"                            timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}"},{"line_number":137,"context_line":"        self.update_agent(self.ctx, agent.id, update)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def test_remove_networks_from_down_agents(self):"},{"line_number":140,"context_line":"        plugin \u003d mock.MagicMock()"},{"line_number":141,"context_line":"        plugin.get_subnets.return_value \u003d [{\"network_id\": self.network_id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a961159_a2593c5d","line":138,"updated":"2014-12-29 20:25:44.000000000","message":"I don\u0027t think that you should be mocking anything in this test, for these reasons:\n\n1) We have tests for the functions that remove_networks_from_down_agents uses internally, so we should be testing this unit by making sure that the logic is sound, and that the usage of all of these functions together works to create the desired behavior. We\u0027ve already tested the bottom layer, now let\u0027s test it one step higher. Essentially, like many other tests in the \u0027unit\u0027 subfolder, I\u0027m suggesting a test that\u0027s one step up the ladder. Integration test, functional test, call it whatever you want.\n\n1.5) Typically you *need* to mock stuff that interacts with the system, network, or whatever. Here, there\u0027s no need to do that, assuming that we\u0027re comfortable with interacting with an in-memory DB while testing at this level (Which we should be if you agree with point 1).\n\n2) These types of tests are exactly the tests you have to constantly change whenever you want to change the implementation of the unit in question. Keeping point 1 in mind, we should test the function by giving it input and asserting the desired output. Bind a network to an agent, kill it, run the function, and assert that the network is now hosted by another agent. You shouldn\u0027t care what methods you use internally or how the unit is implemented, it should be about its input and output.\n\n3) There\u0027s a million (Give or take) books, blog posts and whatnot about \u0027Test behavior, not implementation.\u0027 In unit tests it\u0027s more than fine to mock the class\u0027 interaction with other classes and external dependencies, but why mock internal methods, that do not act as boundaries to anything external?\n\nAssuming that the code in question is already tested at a lower level (IE: We have existing tests for the methods it uses internally) I\u0027d really like us to move away from the kind of testing that\u0027s being proposed, when ever possible, which I think that in this case it definitely is.\n\nI\u0027d love to find partners on this general idea. What do you think Eugene?","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"9ff3d41d169ce1b54d823866665b12adcb2487b6","unresolved":false,"context_lines":[{"line_number":135,"context_line":"        update \u003d {\u0027agent\u0027: {\u0027heartbeat_timestamp\u0027:"},{"line_number":136,"context_line":"                            timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}"},{"line_number":137,"context_line":"        self.update_agent(self.ctx, agent.id, update)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def test_remove_networks_from_down_agents(self):"},{"line_number":140,"context_line":"        plugin \u003d mock.MagicMock()"},{"line_number":141,"context_line":"        plugin.get_subnets.return_value \u003d [{\"network_id\": self.network_id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a961159_87ee8a89","line":138,"in_reply_to":"3a961159_659d6557","updated":"2015-01-07 08:52:31.000000000","message":"This conversation reminds me that we should eventually write a testing document, agreeing on how to test things. Otherwise every piece is tested in a different way.\n\nI believe Assaf is not telling in 1.5 to check system output or calls, but just to mock them to avoid them from happening, and then checking the DB state.","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"c7ade977a568ae56c22272dca550f0ae3885fffa","unresolved":false,"context_lines":[{"line_number":135,"context_line":"        update \u003d {\u0027agent\u0027: {\u0027heartbeat_timestamp\u0027:"},{"line_number":136,"context_line":"                            timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}"},{"line_number":137,"context_line":"        self.update_agent(self.ctx, agent.id, update)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def test_remove_networks_from_down_agents(self):"},{"line_number":140,"context_line":"        plugin \u003d mock.MagicMock()"},{"line_number":141,"context_line":"        plugin.get_subnets.return_value \u003d [{\"network_id\": self.network_id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a930d6b_c84fb332","line":138,"in_reply_to":"3a961159_6f05f4c0","updated":"2015-01-27 01:11:53.000000000","message":"As per my comment on the most recent patchset, mocking should be used sparingly if at all.  Probably the only justification here would be checking that a given codepath was called, but validating the arguments or multiple statements in a given function is pointless.   That would be duplicating implementation logic and should be avoided.","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"60691443bf1b2826d1912657d76b027109ed5148","unresolved":false,"context_lines":[{"line_number":135,"context_line":"        update \u003d {\u0027agent\u0027: {\u0027heartbeat_timestamp\u0027:"},{"line_number":136,"context_line":"                            timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}"},{"line_number":137,"context_line":"        self.update_agent(self.ctx, agent.id, update)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def test_remove_networks_from_down_agents(self):"},{"line_number":140,"context_line":"        plugin \u003d mock.MagicMock()"},{"line_number":141,"context_line":"        plugin.get_subnets.return_value \u003d [{\"network_id\": self.network_id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a961159_6f05f4c0","line":138,"in_reply_to":"3a961159_87ee8a89","updated":"2015-01-07 10:34:52.000000000","message":"@Eugene: I think that a lot of the tests that we write in tests/unit are clearly not unit tests. Personally I\u0027ll be perfectly honest I don\u0027t care *too* much about each test living in its appropriate folder. Ideally we would have unit tests for the bottom layer, and another form of testing that would use these different units without mocking (IE: Only mock external dependencies). A lot of the current server side tests do this. Create a router, and see that when you list routers, it\u0027s there, just as an example. It\u0027s very high level and is done without mocking anything apart from RPC and that sort of stuff. It\u0027s a simple/dumb example, but I think that there\u0027s a lot of value in these sort of tests, even though they\u0027re not unit tests. In that sort of test, there\u0027s no need to mock any of the DB interactions, return values, or whatever, so no mocks should be used, assuming that you tested the lower level DB units first.\n\nAbout asserting implementation via mock heavy tests, I think that\u0027s somewhere we just won\u0027t agree on, and I think that both of us could happily live our lives regardless, which brings me to my next point:\n\n@Miguel: Maru has committed to writing such a document. Testing methodologies is almost a philosophical issue, and I\u0027m sure that everyone will defend their views fanatically when Maru submits his in-tree devref document, but we as a community should eventually decide what sort of change demands what sort of test, and what sort of tests (On all levels, be it unit, functional or otherwise) do we like and dislike.","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"0c9669d0989841802cd9dd05d4d95f966ca31297","unresolved":false,"context_lines":[{"line_number":135,"context_line":"        update \u003d {\u0027agent\u0027: {\u0027heartbeat_timestamp\u0027:"},{"line_number":136,"context_line":"                            timeutils.utcnow() - datetime.timedelta(hours\u003d1)}}"},{"line_number":137,"context_line":"        self.update_agent(self.ctx, agent.id, update)"},{"line_number":138,"context_line":""},{"line_number":139,"context_line":"    def test_remove_networks_from_down_agents(self):"},{"line_number":140,"context_line":"        plugin \u003d mock.MagicMock()"},{"line_number":141,"context_line":"        plugin.get_subnets.return_value \u003d [{\"network_id\": self.network_id,"}],"source_content_type":"text/x-python","patch_set":19,"id":"3a961159_659d6557","line":138,"in_reply_to":"3a961159_a2593c5d","updated":"2015-01-04 09:33:07.000000000","message":"I dare to say I don\u0027t agree in general :)\n\nAs I stated in some comment on other review, unit test is a white box test. E.g. it can and in most cases, _should_ assert implementation.\nIf you change implementation and doesn\u0027t change the unit test (e.g. it doesn\u0027t break) - that\u0027s a bad sign, such ut _may be_ just useless (speaking about (2)).\n\nThat\u0027s unlike integration test that should not break with changing implementation.\n\nSo, going back to points (1) and (1.5) my opinion is: if the bottom layer is tested, you don\u0027t need to test composition of bottom layer function\u0027s output.\nYou may though, but you don\u0027t have to.\nPrimary reason for this is that amount of checks for composition grows exponentially as we go testing methods up the calling stack.\nSo, it\u0027s enough to mock what is already tested and check that those pieces are called as expected under different conditions.\n\nWe may use/check actual \"bottom layer\" methods and their output _if_ it is convenient enough. But if it requires much more code then mocking then there\u0027s no reason to do that.\n\nI think whole \"Test behavior, not implementation\" is a generalization not quite applicable to unit tests.\nUTs are for development and especially important for interpreted languages.\nTheir prime goal is not a quality assurance but rather just to make sure that code is written without syntax or logical errors (in other words, primary goal is that UT makes sure author has typed the code that he intended to write)\nUT make catch simple bugs of course, and we need to try to come up with meaningful test cases, which still should be quite simple.\nIf it\u0027s not so - means that test just doesn\u0027t belong to tests/unit/ directory.","commit_id":"8d9e4b926d5578dab797e9b5d57aab061d356c42"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":194,"context_line":"        self.assertEqual(expected_hosted_agents, len(hosted_agents))"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":""},{"line_number":197,"context_line":"class TestNetworksFailover(TestDhcpSchedulerBaseTestCase,"},{"line_number":198,"context_line":"                           agentschedulers_db.DhcpAgentSchedulerDbMixin):"},{"line_number":199,"context_line":"    def test_reschedule_network_from_down_agent(self):"},{"line_number":200,"context_line":"        plugin \u003d mock.MagicMock()"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_28575703","line":197,"updated":"2015-01-27 01:12:46.000000000","message":"So much mocking!  Instead, I would like to see more targeted unit testing with a minimum of mocking - with refactoring for testability where required - and a functional test that validates actual failover behavior.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"00c7e8518f74eb6fd08ce7b2a1d911c2b29f4c35","unresolved":false,"context_lines":[{"line_number":214,"context_line":"            notifier \u003d mock.MagicMock()"},{"line_number":215,"context_line":"            self.agent_notifiers[constants.AGENT_TYPE_DHCP] \u003d notifier"},{"line_number":216,"context_line":"            self.remove_networks_from_down_agents()"},{"line_number":217,"context_line":"            rn.assert_called_with(mock.ANY, agents[0].id, self.network_id)"},{"line_number":218,"context_line":"            sch.assert_called_with(mock.ANY, {\u0027id\u0027: self.network_id})"},{"line_number":219,"context_line":"            notifier.network_added_to_agent.assert_called_with("},{"line_number":220,"context_line":"                mock.ANY, self.network_id, agents[1].host)"}],"source_content_type":"text/x-python","patch_set":24,"id":"1a930d6b_c845f343","line":217,"updated":"2015-01-27 01:12:46.000000000","message":"Mocking to determine that a function was called is one thing, but doing this kind of signature validation couples the testing too closely to the implementation so as to increase the maintenance burden unnecessarily.","commit_id":"9e4f62d64c6c1e8c73f5a989fe2e4a9946ce6612"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"4b851ee8428919af1e09fc33bf994f64d00724ab","unresolved":false,"context_lines":[{"line_number":254,"context_line":"                               side_effect\u003d[True, False]) as f:"},{"line_number":255,"context_line":"            res \u003d [b for b in self._filter_bindings(None, bindings)]"},{"line_number":256,"context_line":"            # once per each agent id1 and id2"},{"line_number":257,"context_line":"            self.assertEqual(2, f.call_count)"},{"line_number":258,"context_line":"            self.assertEqual(2, len(res))"},{"line_number":259,"context_line":"            res_ids \u003d [b.network_id for b in res]"},{"line_number":260,"context_line":"            self.assertIn(\u0027foo3\u0027, res_ids)"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_e9dddf15","line":257,"updated":"2015-01-28 18:26:44.000000000","message":"Please remove this check, validation of the result should be sufficient.","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"5e72170755c58c9373e92016205fcd144a5f7e88","unresolved":false,"context_lines":[{"line_number":254,"context_line":"                               side_effect\u003d[True, False]) as f:"},{"line_number":255,"context_line":"            res \u003d [b for b in self._filter_bindings(None, bindings)]"},{"line_number":256,"context_line":"            # once per each agent id1 and id2"},{"line_number":257,"context_line":"            self.assertEqual(2, f.call_count)"},{"line_number":258,"context_line":"            self.assertEqual(2, len(res))"},{"line_number":259,"context_line":"            res_ids \u003d [b.network_id for b in res]"},{"line_number":260,"context_line":"            self.assertIn(\u0027foo3\u0027, res_ids)"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa81d914_619c98c1","line":257,"in_reply_to":"fa81d914_e9dddf15","updated":"2015-01-28 22:33:14.000000000","message":"Done","commit_id":"d856b90907a4c9f45defca60785c96a12f265b69"}]}
