)]}'
{"neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"2252a14f601d4d7b3efd224efe4cc3e412c5ad3c","unresolved":false,"context_lines":[{"line_number":63,"context_line":"                plugin, constants.DHCP_AGENT_SCHEDULER_EXT_ALIAS)):"},{"line_number":64,"context_line":"            if method \u003d\u003d \u0027port_create_end\u0027:"},{"line_number":65,"context_line":"                # we don\u0027t schedule when we create network"},{"line_number":66,"context_line":"                # because we want to give admin a chance to"},{"line_number":67,"context_line":"                # schedule network manually by API"},{"line_number":68,"context_line":"                adminContext \u003d (context if context.is_admin else"},{"line_number":69,"context_line":"                                context.elevated())"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FKmM%3D","line":66,"updated":"2014-03-07 22:44:53.000000000","message":"if that\u0027s the case, then there\u0027s no need to execute lines 78-105","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"2252a14f601d4d7b3efd224efe4cc3e412c5ad3c","unresolved":false,"context_lines":[{"line_number":71,"context_line":"                chosen_agents \u003d plugin.schedule_network(adminContext, network)"},{"line_number":72,"context_line":"                if chosen_agents:"},{"line_number":73,"context_line":"                    for agent in chosen_agents:"},{"line_number":74,"context_line":"                        self._notification_host("},{"line_number":75,"context_line":"                            context, \u0027network_create_end\u0027,"},{"line_number":76,"context_line":"                            {\u0027network\u0027: {\u0027id\u0027: network_id}},"},{"line_number":77,"context_line":"                            agent[\u0027host\u0027])"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FKko%3D","line":74,"updated":"2014-03-07 22:44:53.000000000","message":"that\u0027s where the network_create_end event is sent to the dhcp agent, I see it now.","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"2252a14f601d4d7b3efd224efe4cc3e412c5ad3c","unresolved":false,"context_lines":[{"line_number":74,"context_line":"                        self._notification_host("},{"line_number":75,"context_line":"                            context, \u0027network_create_end\u0027,"},{"line_number":76,"context_line":"                            {\u0027network\u0027: {\u0027id\u0027: network_id}},"},{"line_number":77,"context_line":"                            agent[\u0027host\u0027])"},{"line_number":78,"context_line":"            agents \u003d self._get_enabled_dhcp_agents(context, network_id)"},{"line_number":79,"context_line":"            if not agents:"},{"line_number":80,"context_line":"                # NOTE(amotoki): When a network is created, dhcp-agent"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FKlU%3D","line":77,"updated":"2014-03-07 22:44:53.000000000","message":"at this point wouldn\u0027t we want to cast port_create_end and be done with it?","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"0fa46a5d6f5ef6a294eddd3b532aed744a9c0abd","unresolved":false,"context_lines":[{"line_number":74,"context_line":"                        self._notification_host("},{"line_number":75,"context_line":"                            context, \u0027network_create_end\u0027,"},{"line_number":76,"context_line":"                            {\u0027network\u0027: {\u0027id\u0027: network_id}},"},{"line_number":77,"context_line":"                            agent[\u0027host\u0027])"},{"line_number":78,"context_line":"            agents \u003d self._get_enabled_dhcp_agents(context, network_id)"},{"line_number":79,"context_line":"            if not agents:"},{"line_number":80,"context_line":"                # NOTE(amotoki): When a network is created, dhcp-agent"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FJdA%3D","line":77,"in_reply_to":"AAAAVn%2F%2FKlU%3D","updated":"2014-03-08 07:12:44.000000000","message":"I think it is better to check the number of assigned agents and enable_agents even when port_create_end. Unless no subnet is associated to the network or enable_dhcp is False, this is an error. If dhcp-agent is scheduled via API, chosen_agents is None but agents should be assigned to the network.\n\nOn the other hand, another db query can be avoided. Similar query is done in schedule(). It can done in dhcp-scheduler.","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"2252a14f601d4d7b3efd224efe4cc3e412c5ad3c","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                            agent[\u0027host\u0027])"},{"line_number":78,"context_line":"            agents \u003d self._get_enabled_dhcp_agents(context, network_id)"},{"line_number":79,"context_line":"            if not agents:"},{"line_number":80,"context_line":"                # NOTE(amotoki): When a network is created, dhcp-agent"},{"line_number":81,"context_line":"                # is not associated with the network. In most cases a"},{"line_number":82,"context_line":"                # subnet is created just after an associated network"},{"line_number":83,"context_line":"                # is created. For these cases, it is completely normal"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FKn4%3D","line":80,"updated":"2014-03-07 22:44:53.000000000","message":"okay...so if no dhcp agent is associated to a network on network creation (or in other words agents \u003d\u003d [] when method \u003d\u003d network_create_end), or not yet anyway (see like 74) why don\u0027t we just avoid the call to the DB?\n\nWhat I am suggesting here is to change this logic slightly so that we save the lookup too. After all this method would do with some simplification: too many if\u0027s and loops for only a handful lines of code.","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"0fa46a5d6f5ef6a294eddd3b532aed744a9c0abd","unresolved":false,"context_lines":[{"line_number":77,"context_line":"                            agent[\u0027host\u0027])"},{"line_number":78,"context_line":"            agents \u003d self._get_enabled_dhcp_agents(context, network_id)"},{"line_number":79,"context_line":"            if not agents:"},{"line_number":80,"context_line":"                # NOTE(amotoki): When a network is created, dhcp-agent"},{"line_number":81,"context_line":"                # is not associated with the network. In most cases a"},{"line_number":82,"context_line":"                # subnet is created just after an associated network"},{"line_number":83,"context_line":"                # is created. For these cases, it is completely normal"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FJQk%3D","line":80,"in_reply_to":"AAAAVn%2F%2FKn4%3D","updated":"2014-03-08 07:12:44.000000000","message":"For network_create_end, there is nothing to do here when dhcp-agent scheduler is enabled, so if it is better to return at the first.\n\nFor subnet.create.end, it is a valid case where no dhcp-agent is scheduled and there is no need to log it. On the other hand, if there is scheduled dhcp-agents for the network, we need to notify them.\n\nWhile a port exists on a network, dhcp-agent should be assigned, so error seems appropriate. This applies to port.update.end and port.delete.end.\n\nFor \"network.update.end\", \"subnet.update.end\", \"subnet.delete.end\", I think it is not an error because it does affects anything even if dhcp-agent is not assigned, but keeping it ERROR is possible choice.","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"965c7c1def6d30c5830ee3a95233fbf7da11c179","unresolved":false,"context_lines":[{"line_number":92,"context_line":"                # Considering these and the fact that error will be"},{"line_number":93,"context_line":"                # logged in dhcp-agent scheduler, it is logged as INFO"},{"line_number":94,"context_line":"                # level."},{"line_number":95,"context_line":"                if method not in [\u0027network_create_end\u0027,"},{"line_number":96,"context_line":"                                  \u0027subnet_create_end\u0027]:"},{"line_number":97,"context_line":"                    LOG.info(_(\"No DHCP agents are associated with network \""},{"line_number":98,"context_line":"                               \"\u0027%(net_id)s\u0027. Unable to send notification \""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FLQk%3D","line":95,"updated":"2014-03-07 21:06:14.000000000","message":"please consider using a tuple rather than a list.","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"965c7c1def6d30c5830ee3a95233fbf7da11c179","unresolved":false,"context_lines":[{"line_number":95,"context_line":"                if method not in [\u0027network_create_end\u0027,"},{"line_number":96,"context_line":"                                  \u0027subnet_create_end\u0027]:"},{"line_number":97,"context_line":"                    LOG.info(_(\"No DHCP agents are associated with network \""},{"line_number":98,"context_line":"                               \"\u0027%(net_id)s\u0027. Unable to send notification \""},{"line_number":99,"context_line":"                               \"for \u0027%(method)s\u0027 with payload: %(payload)s\"),"},{"line_number":100,"context_line":"                             {"},{"line_number":101,"context_line":"                                 \u0027net_id\u0027: network_id,"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FLPY%3D","line":98,"updated":"2014-03-07 21:06:14.000000000","message":"Shouldn\u0027t we keep the log level at warn at least? Or rephrase by saying that \u0027Will not send notifications\u0027. It would sound slightly more reassuring.","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"0fa46a5d6f5ef6a294eddd3b532aed744a9c0abd","unresolved":false,"context_lines":[{"line_number":95,"context_line":"                if method not in [\u0027network_create_end\u0027,"},{"line_number":96,"context_line":"                                  \u0027subnet_create_end\u0027]:"},{"line_number":97,"context_line":"                    LOG.info(_(\"No DHCP agents are associated with network \""},{"line_number":98,"context_line":"                               \"\u0027%(net_id)s\u0027. Unable to send notification \""},{"line_number":99,"context_line":"                               \"for \u0027%(method)s\u0027 with payload: %(payload)s\"),"},{"line_number":100,"context_line":"                             {"},{"line_number":101,"context_line":"                                 \u0027net_id\u0027: network_id,"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FJOY%3D","line":98,"in_reply_to":"AAAAVn%2F%2FLPY%3D","updated":"2014-03-08 07:12:44.000000000","message":"After revisiting the logic, my first thought was wrong. As described above, most logging should error (or warning) not info.","commit_id":"c10bf077575199f82081c1d365f3f99f4033df2f"}]}
