)]}'
{"octavia/network/drivers/neutron/allowed_address_pairs.py":[{"author":{"_account_id":10273,"name":"Adam Harwell","email":"flux.adam@gmail.com","username":"rm_you"},"change_message_id":"97dbf273ae84e04cdd32227f5c9894d2daaf73c1","unresolved":false,"context_lines":[{"line_number":92,"context_line":"            ip_version \u003d subnet.ip_version"},{"line_number":93,"context_line":"            num \u003d 0"},{"line_number":94,"context_line":"            for s in subnets:"},{"line_number":95,"context_line":"                if num \u003e\u003d 2:"},{"line_number":96,"context_line":"                    port[\u0027fixed_ips\u0027] \u003d [{\u0027subnet_id\u0027: subnet.id}]"},{"line_number":97,"context_line":"                    break"},{"line_number":98,"context_line":"                elif s.get(\u0027ip_version\u0027, None) \u003d\u003d ip_version:"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba5201f7_7bd2c15d","line":95,"updated":"2017-01-05 04:58:04.000000000","message":"Can you explain what this is doing?\nThis strikes me as some crazy magic-number assumption that\u0027s being made, and that kind of thing is scary. I\u0027ve read this a few times and I can\u0027t imagine what\u0027s special about the 3rd subnet? If there aren\u0027t three subnets, nothing is set?","commit_id":"db3ce1b617bb72f46fff462e3834b3cca50c14d5"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c6c23cf39dc7fdd95ce9fed936f716d25f630acc","unresolved":false,"context_lines":[{"line_number":92,"context_line":"            ip_version \u003d subnet.ip_version"},{"line_number":93,"context_line":"            num \u003d 0"},{"line_number":94,"context_line":"            for s in subnets:"},{"line_number":95,"context_line":"                if num \u003e\u003d 2:"},{"line_number":96,"context_line":"                    port[\u0027fixed_ips\u0027] \u003d [{\u0027subnet_id\u0027: subnet.id}]"},{"line_number":97,"context_line":"                    break"},{"line_number":98,"context_line":"                elif s.get(\u0027ip_version\u0027, None) \u003d\u003d ip_version:"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba5201f7_614cd29e","line":95,"in_reply_to":"ba5201f7_7bd2c15d","updated":"2017-01-05 06:54:30.000000000","message":"Here, it want to check if the request port\u0027s network contained  more than 1 subnets. If we create port with network, neutron may return the port fixed ip from other subnets but not the same with vip-subnet. If the returned port from other subnets, L321-l332 will set vrrp_ip as None, then the following taskflow \"GetAmphoraeNetworkConfigs\" will hit error, such as L540-L541 get \"None\" subnet.\nAs we use the default behavior of neutron in port creation, we may hit the issue.\n\nThe num here just for check the number of the subnets. If there are more than 1 subnets in the network, the vrrp port will be created from the vip-subnet.","commit_id":"db3ce1b617bb72f46fff462e3834b3cca50c14d5"},{"author":{"_account_id":10273,"name":"Adam Harwell","email":"flux.adam@gmail.com","username":"rm_you"},"change_message_id":"97dbf273ae84e04cdd32227f5c9894d2daaf73c1","unresolved":false,"context_lines":[{"line_number":93,"context_line":"            num \u003d 0"},{"line_number":94,"context_line":"            for s in subnets:"},{"line_number":95,"context_line":"                if num \u003e\u003d 2:"},{"line_number":96,"context_line":"                    port[\u0027fixed_ips\u0027] \u003d [{\u0027subnet_id\u0027: subnet.id}]"},{"line_number":97,"context_line":"                    break"},{"line_number":98,"context_line":"                elif s.get(\u0027ip_version\u0027, None) \u003d\u003d ip_version:"},{"line_number":99,"context_line":"                    num +\u003d 1"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba5201f7_dbcd6db8","line":96,"updated":"2017-01-05 04:58:04.000000000","message":"Should this be port[\u0027port\u0027][\u0027fixed_ips\u0027]?","commit_id":"db3ce1b617bb72f46fff462e3834b3cca50c14d5"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c6c23cf39dc7fdd95ce9fed936f716d25f630acc","unresolved":false,"context_lines":[{"line_number":93,"context_line":"            num \u003d 0"},{"line_number":94,"context_line":"            for s in subnets:"},{"line_number":95,"context_line":"                if num \u003e\u003d 2:"},{"line_number":96,"context_line":"                    port[\u0027fixed_ips\u0027] \u003d [{\u0027subnet_id\u0027: subnet.id}]"},{"line_number":97,"context_line":"                    break"},{"line_number":98,"context_line":"                elif s.get(\u0027ip_version\u0027, None) \u003d\u003d ip_version:"},{"line_number":99,"context_line":"                    num +\u003d 1"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba5201f7_e6dd38e1","line":96,"in_reply_to":"ba5201f7_dbcd6db8","updated":"2017-01-05 06:54:30.000000000","message":"Yeah, it\u0027s my mistake here.","commit_id":"db3ce1b617bb72f46fff462e3834b3cca50c14d5"},{"author":{"_account_id":11628,"name":"Michael Johnson","email":"johnsomor@gmail.com","username":"johnsom"},"change_message_id":"37298ad694259271f602ee2362e8ea24eebb5304","unresolved":false,"context_lines":[{"line_number":87,"context_line":"                             \u0027network_id\u0027: subnet.network_id,"},{"line_number":88,"context_line":"                             \u0027admin_state_up\u0027: True,"},{"line_number":89,"context_line":"                             \u0027device_owner\u0027: OCTAVIA_OWNER}}"},{"line_number":90,"context_line":"            subnets \u003d self.neutron_client.list_subnets("},{"line_number":91,"context_line":"                network_id\u003dsubnet.network_id)[\u0027subnets\u0027]"},{"line_number":92,"context_line":"            ip_version \u003d subnet.ip_version"},{"line_number":93,"context_line":"            subnets_num \u003d 0"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5201f7_fbf10696","line":90,"updated":"2017-01-06 21:38:50.000000000","message":"I don\u0027t think any of this is necessary.  Why can\u0027t you just put the subnet ID into the \u0027fixed_ips\u0027 field right away?  There really shouldn\u0027t be a need for any of this other code.  Subnets can only be one ip version(in neutron), so if you pass in the subnet ID you will get the right type of IP back.","commit_id":"2584d77136851f15a3aa207ae06971d3e047d4a8"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1c599a57e1334c2774538971523607806cb8a23a","unresolved":false,"context_lines":[{"line_number":87,"context_line":"                             \u0027network_id\u0027: subnet.network_id,"},{"line_number":88,"context_line":"                             \u0027admin_state_up\u0027: True,"},{"line_number":89,"context_line":"                             \u0027device_owner\u0027: OCTAVIA_OWNER}}"},{"line_number":90,"context_line":"            subnets \u003d self.neutron_client.list_subnets("},{"line_number":91,"context_line":"                network_id\u003dsubnet.network_id)[\u0027subnets\u0027]"},{"line_number":92,"context_line":"            ip_version \u003d subnet.ip_version"},{"line_number":93,"context_line":"            subnets_num \u003d 0"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5201f7_2d57bc58","line":90,"in_reply_to":"ba5201f7_fbf10696","updated":"2017-01-09 02:49:37.000000000","message":"Thank you for so detailed description. The code here may be confused you, and also make me confused. The original idea of mine may be very strange, and the expect result is the same with your said. It want the same subnet IP. I will change this with your and Adam\u0027s kind suggesions.","commit_id":"2584d77136851f15a3aa207ae06971d3e047d4a8"},{"author":{"_account_id":10273,"name":"Adam Harwell","email":"flux.adam@gmail.com","username":"rm_you"},"change_message_id":"41e9a343fc233dff8644037bb7d5aebe24f1e7dd","unresolved":false,"context_lines":[{"line_number":92,"context_line":"            ip_version \u003d subnet.ip_version"},{"line_number":93,"context_line":"            subnets_num \u003d 0"},{"line_number":94,"context_line":"            for s in subnets:"},{"line_number":95,"context_line":"                if subnets_num \u003e\u003d 2:"},{"line_number":96,"context_line":"                    port[\u0027port\u0027][\u0027fixed_ips\u0027] \u003d [{\u0027subnet_id\u0027: subnet.id}]"},{"line_number":97,"context_line":"                    break"},{"line_number":98,"context_line":"                elif s.get(\u0027ip_version\u0027, None) \u003d\u003d ip_version:"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5201f7_7bf27607","line":95,"updated":"2017-01-06 21:28:11.000000000","message":"This doesn\u0027t work the way you expect it to in all cases. I\u0027m still REALLY confused about what exactly this is supposed to accomplish.\nFirst, I\u0027ve noticed you don\u0027t actually use the id from the subnet you\u0027ve found -- you use the id from the subnet that was passed in. \n\nIf that\u0027s really what needs to happen, then why do we even need this check? What would be wrong with just setting this regardless of the number of subnets that exist?\n\nIf you meant to pull the id from the subnet that you FIND (the ... second one?) then that doesn\u0027t make a lot of sense to me, as it\u0027s pretty arbitrary (also, your code currently only enters this branch on the subnet AFTER you find the second subnet).\n\nIf you run this code given the following data, you\u0027ll get some surprising results:\n\nip_version \u003d 4\nsubnets \u003d [{\u0027ip_version\u0027: 4},{\u0027ip_version\u0027: 4},{\u0027ip_version\u0027: 6}]\n\u003e Sets the fixed_ips when s \u003d {\u0027ip_version\u0027: 6}\n\nip_version \u003d 4\nsubnets \u003d [{\u0027ip_version\u0027: 4},{\u0027ip_version\u0027: 4}]\n\u003e Sets nothing, because there\u0027s no third run of the loop.\n\nAssuming you don\u0027t actually care about the individual subnets (just the number of them?) you might want something like:\n\nnum_subnets \u003d len(\n    [s for s in subnets if s.get(\u0027ip_version\u0027, None) \u003d\u003d ip_version])\nif num_subnets \u003e\u003d 2:\n    port[\u0027port\u0027][\u0027fixed_ips\u0027] \u003d [{\u0027subnet_id\u0027: subnet.id}]","commit_id":"2584d77136851f15a3aa207ae06971d3e047d4a8"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1c599a57e1334c2774538971523607806cb8a23a","unresolved":false,"context_lines":[{"line_number":92,"context_line":"            ip_version \u003d subnet.ip_version"},{"line_number":93,"context_line":"            subnets_num \u003d 0"},{"line_number":94,"context_line":"            for s in subnets:"},{"line_number":95,"context_line":"                if subnets_num \u003e\u003d 2:"},{"line_number":96,"context_line":"                    port[\u0027port\u0027][\u0027fixed_ips\u0027] \u003d [{\u0027subnet_id\u0027: subnet.id}]"},{"line_number":97,"context_line":"                    break"},{"line_number":98,"context_line":"                elif s.get(\u0027ip_version\u0027, None) \u003d\u003d ip_version:"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba5201f7_0deaf873","line":95,"in_reply_to":"ba5201f7_7bf27607","updated":"2017-01-09 02:49:37.000000000","message":"Many many thanks for your very kind review. Sorry for the code here may confuse you. And the cases you show are correct. The code here is terrible and useless. My original idea here is that if there are 2 subnets in the same ip_version type. I need the same vrrp ip from the vip ip. And if not, I won\u0027t change the original process logical. So I did the code here not good, or look so strange.:P","commit_id":"2584d77136851f15a3aa207ae06971d3e047d4a8"}]}
