)]}'
{"neutron/agent/dhcp/agent.py":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"995e6f049727b36b01683665e191081274e13561","unresolved":false,"context_lines":[{"line_number":337,"context_line":"    def network_create_end(self, context, payload):"},{"line_number":338,"context_line":"        \"\"\"Handle the network.create.end notification event.\"\"\""},{"line_number":339,"context_line":"        network_id \u003d payload[\u0027network\u0027][\u0027id\u0027]"},{"line_number":340,"context_line":"        with lockutils.lock(network_id, utils.SYNCHRONIZED_PREFIX):"},{"line_number":341,"context_line":"            self.enable_dhcp_helper(network_id)"},{"line_number":342,"context_line":""},{"line_number":343,"context_line":"    def network_update_end(self, context, payload):"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a74a57a_62826302","line":340,"updated":"2016-11-23 16:34:29.000000000","message":"So the lock/semaphore name changes from neutron-dhcp-agent to neutron-$net-id, which should be fine since it\u0027s in the dhcp-agent.log file.\n\nI am wondering if it\u0027s useful to just create a new lock method entirely though, so the name could be more descriptive, like neutron-dhcp-net-lock-$net-id or somesuch:\n\nhttps://review.openstack.org/#/c/385617/27/neutron/agent/l3/dvr_fip_ns.py\n\nBut I\u0027m biased having done that patch.","commit_id":"dc1bb27ad92879abba24d8f909c1ed8164b87ac0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"c87720e6382ad5799fb408b9695869d03f793c66","unresolved":false,"context_lines":[{"line_number":337,"context_line":"    def network_create_end(self, context, payload):"},{"line_number":338,"context_line":"        \"\"\"Handle the network.create.end notification event.\"\"\""},{"line_number":339,"context_line":"        network_id \u003d payload[\u0027network\u0027][\u0027id\u0027]"},{"line_number":340,"context_line":"        with lockutils.lock(network_id, utils.SYNCHRONIZED_PREFIX):"},{"line_number":341,"context_line":"            self.enable_dhcp_helper(network_id)"},{"line_number":342,"context_line":""},{"line_number":343,"context_line":"    def network_update_end(self, context, payload):"}],"source_content_type":"text/x-python","patch_set":7,"id":"5a74a57a_9add1245","line":340,"updated":"2016-11-23 23:56:46.000000000","message":"Sure","commit_id":"dc1bb27ad92879abba24d8f909c1ed8164b87ac0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ab6fea956459a5e16eea6f8e146782210b7395d6","unresolved":false,"context_lines":[{"line_number":42,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"def net_lock(network_id):"},{"line_number":46,"context_line":"    \"\"\"Returns a context manager lock based on network_id.\"\"\""},{"line_number":47,"context_line":"    lock_name \u003d \u0027dhcp-agent-network-lock-%s\u0027 % network_id"},{"line_number":48,"context_line":"    return lockutils.lock(lock_name, utils.SYNCHRONIZED_PREFIX)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a74a57a_953b17d1","line":45,"updated":"2016-11-24 09:57:33.000000000","message":"ack","commit_id":"7c8a6a2b5163493281400dbc098f1135f72ced4f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d0150315f2537028538dd1fdc65812793bcc4181","unresolved":false,"context_lines":[{"line_number":42,"context_line":"LOG \u003d logging.getLogger(__name__)"},{"line_number":43,"context_line":""},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"def net_lock(network_id):"},{"line_number":46,"context_line":"    \"\"\"Returns a context manager lock based on network_id.\"\"\""},{"line_number":47,"context_line":"    lock_name \u003d \u0027dhcp-agent-network-lock-%s\u0027 % network_id"},{"line_number":48,"context_line":"    return lockutils.lock(lock_name, utils.SYNCHRONIZED_PREFIX)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a74a57a_ecbc8b6e","line":45,"updated":"2016-11-24 06:36:38.000000000","message":"this is an internal method so please prefix with _","commit_id":"7c8a6a2b5163493281400dbc098f1135f72ced4f"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ab6fea956459a5e16eea6f8e146782210b7395d6","unresolved":false,"context_lines":[{"line_number":45,"context_line":"def net_lock(network_id):"},{"line_number":46,"context_line":"    \"\"\"Returns a context manager lock based on network_id.\"\"\""},{"line_number":47,"context_line":"    lock_name \u003d \u0027dhcp-agent-network-lock-%s\u0027 % network_id"},{"line_number":48,"context_line":"    return lockutils.lock(lock_name, utils.SYNCHRONIZED_PREFIX)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class DhcpAgent(manager.Manager):"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a74a57a_b53653e5","line":48,"updated":"2016-11-24 09:57:33.000000000","message":"If there is more than one on the same host, we don\u0027t want these locks to affect both agents. They are just for protecting the network info cache, which is local to the agent.","commit_id":"7c8a6a2b5163493281400dbc098f1135f72ced4f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d0150315f2537028538dd1fdc65812793bcc4181","unresolved":false,"context_lines":[{"line_number":45,"context_line":"def net_lock(network_id):"},{"line_number":46,"context_line":"    \"\"\"Returns a context manager lock based on network_id.\"\"\""},{"line_number":47,"context_line":"    lock_name \u003d \u0027dhcp-agent-network-lock-%s\u0027 % network_id"},{"line_number":48,"context_line":"    return lockutils.lock(lock_name, utils.SYNCHRONIZED_PREFIX)"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class DhcpAgent(manager.Manager):"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a74a57a_4cbadf6f","line":48,"updated":"2016-11-24 06:36:38.000000000","message":"what if there is more than one DHCP agent running ont he same host - maybe we should consider the \u0027external\u0027 flag here","commit_id":"7c8a6a2b5163493281400dbc098f1135f72ced4f"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ab6fea956459a5e16eea6f8e146782210b7395d6","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        \"\"\""},{"line_number":154,"context_line":"        self.needs_resync_reasons[network_id].append(reason)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    @utils.synchronized(\u0027sync-state\u0027)"},{"line_number":157,"context_line":"    def sync_state(self, networks\u003dNone):"},{"line_number":158,"context_line":"        \"\"\"Sync the local DHCP state with Neutron. If no networks are passed,"},{"line_number":159,"context_line":"        or \u0027None\u0027 is one of the networks, sync all of the networks."}],"source_content_type":"text/x-python","patch_set":8,"id":"5a74a57a_d5358fda","line":156,"updated":"2016-11-24 09:57:33.000000000","message":"This is to protect from some kind of corner case (or future case) where sync_state gets called by two different threads. If that happens and we don\u0027t have this lock, attempting to acquire all of the locks on L175 could result in a deadlock because two different threads could each acquire some of the locks and then both block waiting to get the locks from the other half.\n\nBy covering this one case where a single thread needs multiple locks with a single lock, we protect ourselves from that possibility.","commit_id":"7c8a6a2b5163493281400dbc098f1135f72ced4f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d0150315f2537028538dd1fdc65812793bcc4181","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        \"\"\""},{"line_number":154,"context_line":"        self.needs_resync_reasons[network_id].append(reason)"},{"line_number":155,"context_line":""},{"line_number":156,"context_line":"    @utils.synchronized(\u0027sync-state\u0027)"},{"line_number":157,"context_line":"    def sync_state(self, networks\u003dNone):"},{"line_number":158,"context_line":"        \"\"\"Sync the local DHCP state with Neutron. If no networks are passed,"},{"line_number":159,"context_line":"        or \u0027None\u0027 is one of the networks, sync all of the networks."}],"source_content_type":"text/x-python","patch_set":8,"id":"5a74a57a_ccf8af4c","line":156,"updated":"2016-11-24 06:36:38.000000000","message":"not sure why we need this now. i think that you need to fix the locks internally - please see below","commit_id":"7c8a6a2b5163493281400dbc098f1135f72ced4f"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ab6fea956459a5e16eea6f8e146782210b7395d6","unresolved":false,"context_lines":[{"line_number":175,"context_line":"            with utils.nested(*mgrs):"},{"line_number":176,"context_line":"                for deleted_id in known_network_ids - active_network_ids:"},{"line_number":177,"context_line":"                    try:"},{"line_number":178,"context_line":"                        self.disable_dhcp_helper(deleted_id)"},{"line_number":179,"context_line":"                    except Exception as e:"},{"line_number":180,"context_line":"                        self.schedule_resync(e, deleted_id)"},{"line_number":181,"context_line":"                        LOG.exception(_LE(\u0027Unable to sync network state on \u0027"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a74a57a_f530cbea","line":178,"updated":"2016-11-24 09:57:33.000000000","message":"This is wrapped with net_lock. See L175, that acquires locks for all of the network IDs that it is going to manipulate.","commit_id":"7c8a6a2b5163493281400dbc098f1135f72ced4f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d0150315f2537028538dd1fdc65812793bcc4181","unresolved":false,"context_lines":[{"line_number":175,"context_line":"            with utils.nested(*mgrs):"},{"line_number":176,"context_line":"                for deleted_id in known_network_ids - active_network_ids:"},{"line_number":177,"context_line":"                    try:"},{"line_number":178,"context_line":"                        self.disable_dhcp_helper(deleted_id)"},{"line_number":179,"context_line":"                    except Exception as e:"},{"line_number":180,"context_line":"                        self.schedule_resync(e, deleted_id)"},{"line_number":181,"context_line":"                        LOG.exception(_LE(\u0027Unable to sync network state on \u0027"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a74a57a_0cf2a76f","line":178,"updated":"2016-11-24 06:36:38.000000000","message":"you need to wrap this with the net_lock. If not then the locking below will be problematic (for example lime 346)","commit_id":"7c8a6a2b5163493281400dbc098f1135f72ced4f"}]}
