)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f611e99fbf065d955e7f20e37e8a593a554b8080","unresolved":false,"context_lines":[{"line_number":11,"context_line":""},{"line_number":12,"context_line":"1. network_id or"},{"line_number":13,"context_line":"2. port_id or"},{"line_number":14,"context_line":"3. requested_id and network_id"},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"It is a failure to request both network_id and port_id."},{"line_number":17,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"7f231b9d_30cfd8b1","line":14,"range":{"start_line":14,"start_character":3,"end_line":14,"end_character":15},"updated":"2017-06-19 21:52:17.000000000","message":"requested_ip","commit_id":"88ca491c14341005aa6b22b73e46fe8b9e16ea79"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f611e99fbf065d955e7f20e37e8a593a554b8080","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"It is a failure to request both network_id and port_id."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"And you can\u0027t specify port_id and requested_id because that"},{"line_number":19,"context_line":"would violate the port/network constraint or fail #3 where"},{"line_number":20,"context_line":"network_id is required if you specify requested_ip."},{"line_number":21,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"7f231b9d_d0bd4403","line":18,"range":{"start_line":18,"start_character":34,"end_line":18,"end_character":46},"updated":"2017-06-19 21:52:17.000000000","message":"requested_ip","commit_id":"88ca491c14341005aa6b22b73e46fe8b9e16ea79"}],"nova/compute/manager.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"378c15b37eeaa61955613a43b53623bcec4b9a75","unresolved":false,"context_lines":[{"line_number":5098,"context_line":"            if port_id is not None:"},{"line_number":5099,"context_line":"                try:"},{"line_number":5100,"context_line":"                    self.network_api.deallocate_port_for_instance("},{"line_number":5101,"context_line":"                        context, instance, port_id)"},{"line_number":5102,"context_line":"                except Exception:"},{"line_number":5103,"context_line":"                    LOG.warning(_LW(\"deallocate port %(port_id)s failed\"),"},{"line_number":5104,"context_line":"                                {\u0027port_id\u0027: port_id}, instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":1,"id":"dfeb2761_2e097330","line":5101,"updated":"2017-04-03 00:55:12.000000000","message":"Oops need to use the new kwarg.","commit_id":"088722527b8567557f32529a0632106ae6974640"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"0c152e47c3bb9e70419e23f42bb77d5700fbece3","unresolved":false,"context_lines":[{"line_number":5095,"context_line":"            # Attempt to unbind the port from the instance in case something"},{"line_number":5096,"context_line":"            # failed. Note that port_id is optional so we check for that"},{"line_number":5097,"context_line":"            # first."},{"line_number":5098,"context_line":"            if port_id is not None:"},{"line_number":5099,"context_line":"                try:"},{"line_number":5100,"context_line":"                    self.network_api.deallocate_port_for_instance("},{"line_number":5101,"context_line":"                        context, instance, port_id, preexisting_port\u003dTrue)"},{"line_number":5102,"context_line":"                except Exception:"},{"line_number":5103,"context_line":"                    LOG.warning(_LW(\"deallocate port %(port_id)s failed\"),"},{"line_number":5104,"context_line":"                                {\u0027port_id\u0027: port_id}, instance\u003dinstance)"},{"line_number":5105,"context_line":"            raise exception.InterfaceAttachFailed("},{"line_number":5106,"context_line":"                instance_uuid\u003dinstance.uuid)"},{"line_number":5107,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"dfeb2761_c292db4b","line":5104,"range":{"start_line":5098,"start_character":0,"end_line":5104,"end_character":72},"updated":"2017-04-03 01:57:26.000000000","message":"the port_id here is actually loaded from line 5090 so no matter you provided port_id or net_id or ip, the port_id here will not be none, as neutron generated one here :)","commit_id":"118996e151b9cf41e356879c6b0607f19ae6f5f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"7f5011065ba52c3ddb4b830df2e0eb93420c7ef3","unresolved":false,"context_lines":[{"line_number":5095,"context_line":"            # Attempt to unbind the port from the instance in case something"},{"line_number":5096,"context_line":"            # failed. Note that port_id is optional so we check for that"},{"line_number":5097,"context_line":"            # first."},{"line_number":5098,"context_line":"            if port_id is not None:"},{"line_number":5099,"context_line":"                try:"},{"line_number":5100,"context_line":"                    self.network_api.deallocate_port_for_instance("},{"line_number":5101,"context_line":"                        context, instance, port_id, preexisting_port\u003dTrue)"},{"line_number":5102,"context_line":"                except Exception:"},{"line_number":5103,"context_line":"                    LOG.warning(_LW(\"deallocate port %(port_id)s failed\"),"},{"line_number":5104,"context_line":"                                {\u0027port_id\u0027: port_id}, instance\u003dinstance)"},{"line_number":5105,"context_line":"            raise exception.InterfaceAttachFailed("},{"line_number":5106,"context_line":"                instance_uuid\u003dinstance.uuid)"},{"line_number":5107,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"dfeb2761_251d1166","line":5104,"range":{"start_line":5098,"start_character":0,"end_line":5104,"end_character":72},"in_reply_to":"dfeb2761_c292db4b","updated":"2017-04-03 02:38:50.000000000","message":"Ah nice catch. I can set a variable before that point to know if we had a pre-existing port or not which should handle that case.","commit_id":"118996e151b9cf41e356879c6b0607f19ae6f5f0"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"fa3cc4c3e9fea95fb00ce64d2d4c185c8423e897","unresolved":false,"context_lines":[{"line_number":5074,"context_line":"                instance_id\u003dinstance.uuid)"},{"line_number":5075,"context_line":"        preexisting_port \u003d True if port_id is not None else False"},{"line_number":5076,"context_line":"        bind_host_id \u003d self.driver.network_binding_host_id(context, instance)"},{"line_number":5077,"context_line":"        network_info \u003d self.network_api.allocate_port_for_instance("},{"line_number":5078,"context_line":"            context, instance, port_id, network_id, requested_ip,"},{"line_number":5079,"context_line":"            bind_host_id\u003dbind_host_id)"},{"line_number":5080,"context_line":"        if len(network_info) !\u003d 1:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7ffa3b31_ba37e5e3","line":5077,"range":{"start_line":5077,"start_character":8,"end_line":5077,"end_character":20},"updated":"2017-04-18 16:27:18.000000000","message":"So network_info should have been correctly populated with the preexisting_port thingy. I am curious why that has failed in this case.","commit_id":"88ca491c14341005aa6b22b73e46fe8b9e16ea79"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4491c46aca082e56c1e0f7f4219e7445588475c3","unresolved":false,"context_lines":[{"line_number":5074,"context_line":"                instance_id\u003dinstance.uuid)"},{"line_number":5075,"context_line":"        preexisting_port \u003d True if port_id is not None else False"},{"line_number":5076,"context_line":"        bind_host_id \u003d self.driver.network_binding_host_id(context, instance)"},{"line_number":5077,"context_line":"        network_info \u003d self.network_api.allocate_port_for_instance("},{"line_number":5078,"context_line":"            context, instance, port_id, network_id, requested_ip,"},{"line_number":5079,"context_line":"            bind_host_id\u003dbind_host_id)"},{"line_number":5080,"context_line":"        if len(network_info) !\u003d 1:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7ffa3b31_2e9a7362","line":5077,"range":{"start_line":5077,"start_character":8,"end_line":5077,"end_character":20},"in_reply_to":"7ffa3b31_ba37e5e3","updated":"2017-04-18 19:06:34.000000000","message":"Hmm, good point. Tracing the code through it looks like it should have.","commit_id":"88ca491c14341005aa6b22b73e46fe8b9e16ea79"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"03b63b18ec5d82330ad1b7b8658d245aa725b98a","unresolved":false,"context_lines":[{"line_number":5096,"context_line":"            try:"},{"line_number":5097,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5098,"context_line":"                    context, instance, port_id,"},{"line_number":5099,"context_line":"                    preexisting_port\u003dpreexisting_port)"},{"line_number":5100,"context_line":"            except Exception:"},{"line_number":5101,"context_line":"                LOG.warning(_LW(\"deallocate port %(port_id)s failed\"),"},{"line_number":5102,"context_line":"                             {\u0027port_id\u0027: port_id}, instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":4,"id":"7ffa3b31_fab9ede8","line":5099,"range":{"start_line":5099,"start_character":37,"end_line":5099,"end_character":53},"updated":"2017-04-18 16:34:23.000000000","message":"Could that not be network_info[0][\u0027preserve_on_delete\u0027] or something similar?\n\nI am thinking about this code here:\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L2213\n\nIf thats the case, I am wondering why this fails to work as expected:\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L1212","commit_id":"88ca491c14341005aa6b22b73e46fe8b9e16ea79"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"5af8def863812ac89e751ad73ec3dd5b44855379","unresolved":false,"context_lines":[{"line_number":5096,"context_line":"            try:"},{"line_number":5097,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5098,"context_line":"                    context, instance, port_id,"},{"line_number":5099,"context_line":"                    preexisting_port\u003dpreexisting_port)"},{"line_number":5100,"context_line":"            except Exception:"},{"line_number":5101,"context_line":"                LOG.warning(_LW(\"deallocate port %(port_id)s failed\"),"},{"line_number":5102,"context_line":"                             {\u0027port_id\u0027: port_id}, instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":4,"id":"7ffa3b31_3de05996","line":5099,"range":{"start_line":5099,"start_character":37,"end_line":5099,"end_character":53},"in_reply_to":"7ffa3b31_ae2203ff","updated":"2017-04-19 10:06:43.000000000","message":"Yeah, that was my reading of it too.\n\nI think we hold this lock during the update:\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/base_api.py#L248\n\nI don\u0027t think you can make the API touch the network_info cache, it sends network changed down to the compute node so we can hold the above lock, if I remember correctly.\n\nMore debug info would be helpful here I think.","commit_id":"88ca491c14341005aa6b22b73e46fe8b9e16ea79"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4491c46aca082e56c1e0f7f4219e7445588475c3","unresolved":false,"context_lines":[{"line_number":5096,"context_line":"            try:"},{"line_number":5097,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5098,"context_line":"                    context, instance, port_id,"},{"line_number":5099,"context_line":"                    preexisting_port\u003dpreexisting_port)"},{"line_number":5100,"context_line":"            except Exception:"},{"line_number":5101,"context_line":"                LOG.warning(_LW(\"deallocate port %(port_id)s failed\"),"},{"line_number":5102,"context_line":"                             {\u0027port_id\u0027: port_id}, instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":4,"id":"7ffa3b31_ae2203ff","line":5099,"range":{"start_line":5099,"start_character":37,"end_line":5099,"end_character":53},"in_reply_to":"7ffa3b31_fab9ede8","updated":"2017-04-18 19:06:34.000000000","message":"Yeah, and we should get pre-existing port IDs here:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L871\n\nWhich should just be a list of one for the attach case.\n\nAnd requests_and_created_ports should just be:\n\n[NetworkRequest(with portid set), None)] since we shouldn\u0027t have created a port.\n\nAnd if created_port_id is None, then we should add the port_id to preexisting_port_ids:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L982\n\nWe pass that all to get_instance_nw_info:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L885\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/base_api.py#L249\n\nwhich calls back down into _get_instance_nw_info to build the new nw info model:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L1285\n\nAnd the result of that should be stored in the nw info cache:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/base_api.py#L255\n\nwhich we should fetch again on deallocate in case of failure:\n\nhttps://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L2139\n\nCould we be stomping on that somewhere else, or racing? I\u0027m wondering if we have concurrent updates to the nw info cache somewhere and that\u0027s wiping out the update for the newly attached port.\n\nI don\u0027t really have a good reason for why that code isn\u0027t working. I\u0027d likely need to either write a functional test that uses a neutron fixture to store the info cache stuff, or recreate with a devstack setup that changes self.driver.attach_interface to fail so I can hit this and see what the cache looks like when we deallocate.\n\nUnless maybe Kevin knows why this isn\u0027t working.","commit_id":"88ca491c14341005aa6b22b73e46fe8b9e16ea79"}],"nova/network/base_api.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d743f46de2989d19676cbefbe714c36489d2d3b2","unresolved":false,"context_lines":[{"line_number":220,"context_line":""},{"line_number":221,"context_line":"        :param context: nova.context.RequestContext."},{"line_number":222,"context_line":"        :param instance: nova.objects.Instance."},{"line_number":223,"context_line":"        :param port_id: The id of the port to deallocation."},{"line_number":224,"context_line":"        :param preexisting_port: This can take one of three values with"},{"line_number":225,"context_line":"            specific semantics::"},{"line_number":226,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"dfeb2761_a5280134","line":223,"range":{"start_line":223,"start_character":46,"end_line":223,"end_character":58},"updated":"2017-04-03 03:21:11.000000000","message":"deallocate","commit_id":"e13b880fe86f7314e3448521266e4275a093fdc4"}]}
