)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":5948,"name":"Oleg Bondarev","email":"obondarev@mirantis.com","username":"obondarev"},"change_message_id":"90aeefab6ef872be2813caa10ab6adcc3f6d13dd","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add support to update segment host binding with no agent topology"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Trival refactor to make topology without l2 agent(networking ovn) can"},{"line_number":10,"context_line":"use the functions to update segment host binding."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: If03e6a734a2b2df5259e7c7b5d7069dca144a005"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"9abb7d3a_3a5e9876","line":10,"range":{"start_line":9,"start_character":66,"end_line":10,"end_character":48},"updated":"2016-05-30 09:27:03.000000000","message":"the patch just refactores db \u0027get\u0027 query into a separate function, how does it help to update bindings for no-agents plugins?","commit_id":"172dd73d55340376b4fc6d146eac76c8957ad254"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"fdde05d10dbc7a620fd243230c17aff9212eb953","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add support to update segment host binding with no agent topology"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Trival refactor to make topology without l2 agent(networking ovn) can"},{"line_number":10,"context_line":"use the functions to update segment host binding."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: If03e6a734a2b2df5259e7c7b5d7069dca144a005"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7aa08908_b9fb787a","line":10,"range":{"start_line":9,"start_character":66,"end_line":10,"end_character":48},"in_reply_to":"9abb7d3a_3a5e9876","updated":"2016-06-13 07:13:45.000000000","message":"Thanks for bringing it out, this will be explained in the commit message of next patch set.","commit_id":"172dd73d55340376b4fc6d146eac76c8957ad254"}],"neutron/services/segments/db.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"2dcb35ca4a2ccfc1cbdcf724e9ec0c669c4c6a7c","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        current_segment_ids \u003d {"},{"line_number":204,"context_line":"            segment[\u0027id\u0027] for segment in segments"},{"line_number":205,"context_line":"            if check_segment_for_agent(segment, agent)}"},{"line_number":206,"context_line":"        update_segment_host_mapping(context, host, current_segment_ids)"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"def subscribe():"}],"source_content_type":"text/x-python","patch_set":2,"id":"7aa08908_f4cfc57c","side":"PARENT","line":206,"updated":"2016-06-13 07:37:48.000000000","message":"this was previously under the db transaction. is this ok that it is now not under the transaction?","commit_id":"260ce9c161228e35215126e047443ec32b7bf1ef"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"36073f47308d06f11504f962a0bcf51a96c58e2f","unresolved":false,"context_lines":[{"line_number":203,"context_line":"        current_segment_ids \u003d {"},{"line_number":204,"context_line":"            segment[\u0027id\u0027] for segment in segments"},{"line_number":205,"context_line":"            if check_segment_for_agent(segment, agent)}"},{"line_number":206,"context_line":"        update_segment_host_mapping(context, host, current_segment_ids)"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"def subscribe():"}],"source_content_type":"text/x-python","patch_set":2,"id":"7aa08908_efe88ee4","side":"PARENT","line":206,"in_reply_to":"7aa08908_f4cfc57c","updated":"2016-06-13 08:10:27.000000000","message":"Both get_segments_with_phys_nets and update_segment_host_mapping will have their own transaction, so i think it is OK here.","commit_id":"260ce9c161228e35215126e047443ec32b7bf1ef"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"2dcb35ca4a2ccfc1cbdcf724e9ec0c669c4c6a7c","unresolved":false,"context_lines":[{"line_number":185,"context_line":"reported_hosts \u003d set()"},{"line_number":186,"context_line":""},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"def get_segments_with_phys_nets(context, phys_nets):"},{"line_number":189,"context_line":"    with context.session.begin(subtransactions\u003dTrue):"},{"line_number":190,"context_line":"        segments \u003d context.session.query(db.NetworkSegment).filter("},{"line_number":191,"context_line":"            db.NetworkSegment.physical_network.in_(phys_nets))"}],"source_content_type":"text/x-python","patch_set":2,"id":"7aa08908_94df6139","line":188,"updated":"2016-06-13 07:37:48.000000000","message":"this method is local. please use a _","commit_id":"5ad2edf8fd976dd905004dcbffcc66efe3483f57"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"36073f47308d06f11504f962a0bcf51a96c58e2f","unresolved":false,"context_lines":[{"line_number":185,"context_line":"reported_hosts \u003d set()"},{"line_number":186,"context_line":""},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"def get_segments_with_phys_nets(context, phys_nets):"},{"line_number":189,"context_line":"    with context.session.begin(subtransactions\u003dTrue):"},{"line_number":190,"context_line":"        segments \u003d context.session.query(db.NetworkSegment).filter("},{"line_number":191,"context_line":"            db.NetworkSegment.physical_network.in_(phys_nets))"}],"source_content_type":"text/x-python","patch_set":2,"id":"7aa08908_2f9d7666","line":188,"in_reply_to":"7aa08908_94df6139","updated":"2016-06-13 08:10:27.000000000","message":"This method will be used by agentless plugin, like ovn. If it is local, there will be no need to split it out.","commit_id":"5ad2edf8fd976dd905004dcbffcc66efe3483f57"},{"author":{"_account_id":11762,"name":"Han Zhou","email":"zhouhan@gmail.com","username":"hanzhou"},"change_message_id":"717a15c3b34a1bce8b22a639f0605c39167b25fc","unresolved":false,"context_lines":[{"line_number":213,"context_line":"    if host in reported_hosts and not start_flag:"},{"line_number":214,"context_line":"        return"},{"line_number":215,"context_line":"    reported_hosts.add(host)"},{"line_number":216,"context_line":"    segments \u003d get_segments_with_phys_nets(context, phys_nets)"},{"line_number":217,"context_line":"    current_segment_ids \u003d {"},{"line_number":218,"context_line":"        segment[\u0027id\u0027] for segment in segments"},{"line_number":219,"context_line":"        if check_segment_for_agent(segment, agent)}"}],"source_content_type":"text/x-python","patch_set":3,"id":"7aa08908_2f8a3d1b","line":216,"updated":"2016-06-14 17:52:48.000000000","message":"We shall add transaction back here to protect race condition between get_segments_with_phys_nets() and update_segment_host_mapping()?","commit_id":"76c9e81e5aa257a26544f4fc06c02d5c544e9f6a"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"1026c3857b6e543aa03ed0474dc8f4893a55375f","unresolved":false,"context_lines":[{"line_number":213,"context_line":"    if host in reported_hosts and not start_flag:"},{"line_number":214,"context_line":"        return"},{"line_number":215,"context_line":"    reported_hosts.add(host)"},{"line_number":216,"context_line":"    segments \u003d get_segments_with_phys_nets(context, phys_nets)"},{"line_number":217,"context_line":"    current_segment_ids \u003d {"},{"line_number":218,"context_line":"        segment[\u0027id\u0027] for segment in segments"},{"line_number":219,"context_line":"        if check_segment_for_agent(segment, agent)}"}],"source_content_type":"text/x-python","patch_set":3,"id":"7aa08908_62228c53","line":216,"in_reply_to":"7aa08908_08b5b1eb","updated":"2016-06-14 23:37:27.000000000","message":"\"If we set up bridge mappings, restart the agent and then we go create the segment, what is going to happen? Do we need to restart the agent after creating the segment in order to create the segment host mapping? I\u0027ll ask Miguel. Either way, I don\u0027t think it has much to do with this patch set.\"\n\nYes, the agent would need to be re-started again. Kevin Benton has proposed the following patchset, though: https://review.openstack.org/#/c/329309/","commit_id":"76c9e81e5aa257a26544f4fc06c02d5c544e9f6a"},{"author":{"_account_id":11762,"name":"Han Zhou","email":"zhouhan@gmail.com","username":"hanzhou"},"change_message_id":"b788c936a961139799670e2a39273dbb7fb723c5","unresolved":false,"context_lines":[{"line_number":213,"context_line":"    if host in reported_hosts and not start_flag:"},{"line_number":214,"context_line":"        return"},{"line_number":215,"context_line":"    reported_hosts.add(host)"},{"line_number":216,"context_line":"    segments \u003d get_segments_with_phys_nets(context, phys_nets)"},{"line_number":217,"context_line":"    current_segment_ids \u003d {"},{"line_number":218,"context_line":"        segment[\u0027id\u0027] for segment in segments"},{"line_number":219,"context_line":"        if check_segment_for_agent(segment, agent)}"}],"source_content_type":"text/x-python","patch_set":3,"id":"7aa08908_ae1e25b8","line":216,"in_reply_to":"7aa08908_08b5b1eb","updated":"2016-06-14 21:55:09.000000000","message":"Thought twice and agree that the race doesn\u0027t matter here :)\n\n\u003e If we set up bridge mappings, restart the agent and then we go create the segment, what is going to happen? Do we need to restart the agent after creating the segment in order to create the segment host mapping?\n\nIMHO, since the principle here (in this function) is that whatever segments that already existed under the physnet that is connected to the host (agent) should be added to the host-segment mapping, then it makes no sense to restart agent to get a new segment mapped. New segments should be naturally mapped to all the hosts under related physnets. If this is correct, would a host-physnet mapping object make it simpler?\n\n\u003e We might have to also think about what happens when we delete a segment, how does the host mapping get cleaned up? \n\nI think this should be taken care already by the ondelete\u003d\"CASCADE\" foreign key.\n\n\u003e What if a host just goes away? How will its mappings get cleaned up.\n\nIt would be good if it is handled in the same way as the segment_id foreign key, but unfortunately we don\u0027t have a host table in neutron. I would propose again a host-physnet table in neutron, where host can be primary key.\n\nMoreover, in current code host is a primary key in SegmentHostMapping. Is this a bug? (There can be multiple records with same host that maps to different segments)","commit_id":"76c9e81e5aa257a26544f4fc06c02d5c544e9f6a"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"567834f3cc826d68945529ec628bfd563c4a83c4","unresolved":false,"context_lines":[{"line_number":213,"context_line":"    if host in reported_hosts and not start_flag:"},{"line_number":214,"context_line":"        return"},{"line_number":215,"context_line":"    reported_hosts.add(host)"},{"line_number":216,"context_line":"    segments \u003d get_segments_with_phys_nets(context, phys_nets)"},{"line_number":217,"context_line":"    current_segment_ids \u003d {"},{"line_number":218,"context_line":"        segment[\u0027id\u0027] for segment in segments"},{"line_number":219,"context_line":"        if check_segment_for_agent(segment, agent)}"}],"source_content_type":"text/x-python","patch_set":3,"id":"7aa08908_08b5b1eb","line":216,"in_reply_to":"7aa08908_2f8a3d1b","updated":"2016-06-14 21:01:15.000000000","message":"This particular race isn\u0027t going to matter at all.  If we happen to be adding or deleting a segment with a physnet at around the exact time that an agent is coming online reporting connectivity to the same physnet, it isn\u0027t going to matter really if we are going to have a transaction wrapping this to maintain perfect serialization of the two events.\n\nWhat we need to do is figure out if the segment has to exist first before we set up bridge mappings and restart the agent, or if we can do that in either order.\n\nIf we set up bridge mappings, restart the agent and then we go create the segment, what is going to happen?  Do we need to restart the agent after creating the segment in order to create the segment host mapping?  I\u0027ll ask Miguel.  Either way, I don\u0027t think it has much to do with this patch set.\n\nWe might have to also think about what happens when we delete a segment, how does the host mapping get cleaned up?  What if a host just goes away?  How will its mappings get cleaned up.  I guess that last one doesn\u0027t matter much since if the host goes away, Nova isn\u0027t going to try scheduling to it anymore.","commit_id":"76c9e81e5aa257a26544f4fc06c02d5c544e9f6a"}]}
