)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"eeb58f3fd3177f70d592691d8bd0bbf2d3d65f67","unresolved":false,"context_lines":[{"line_number":12,"context_line":"bad judgement of the who created the port by"},{"line_number":13,"context_line":"reading instance.info_cache(the record may"},{"line_number":14,"context_line":"not be updated yet). The same problem would"},{"line_number":15,"context_line":"appear when detach a neutron port quickly"},{"line_number":16,"context_line":"before the info_cache got updated."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"This patch fixed it by simply using data"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5a74a57a_67250d5b","line":15,"range":{"start_line":15,"start_character":21,"end_line":15,"end_character":28},"updated":"2016-11-30 12:45:18.000000000","message":"so this is not fixable ?or next patch?","commit_id":"d014c53ca67d02760a8092e4dc8ac220702c7743"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"585e4f50c28bbdbb2b9ea255f71fa4a7db45277c","unresolved":false,"context_lines":[{"line_number":12,"context_line":"bad judgement of the who created the port by"},{"line_number":13,"context_line":"reading instance.info_cache(the record may"},{"line_number":14,"context_line":"not be updated yet). The same problem would"},{"line_number":15,"context_line":"appear when detach a neutron port quickly"},{"line_number":16,"context_line":"before the info_cache got updated."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"This patch fixed it by simply using data"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5a74a57a_7476783f","line":15,"range":{"start_line":15,"start_character":21,"end_line":15,"end_character":28},"in_reply_to":"5a74a57a_67250d5b","updated":"2016-12-01 01:24:24.000000000","message":"actually I didn\u0027t test quick enough about this one, I will remove this case.","commit_id":"d014c53ca67d02760a8092e4dc8ac220702c7743"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"eeb58f3fd3177f70d592691d8bd0bbf2d3d65f67","unresolved":false,"context_lines":[{"line_number":17,"context_line":""},{"line_number":18,"context_line":"This patch fixed it by simply using data"},{"line_number":19,"context_line":"from virtual_interface table to judge the"},{"line_number":20,"context_line":"creater of the port."},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"Change-Id: Ib323b74d4ea1e874b476ab5addfc6bc79cb7c751"},{"line_number":23,"context_line":"closes-bug: #1645175"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5a74a57a_872a292b","line":20,"range":{"start_line":20,"start_character":19,"end_line":20,"end_character":20},"updated":"2016-11-30 12:45:18.000000000","message":"this is incorrect","commit_id":"d014c53ca67d02760a8092e4dc8ac220702c7743"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"585e4f50c28bbdbb2b9ea255f71fa4a7db45277c","unresolved":false,"context_lines":[{"line_number":17,"context_line":""},{"line_number":18,"context_line":"This patch fixed it by simply using data"},{"line_number":19,"context_line":"from virtual_interface table to judge the"},{"line_number":20,"context_line":"creater of the port."},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"Change-Id: Ib323b74d4ea1e874b476ab5addfc6bc79cb7c751"},{"line_number":23,"context_line":"closes-bug: #1645175"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5a74a57a_f498c86c","line":20,"range":{"start_line":20,"start_character":19,"end_line":20,"end_character":20},"in_reply_to":"5a74a57a_872a292b","updated":"2016-12-01 01:24:24.000000000","message":"Ah, yes thanks","commit_id":"d014c53ca67d02760a8092e4dc8ac220702c7743"},{"author":{"_account_id":18603,"name":"Béla Vancsics","email":"vancsics@inf.u-szeged.hu","username":"vancsics"},"change_message_id":"2d8e8293f8371d49c48144668193ef025425d7ea","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Don\u0027t delete neutron port when attach failed"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently, when attaching netron pre-existing"},{"line_number":10,"context_line":"port to an instance, if the attach failed, it"},{"line_number":11,"context_line":"will also be deleted in Neutron side due to"},{"line_number":12,"context_line":"bad judgement of the who created the port by"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":16,"id":"5a3905b3_1c66c550","line":9,"range":{"start_line":9,"start_character":26,"end_line":9,"end_character":32},"updated":"2017-01-24 08:40:41.000000000","message":"Neutron :)","commit_id":"7e132df82bd27e940ca303836ec12570de12de70"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"43b51f5603ca10b085f7c4e4d8a01f595274da89","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Don\u0027t delete neutron port when attach failed"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently, when attaching netron pre-existing"},{"line_number":10,"context_line":"port to an instance, if the attach failed, it"},{"line_number":11,"context_line":"will also be deleted in Neutron side due to"},{"line_number":12,"context_line":"bad judgement of the who created the port by"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":23,"id":"ba2be162_c26ae3b2","line":9,"range":{"start_line":9,"start_character":26,"end_line":9,"end_character":32},"updated":"2017-03-02 19:00:05.000000000","message":"neutron","commit_id":"58c1143af3fb77690d87f9a9c63ad6a5e2e14346"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"36893d7d33e95b26c12361f130f03e2c3cb66d47","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Don\u0027t delete neutron port when attach failed"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Currently, when attaching netron pre-existing"},{"line_number":10,"context_line":"port to an instance, if the attach failed, it"},{"line_number":11,"context_line":"will also be deleted in Neutron side due to"},{"line_number":12,"context_line":"bad judgement of the who created the port by"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":24,"id":"9a30ddce_c2846c0c","line":9,"range":{"start_line":9,"start_character":26,"end_line":9,"end_character":32},"updated":"2017-03-10 16:14:38.000000000","message":"neutron","commit_id":"1a016e2f923fe97343adcfbe28c2dbfdd7dad9ab"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"85c66e54a0a41bedf5d6f7411a848d09b60f94d1","unresolved":false,"context_lines":[{"line_number":12,"context_line":"bad judgement of the who created the port by"},{"line_number":13,"context_line":"ready not up-to-date info_cache."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This patch fixed it by updating instance_info_cache with"},{"line_number":16,"context_line":"the network_info in the process."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Co-Authored-By: huangtianhua@huawei.com"},{"line_number":19,"context_line":"Change-Id: Ib323b74d4ea1e874b476ab5addfc6bc79cb7c751"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":31,"id":"5f201791_039fed50","line":16,"range":{"start_line":15,"start_character":0,"end_line":16,"end_character":32},"updated":"2017-06-20 21:12:50.000000000","message":"You\u0027re not really updating the instance info cache anymore in the latest patch set. This was more accurate as of PS29.","commit_id":"39fe613e817f8eed4c25ebf9d2ba93cbd30bb28f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4ec646dc6e73f0c088e34056804a124b34ab1555","unresolved":false,"context_lines":[{"line_number":19,"context_line":"to an instance and it calls"},{"line_number":20,"context_line":"https://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/base_api.py#L246"},{"line_number":21,"context_line":"which calls back into the neutronv2 api code"},{"line_number":22,"context_line":"https://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L1274"},{"line_number":23,"context_line":"and at this point, compute_utils.refresh_info_cache_for_instance(context,"},{"line_number":24,"context_line":"instance) won\u0027t have the newly attached port in it(see"},{"line_number":25,"context_line":"debug log: http://paste.openstack.org/show/613232/)"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":35,"id":"5f201791_56bfc9fa","line":22,"updated":"2017-06-21 16:08:34.000000000","message":"nit: we could use shortened paths like:\n\nhttps://github.com/openstack/nova/blob/9ed0d6114/nova/network/neutronv2/api.py#L1274","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"16596cd53f76a3a37a61dbbac53259dbedb80466","unresolved":false,"context_lines":[{"line_number":19,"context_line":"to an instance and it calls"},{"line_number":20,"context_line":"https://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/base_api.py#L246"},{"line_number":21,"context_line":"which calls back into the neutronv2 api code"},{"line_number":22,"context_line":"https://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L1274"},{"line_number":23,"context_line":"and at this point, compute_utils.refresh_info_cache_for_instance(context,"},{"line_number":24,"context_line":"instance) won\u0027t have the newly attached port in it(see"},{"line_number":25,"context_line":"debug log: http://paste.openstack.org/show/613232/)"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":35,"id":"5f201791_daf76af5","line":22,"in_reply_to":"5f201791_56bfc9fa","updated":"2017-06-22 06:42:18.000000000","message":"Done","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4ec646dc6e73f0c088e34056804a124b34ab1555","unresolved":false,"context_lines":[{"line_number":22,"context_line":"https://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L1274"},{"line_number":23,"context_line":"and at this point, compute_utils.refresh_info_cache_for_instance(context,"},{"line_number":24,"context_line":"instance) won\u0027t have the newly attached port in it(see"},{"line_number":25,"context_line":"debug log: http://paste.openstack.org/show/613232/)"},{"line_number":26,"context_line":"because _build_network_info_model() is going to"},{"line_number":27,"context_line":"process it. The instance obj in memoryt with old"},{"line_number":28,"context_line":"info_cache will be used at rollback process and"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":35,"id":"5f201791_7694058c","line":25,"range":{"start_line":25,"start_character":10,"end_line":25,"end_character":50},"updated":"2017-06-21 16:08:34.000000000","message":"This shows 93ebadb0-2cf4-4218-95c0-fb510c3ce6c4 in the network model dump, but I\u0027m assuming that is the existing port on the server that was created when the server was created and is \"owned\" by nova.","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"16596cd53f76a3a37a61dbbac53259dbedb80466","unresolved":false,"context_lines":[{"line_number":22,"context_line":"https://github.com/openstack/nova/blob/9ed0d611453aee7a27debd773bdbe146510be0ad/nova/network/neutronv2/api.py#L1274"},{"line_number":23,"context_line":"and at this point, compute_utils.refresh_info_cache_for_instance(context,"},{"line_number":24,"context_line":"instance) won\u0027t have the newly attached port in it(see"},{"line_number":25,"context_line":"debug log: http://paste.openstack.org/show/613232/)"},{"line_number":26,"context_line":"because _build_network_info_model() is going to"},{"line_number":27,"context_line":"process it. The instance obj in memoryt with old"},{"line_number":28,"context_line":"info_cache will be used at rollback process and"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":35,"id":"5f201791_1a3cc291","line":25,"range":{"start_line":25,"start_character":10,"end_line":25,"end_character":50},"in_reply_to":"5f201791_7694058c","updated":"2017-06-22 06:42:18.000000000","message":"Yeah, I will add more log to show that I\u0027m trying to adding another port","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"2df37ca7d4f49142a97533ebfc39a8761bb272c7","unresolved":false,"context_lines":[{"line_number":12,"context_line":"bad judgement of the who created the port by"},{"line_number":13,"context_line":"reading not up-to-date info_cache."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"The workflow starts at:"},{"line_number":16,"context_line":"https://github.com/openstack/nova/blob/9ed0d6114/nova/network/neutronv2/api.py#L881"},{"line_number":17,"context_line":"ordered_ports and preexisting_port_ids are"},{"line_number":18,"context_line":"the same when attaching a preexisting port"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":39,"id":"5f201791_8f3569ab","line":15,"range":{"start_line":15,"start_character":0,"end_line":15,"end_character":23},"updated":"2017-06-29 04:19:01.000000000","message":"very nicely explained.","commit_id":"82b89b6599cee1e8549a5530d1729e7f613c0f7f"},{"author":{"_account_id":15334,"name":"Stephen Finucane","display_name":"stephenfin","email":"stephenfin@redhat.com","username":"sfinucan"},"change_message_id":"5f11dadd06b9c21200486b3c4ac72731e5cbabf1","unresolved":false,"context_lines":[{"line_number":13,"context_line":"reading not up-to-date info_cache."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"The workflow starts at:"},{"line_number":16,"context_line":"https://github.com/openstack/nova/blob/9ed0d6114/nova/network/neutronv2/api.py#L881"},{"line_number":17,"context_line":"ordered_ports and preexisting_port_ids are"},{"line_number":18,"context_line":"the same when attaching a preexisting port"},{"line_number":19,"context_line":"to an instance and it calls"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":40,"id":"3f1d235d_689e1255","line":16,"range":{"start_line":16,"start_character":39,"end_line":16,"end_character":48},"updated":"2017-07-04 08:26:24.000000000","message":"thanks for using commit IDs so this continues to be relevant going forward","commit_id":"115cf068a6d48cdf8b0d20a3c5a779bb8120aa9b"}],"doc/notification_samples/instance-shutdown-end.json":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4ec646dc6e73f0c088e34056804a124b34ab1555","unresolved":false,"context_lines":[{"line_number":11,"context_line":"            \"fault\":null,"},{"line_number":12,"context_line":"            \"host\":\"compute\","},{"line_number":13,"context_line":"            \"host_name\":\"some-server\","},{"line_number":14,"context_line":"            \"ip_addresses\": [],"},{"line_number":15,"context_line":"            \"kernel_id\":\"\","},{"line_number":16,"context_line":"            \"launched_at\":\"2012-10-29T13:42:11Z\","},{"line_number":17,"context_line":"            \"image_uuid\": \"155d900f-4e14-4e4c-a73d-069cbf4541e6\","}],"source_content_type":"application/json","patch_set":35,"id":"5f201791_566d8996","line":14,"updated":"2017-06-21 16:08:34.000000000","message":"Why did this change? Did we wipe out the info cache?","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c861ff6384b39a3218b24a7265a9d8f3b029c1e5","unresolved":false,"context_lines":[{"line_number":11,"context_line":"            \"fault\":null,"},{"line_number":12,"context_line":"            \"host\":\"compute\","},{"line_number":13,"context_line":"            \"host_name\":\"some-server\","},{"line_number":14,"context_line":"            \"ip_addresses\": [],"},{"line_number":15,"context_line":"            \"kernel_id\":\"\","},{"line_number":16,"context_line":"            \"launched_at\":\"2012-10-29T13:42:11Z\","},{"line_number":17,"context_line":"            \"image_uuid\": \"155d900f-4e14-4e4c-a73d-069cbf4541e6\","}],"source_content_type":"application/json","patch_set":35,"id":"5f201791_569229f8","line":14,"in_reply_to":"5f201791_566d8996","updated":"2017-06-21 16:29:53.000000000","message":"So this is sent from here:\n\nhttps://github.com/openstack/nova/blob/96e07267fe6ff6f3ea32586bbbe386019cc8b75a/nova/compute/manager.py#L2329\n\nAnd the versioned notification code is going to load the network_info from the instance:\n\nhttps://github.com/openstack/nova/blob/96e07267fe6ff6f3ea32586bbbe386019cc8b75a/nova/notifications/objects/instance.py#L98\n\nAnd the instance info cache is now empty because of the change you made, because _shutdown_instance eventually calls this:\n\nhttps://github.com/openstack/nova/blob/96e07267fe6ff6f3ea32586bbbe386019cc8b75a/nova/compute/manager.py#L1657\n\nWhich is going to call with the empty network info:\n\nhttps://github.com/openstack/nova/blob/96e07267fe6ff6f3ea32586bbbe386019cc8b75a/nova/network/neutronv2/api.py#L1194\n\nI see our options as:\n\n1. Do nothing and just accept that we don\u0027t provide network info in the notification when deleting an instance.\n\n2. Temporarily set the saved network_info on the instance when sending the notification.\n\n3. Pass a flag through to update_instance_cache_with_nw_info to tell it if it should update the instance.info_cache. This one would be messy since we\u0027d have to pass that flag down through all of the methods between _shutdown_instance and deallocate_for_instance, so I wouldn\u0027t want to do this one.\n\nWhich leaves options 1 or 2.","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"988b4f004f771f96fd22fff45077402f72fe7a88","unresolved":false,"context_lines":[{"line_number":11,"context_line":"            \"fault\":null,"},{"line_number":12,"context_line":"            \"host\":\"compute\","},{"line_number":13,"context_line":"            \"host_name\":\"some-server\","},{"line_number":14,"context_line":"            \"ip_addresses\": [],"},{"line_number":15,"context_line":"            \"kernel_id\":\"\","},{"line_number":16,"context_line":"            \"launched_at\":\"2012-10-29T13:42:11Z\","},{"line_number":17,"context_line":"            \"image_uuid\": \"155d900f-4e14-4e4c-a73d-069cbf4541e6\","}],"source_content_type":"application/json","patch_set":35,"id":"5f201791_71abefd5","line":14,"in_reply_to":"5f201791_569229f8","updated":"2017-06-21 16:32:25.000000000","message":"\u003e 1. Do nothing and just accept that we don\u0027t provide network info in the notification when deleting an instance.\n\nThat\u0027s not quite accurate. The instance.shutdown.start notification will have the network info, just not instance.shutdown.end.","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"16596cd53f76a3a37a61dbbac53259dbedb80466","unresolved":false,"context_lines":[{"line_number":11,"context_line":"            \"fault\":null,"},{"line_number":12,"context_line":"            \"host\":\"compute\","},{"line_number":13,"context_line":"            \"host_name\":\"some-server\","},{"line_number":14,"context_line":"            \"ip_addresses\": [],"},{"line_number":15,"context_line":"            \"kernel_id\":\"\","},{"line_number":16,"context_line":"            \"launched_at\":\"2012-10-29T13:42:11Z\","},{"line_number":17,"context_line":"            \"image_uuid\": \"155d900f-4e14-4e4c-a73d-069cbf4541e6\","}],"source_content_type":"application/json","patch_set":35,"id":"5f201791_fadc6647","line":14,"in_reply_to":"5f201791_71abefd5","updated":"2017-06-22 06:42:18.000000000","message":"I like option 1, as we deallocated the interface, maybe it is correct that the info_cache is empty. But I\u0027m OK for wider discussion on this.","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"6edb87f5420842bea1f5887662ca3c2f8914f6f2","unresolved":false,"context_lines":[{"line_number":11,"context_line":"            \"fault\":null,"},{"line_number":12,"context_line":"            \"host\":\"compute\","},{"line_number":13,"context_line":"            \"host_name\":\"some-server\","},{"line_number":14,"context_line":"            \"ip_addresses\": [],"},{"line_number":15,"context_line":"            \"kernel_id\":\"\","},{"line_number":16,"context_line":"            \"launched_at\":\"2012-10-29T13:42:11Z\","},{"line_number":17,"context_line":"            \"image_uuid\": \"155d900f-4e14-4e4c-a73d-069cbf4541e6\","}],"source_content_type":"application/json","patch_set":35,"id":"5f201791_781dc60d","line":14,"in_reply_to":"5f201791_fadc6647","updated":"2017-06-23 18:45:26.000000000","message":"I\u0027m OK with option 1 as long as we document it with a release note, probably in the \"other\" section of the release notes since I don\u0027t want to scare people with this by putting it in the \"upgrade\" section.","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f689b419cb095c7ae211c640a9061329d72cace1","unresolved":false,"context_lines":[{"line_number":11,"context_line":"            \"fault\":null,"},{"line_number":12,"context_line":"            \"host\":\"compute\","},{"line_number":13,"context_line":"            \"host_name\":\"some-server\","},{"line_number":14,"context_line":"            \"ip_addresses\": [],"},{"line_number":15,"context_line":"            \"kernel_id\":\"\","},{"line_number":16,"context_line":"            \"launched_at\":\"2012-10-29T13:42:11Z\","},{"line_number":17,"context_line":"            \"image_uuid\": \"155d900f-4e14-4e4c-a73d-069cbf4541e6\","}],"source_content_type":"application/json","patch_set":38,"id":"5f201791_b8aebe95","line":14,"updated":"2017-06-23 18:48:25.000000000","message":"Let\u0027s add a release note for this to let people know that the ``instance.shutdown.end`` versioned notification will now have an empty ``ip_addresses`` field since the network resources associated with the instance are deallocated before this notification is sent, which is actually more accurate. Consumers should rely on the instance.shutdown.start notification if they need the network information for the instance when it is being deleted.","commit_id":"266726490d32147c4b0d5e94b42c7846b80cf8fd"}],"nova/compute/manager.py":[{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"bcb1cf787f6168e91661eda09032e231589e420a","unresolved":false,"context_lines":[{"line_number":5093,"context_line":"        network_info \u003d self.network_api.allocate_port_for_instance("},{"line_number":5094,"context_line":"            context, instance, port_id, network_id, requested_ip,"},{"line_number":5095,"context_line":"            bind_host_id\u003dbind_host_id)"},{"line_number":5096,"context_line":"        instance.refresh()"},{"line_number":5097,"context_line":"        if len(network_info) !\u003d 1:"},{"line_number":5098,"context_line":"            LOG.error(_LE(\u0027allocate_port_for_instance returned %(ports)s \u0027"},{"line_number":5099,"context_line":"                          \u0027ports\u0027), {\u0027ports\u0027: len(network_info)})"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_ed60f2a6","line":5096,"updated":"2016-12-01 06:34:34.000000000","message":"there is refresh method in the \u0027InstanceInfoCache\u0027. so we needn\u0027t refresh the how instance object.","commit_id":"d8327c5fcd27c1fd5dbc2619046039ebae407425"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"bcb1cf787f6168e91661eda09032e231589e420a","unresolved":false,"context_lines":[{"line_number":5111,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5112,"context_line":"                     instance\u003dinstance)"},{"line_number":5113,"context_line":"            try:"},{"line_number":5114,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5115,"context_line":"                    context, instance, port_id)"},{"line_number":5116,"context_line":"            except Exception:"},{"line_number":5117,"context_line":"                LOG.warning(_LW(\"deallocate port %(port_id)s failed\"),"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_edd5521b","line":5114,"updated":"2016-12-01 06:34:34.000000000","message":"we can just refresh the info cache before this line.","commit_id":"d8327c5fcd27c1fd5dbc2619046039ebae407425"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"a32e93b95ad1f8afd8b1f83c87ee15a10c34e53f","unresolved":false,"context_lines":[{"line_number":5111,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5112,"context_line":"                     instance\u003dinstance)"},{"line_number":5113,"context_line":"            try:"},{"line_number":5114,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5115,"context_line":"                    context, instance, port_id)"},{"line_number":5116,"context_line":"            except Exception:"},{"line_number":5117,"context_line":"                LOG.warning(_LW(\"deallocate port %(port_id)s failed\"),"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a74a57a_cdb5f6d0","line":5114,"in_reply_to":"5a74a57a_edd5521b","updated":"2016-12-01 06:40:51.000000000","message":"Hmm, I will try","commit_id":"d8327c5fcd27c1fd5dbc2619046039ebae407425"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"09fd3d48affe42450836d14d8704c389933a6649","unresolved":false,"context_lines":[{"line_number":5094,"context_line":"        network_info \u003d self.network_api.allocate_port_for_instance("},{"line_number":5095,"context_line":"            context, instance, port_id, network_id, requested_ip,"},{"line_number":5096,"context_line":"            bind_host_id\u003dbind_host_id)"},{"line_number":5097,"context_line":"        instance.refresh()"},{"line_number":5098,"context_line":"        if len(network_info) !\u003d 1:"},{"line_number":5099,"context_line":"            LOG.error(_LE(\u0027allocate_port_for_instance returned %(ports)s \u0027"},{"line_number":5100,"context_line":"                          \u0027ports\u0027), {\u0027ports\u0027: len(network_info)})"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_bdf2036e","line":5097,"updated":"2016-12-01 08:59:07.000000000","message":"so we needn\u0027t this anymore?","commit_id":"180be1311e8948ecefee22ca1c3c317dc8370887"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"09fd3d48affe42450836d14d8704c389933a6649","unresolved":false,"context_lines":[{"line_number":5112,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5113,"context_line":"                     instance\u003dinstance)"},{"line_number":5114,"context_line":"            try:"},{"line_number":5115,"context_line":"                with lockutils.lock(\u0027refresh_cache-%s\u0027 % instance.uuid):"},{"line_number":5116,"context_line":"                    compute_utils.refresh_info_cache_for_instance(context, instance)"},{"line_number":5117,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5118,"context_line":"                    context, instance, port_id)"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a71b18c_082577aa","line":5115,"updated":"2016-12-01 08:59:07.000000000","message":"Emm...I don\u0027t think we need to lock at here.","commit_id":"180be1311e8948ecefee22ca1c3c317dc8370887"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"c50837b9305621045f209edc521d0978c206f3aa","unresolved":false,"context_lines":[{"line_number":5101,"context_line":"        image_meta \u003d objects.ImageMeta.from_instance(instance)"},{"line_number":5102,"context_line":""},{"line_number":5103,"context_line":"        try:"},{"line_number":5104,"context_line":"            self.driver.attach_interface(context, instance, image_meta,"},{"line_number":5105,"context_line":"                                         network_info[0])"},{"line_number":5106,"context_line":"        except exception.NovaException as ex:"},{"line_number":5107,"context_line":"            port_id \u003d network_info[0].get(\u0027id\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a71b18c_a01acf6c","side":"PARENT","line":5104,"updated":"2016-12-01 12:16:16.000000000","message":"So this method create or pick a port to attach it to the instance then does a full refresh of the network info cache related to the instance. But I can\u0027t really find the problem...","commit_id":"7b0db52b45fb06261dfe05bc043758d8373d12b9"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"cb03c8fcd7c686aaa1c7819be2a4ab56fb32a264","unresolved":false,"context_lines":[{"line_number":5111,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5112,"context_line":"                     instance\u003dinstance)"},{"line_number":5113,"context_line":"            try:"},{"line_number":5114,"context_line":"                compute_utils.refresh_info_cache_for_instance(context, instance)"},{"line_number":5115,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5116,"context_line":"                    context, instance, port_id)"},{"line_number":5117,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a71b18c_3468c5ba","line":5114,"updated":"2016-12-01 11:02:59.000000000","message":"I understand what you are doing but I don\u0027t think it\u0027s how we should fix this issue. We probably need to understand the root cause. How it\u0027s possible to be at this point with a invalid state to network_info ?","commit_id":"83c28811c4858935e3ab73a60eb9997b802953fe"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"8098c977ce2d196fad44738d2bd5a1f961009497","unresolved":false,"context_lines":[{"line_number":5110,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5111,"context_line":"                     instance\u003dinstance)"},{"line_number":5112,"context_line":"            try:"},{"line_number":5113,"context_line":"                compute_utils.refresh_info_cache_for_instance("},{"line_number":5114,"context_line":"                    context, instance)"},{"line_number":5115,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5116,"context_line":"                    context, instance, port_id)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_982903e9","line":5113,"updated":"2016-12-06 16:14:53.000000000","message":"I think I understand what yoy mean now so the reference of the instance running here is not the same as the one we have updated when calling allocate_port_for_instance().\n\nOk so your fix seems reasonable for me now. I would say if you have to respin, it would be nice to add comment here since that could be confusing when we know that allocate_port_for_instance is building a fresh cache.","commit_id":"20cd085effa94edfa20b278213018cdc8fcde8a2"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"69636ff5831b6e292ca323ed39565fe3a566bf76","unresolved":false,"context_lines":[{"line_number":5110,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5111,"context_line":"                     instance\u003dinstance)"},{"line_number":5112,"context_line":"            try:"},{"line_number":5113,"context_line":"                compute_utils.refresh_info_cache_for_instance("},{"line_number":5114,"context_line":"                    context, instance)"},{"line_number":5115,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5116,"context_line":"                    context, instance, port_id)"}],"source_content_type":"text/x-python","patch_set":9,"id":"da4df55a_6c917b52","line":5113,"in_reply_to":"3a71b18c_50e7e63f","updated":"2016-12-23 02:14:02.000000000","message":"Done","commit_id":"20cd085effa94edfa20b278213018cdc8fcde8a2"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"69636ff5831b6e292ca323ed39565fe3a566bf76","unresolved":false,"context_lines":[{"line_number":5110,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5111,"context_line":"                     instance\u003dinstance)"},{"line_number":5112,"context_line":"            try:"},{"line_number":5113,"context_line":"                compute_utils.refresh_info_cache_for_instance("},{"line_number":5114,"context_line":"                    context, instance)"},{"line_number":5115,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5116,"context_line":"                    context, instance, port_id)"}],"source_content_type":"text/x-python","patch_set":9,"id":"da4df55a_8ca05fa1","line":5113,"in_reply_to":"3a71b18c_982903e9","updated":"2016-12-23 02:14:02.000000000","message":"Done","commit_id":"20cd085effa94edfa20b278213018cdc8fcde8a2"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"2cab664e22a3e7de89a9b106dc9a64d6be704677","unresolved":false,"context_lines":[{"line_number":5110,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5111,"context_line":"                     instance\u003dinstance)"},{"line_number":5112,"context_line":"            try:"},{"line_number":5113,"context_line":"                compute_utils.refresh_info_cache_for_instance("},{"line_number":5114,"context_line":"                    context, instance)"},{"line_number":5115,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5116,"context_line":"                    context, instance, port_id)"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_50e7e63f","line":5113,"in_reply_to":"3a71b18c_982903e9","updated":"2016-12-08 10:09:34.000000000","message":"yeah, a comment make sense to avoid confusion","commit_id":"20cd085effa94edfa20b278213018cdc8fcde8a2"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"89d0e7236cc088707a0ad2245661ce9343e550f1","unresolved":false,"context_lines":[{"line_number":5133,"context_line":"                # The preserve_on_delete value of port in instance.info_cache"},{"line_number":5134,"context_line":"                # is used to judge whether the port should be deleted at"},{"line_number":5135,"context_line":"                # neutron side or not. The new info_cache for the port to be"},{"line_number":5136,"context_line":"                # attached is created in allocate_port_for_instance() but not"},{"line_number":5137,"context_line":"                # yet updated to instance obj, this will cause mis-judge in"},{"line_number":5138,"context_line":"                # the rollback process, need to update it before the"},{"line_number":5139,"context_line":"                # rollback."},{"line_number":5140,"context_line":"                compute_utils.refresh_info_cache_for_instance("}],"source_content_type":"text/x-python","patch_set":18,"id":"1a430d35_04d7aced","line":5137,"range":{"start_line":5136,"start_character":70,"end_line":5137,"end_character":45},"updated":"2017-02-07 06:39:41.000000000","message":"i did not completely understood this. So allocate_port_for_instance build new network info and update on instance info DB [1]\n\nand i think what instance object have is joined table to instance info one which was being updated @L5113.\n\n..1 https://github.com/openstack/nova/blob/4f91ed3a547965ed96a22520edcfb783e7936e95/nova/network/base_api.py#L255\n\nLet me know if m missing anything.","commit_id":"df441df0829339fb8cb26766832c1e31d63248a8"},{"author":{"_account_id":782,"name":"John Garbutt","email":"john@johngarbutt.com","username":"johngarbutt"},"change_message_id":"a27db757dabd1532cf9581c6ac8a4f074d9abc23","unresolved":false,"context_lines":[{"line_number":5137,"context_line":"                # yet updated to instance obj, this will cause mis-judge in"},{"line_number":5138,"context_line":"                # the rollback process, need to update it before the"},{"line_number":5139,"context_line":"                # rollback."},{"line_number":5140,"context_line":"                compute_utils.refresh_info_cache_for_instance("},{"line_number":5141,"context_line":"                    context, instance)"},{"line_number":5142,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5143,"context_line":"                    context, instance, port_id)"}],"source_content_type":"text/x-python","patch_set":18,"id":"1a430d35_95f6f15a","line":5140,"updated":"2017-02-09 12:11:40.000000000","message":"so this is really expensive, we make loads of calls to neutron to work out what is going on, all the same calls we made at the end of the allocate_port_for_instance method.\n\nI think what you want here is actually to call here:\nhttps://github.com/openstack/nova/blob/master/nova/network/base_api.py#L34\n\n    self.network_api.update_instance_cache_with_nw_info(\n        context, instance, network_info)\n\nI am a bit tempted to call that right after allocate_port_for_instance, but thats probably a bigger change than is needed, so calling it here makes sense to me.","commit_id":"df441df0829339fb8cb26766832c1e31d63248a8"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"578f4417d392f6aacc3e6edb87cdd8886926e7a3","unresolved":false,"context_lines":[{"line_number":5137,"context_line":"                # yet updated to instance obj, this will cause mis-judge in"},{"line_number":5138,"context_line":"                # the rollback process, need to update it before the"},{"line_number":5139,"context_line":"                # rollback."},{"line_number":5140,"context_line":"                compute_utils.refresh_info_cache_for_instance("},{"line_number":5141,"context_line":"                    context, instance)"},{"line_number":5142,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5143,"context_line":"                    context, instance, port_id)"}],"source_content_type":"text/x-python","patch_set":18,"id":"7f231b9d_10adfce9","line":5140,"in_reply_to":"1a430d35_8b709241","updated":"2017-06-19 21:19:43.000000000","message":"I\u0027m confused. refresh_info_cache_for_instance is just refreshing the instance object from the database for the instance.info_cache column, so a join with the instances_info_cache table. refresh_info_cache_for_instance doesn\u0027t make any calls to neutron.","commit_id":"df441df0829339fb8cb26766832c1e31d63248a8"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"88b41a319a57898fec022e5575c6106119d36270","unresolved":false,"context_lines":[{"line_number":5137,"context_line":"                # yet updated to instance obj, this will cause mis-judge in"},{"line_number":5138,"context_line":"                # the rollback process, need to update it before the"},{"line_number":5139,"context_line":"                # rollback."},{"line_number":5140,"context_line":"                compute_utils.refresh_info_cache_for_instance("},{"line_number":5141,"context_line":"                    context, instance)"},{"line_number":5142,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5143,"context_line":"                    context, instance, port_id)"}],"source_content_type":"text/x-python","patch_set":18,"id":"1a430d35_8b709241","line":5140,"in_reply_to":"1a430d35_95f6f15a","updated":"2017-02-09 12:42:46.000000000","message":"indeed, compute_utils.refresh_info_cache_for_instance will do an extra db call. This problem across my mind in last minute before I +2, but I still miss that.","commit_id":"df441df0829339fb8cb26766832c1e31d63248a8"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"64a64db089930a6b0c7e964a235cc770d6cd1142","unresolved":false,"context_lines":[{"line_number":5146,"context_line":""},{"line_number":5147,"context_line":"    @wrap_exception()"},{"line_number":5148,"context_line":"    @wrap_instance_fault"},{"line_number":5149,"context_line":"    def attach_interface(self, context, instance, network_id, port_id,"},{"line_number":5150,"context_line":"                         requested_ip):"},{"line_number":5151,"context_line":"        \"\"\"Use hotplug to add an network adapter to an instance.\"\"\""},{"line_number":5152,"context_line":"        if not self.driver.capabilities[\u0027supports_attach_interface\u0027]:"}],"source_content_type":"text/x-python","patch_set":29,"id":"dfeb2761_aec103e7","line":5149,"range":{"start_line":5149,"start_character":50,"end_line":5149,"end_character":69},"updated":"2017-04-03 00:37:40.000000000","message":"Looking at the REST API code for this, it\u0027s just like during server create and the following must be provided:\n\n1. network_id or\n2. port_id or\n3. requested_ip AND network_id\n\nIf network_id and port_id are specified, it\u0027s a failure:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/api/openstack/compute/attach_interfaces.py#n124\n\nIf port_id and requested_ip are specified, but network_id is not, it\u0027s a failure:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/api/openstack/compute/attach_interfaces.py#n127\n\nTherefore, we would know this is a pre-existing port if port_id is not None, right? deallocate_port_for_instance is only called when attach_interface or detach_interface fails. It has to see if the port is pre-existing for the detach case because we don\u0027t have context from the request, but when attach_interface fails and we call deallocate_port_for_instance we know it\u0027s a pre-existing port if port_id is not None. So I\u0027d say we should just modify deallocate_port_for_instance to pass a boolean telling it if it\u0027s a preexisting port or not and if so, we don\u0027t have to look it up. In fact, we shouldn\u0027t even be calling deallocate_port_for_instance is port_id is None, that\u0027s probably why we\u0027re catching Exception around it, for a None type error.","commit_id":"a139eb3146ae6da2a9ed5e7e1d02b7e1c8367838"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"47ba9064b804bb825a7d3a77d9380be36a012b68","unresolved":false,"context_lines":[{"line_number":5146,"context_line":""},{"line_number":5147,"context_line":"    @wrap_exception()"},{"line_number":5148,"context_line":"    @wrap_instance_fault"},{"line_number":5149,"context_line":"    def attach_interface(self, context, instance, network_id, port_id,"},{"line_number":5150,"context_line":"                         requested_ip):"},{"line_number":5151,"context_line":"        \"\"\"Use hotplug to add an network adapter to an instance.\"\"\""},{"line_number":5152,"context_line":"        if not self.driver.capabilities[\u0027supports_attach_interface\u0027]:"}],"source_content_type":"text/x-python","patch_set":29,"id":"dfeb2761_ce1a077c","line":5149,"range":{"start_line":5149,"start_character":50,"end_line":5149,"end_character":69},"in_reply_to":"dfeb2761_aec103e7","updated":"2017-04-03 00:54:08.000000000","message":"This is my alternative fix:\n\nhttps://review.openstack.org/#/c/452577/","commit_id":"a139eb3146ae6da2a9ed5e7e1d02b7e1c8367838"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"64a64db089930a6b0c7e964a235cc770d6cd1142","unresolved":false,"context_lines":[{"line_number":5173,"context_line":"                     {\u0027port_id\u0027: port_id, \u0027msg\u0027: ex},"},{"line_number":5174,"context_line":"                     instance\u003dinstance)"},{"line_number":5175,"context_line":"            try:"},{"line_number":5176,"context_line":"                # The preserve_on_delete value of port in instance.info_cache"},{"line_number":5177,"context_line":"                # is used to judge whether the port should be deleted at"},{"line_number":5178,"context_line":"                # neutron side or not. The new info_cache for the port to be"},{"line_number":5179,"context_line":"                # attached is created in allocate_port_for_instance() but not"},{"line_number":5180,"context_line":"                # yet updated to instance obj, this will cause mis-judge in"},{"line_number":5181,"context_line":"                # the rollback process, need to update it before the"},{"line_number":5182,"context_line":"                # rollback."},{"line_number":5183,"context_line":"                base_net_api.update_instance_cache_with_nw_info("},{"line_number":5184,"context_line":"                    self.network_api, context, instance, network_info)"},{"line_number":5185,"context_line":"                self.network_api.deallocate_port_for_instance("},{"line_number":5186,"context_line":"                    context, instance, port_id)"},{"line_number":5187,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":29,"id":"dfeb2761_0efeaf36","line":5184,"range":{"start_line":5176,"start_character":16,"end_line":5184,"end_character":70},"updated":"2017-04-03 00:37:40.000000000","message":"I don\u0027t like the compute manager needing to know the internals of how the neutron network API code works. Can\u0027t we do this as part of allocate_port_for_instance?\n\nAlso, just so I\u0027m clear on what this is doing, it works here because update_instance_cache_with_nw_info eventually calls back into the neutronv2.api.API._get_instance_nw_info method which calls _build_network_info_model and that\u0027s going to mark the vif as preserve_on_delete\u003dTrue, correct?","commit_id":"a139eb3146ae6da2a9ed5e7e1d02b7e1c8367838"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"85c66e54a0a41bedf5d6f7411a848d09b60f94d1","unresolved":false,"context_lines":[{"line_number":5170,"context_line":"                # instance.info_cache is used to judge whether the port"},{"line_number":5171,"context_line":"                # should be deleted at neutron side or not. The new"},{"line_number":5172,"context_line":"                # network_info for the port to be attached is created in"},{"line_number":5173,"context_line":"                # allocate_port_for_instance() but not yet updated to"},{"line_number":5174,"context_line":"                # DB, this will cause mis-judge in the rollback process,"},{"line_number":5175,"context_line":"                # need also take those into account when performing"},{"line_number":5176,"context_line":"                # rollback."},{"line_number":5177,"context_line":"                self.network_api.deallocate_port_for_instance("}],"source_content_type":"text/x-python","patch_set":31,"id":"5f201791_c39a156d","line":5174,"range":{"start_line":5173,"start_character":47,"end_line":5174,"end_character":20},"updated":"2017-06-20 21:12:50.000000000","message":"Looking at my notes from stepping through the code here:\n\nhttps://review.openstack.org/#/c/452577/4/nova/compute/manager.py@5099\n\nI\u0027m still not clear on where allocate_for_instance isn\u0027t updating the network info cache with the newly \"allocated\" port for the instance which is returned in the network_info list above.","commit_id":"39fe613e817f8eed4c25ebf9d2ba93cbd30bb28f"}],"nova/network/base_api.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"4ec646dc6e73f0c088e34056804a124b34ab1555","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        ic \u003d objects.InstanceInfoCache.new(context, instance.uuid)"},{"line_number":49,"context_line":"        ic.network_info \u003d nw_info"},{"line_number":50,"context_line":"        ic.save(update_cells\u003dupdate_cells)"},{"line_number":51,"context_line":"        instance.info_cache \u003d ic"},{"line_number":52,"context_line":"    except Exception:"},{"line_number":53,"context_line":"        with excutils.save_and_reraise_exception():"},{"line_number":54,"context_line":"            LOG.exception(_LE(\u0027Failed storing info cache\u0027), instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":35,"id":"5f201791_b613bd0d","line":51,"updated":"2017-06-21 16:08:34.000000000","message":"You should have a test for this.","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"16596cd53f76a3a37a61dbbac53259dbedb80466","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        ic \u003d objects.InstanceInfoCache.new(context, instance.uuid)"},{"line_number":49,"context_line":"        ic.network_info \u003d nw_info"},{"line_number":50,"context_line":"        ic.save(update_cells\u003dupdate_cells)"},{"line_number":51,"context_line":"        instance.info_cache \u003d ic"},{"line_number":52,"context_line":"    except Exception:"},{"line_number":53,"context_line":"        with excutils.save_and_reraise_exception():"},{"line_number":54,"context_line":"            LOG.exception(_LE(\u0027Failed storing info cache\u0027), instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":35,"id":"5f201791_7ac97676","line":51,"in_reply_to":"5f201791_b613bd0d","updated":"2017-06-22 06:42:18.000000000","message":"Sure, I was trying to found the place to add the test but disturbed by something, so I decide to upload first.","commit_id":"6917dfebf6e9ff19d192dc52e4261d808243c373"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"2df37ca7d4f49142a97533ebfc39a8761bb272c7","unresolved":false,"context_lines":[{"line_number":48,"context_line":"        ic \u003d objects.InstanceInfoCache.new(context, instance.uuid)"},{"line_number":49,"context_line":"        ic.network_info \u003d nw_info"},{"line_number":50,"context_line":"        ic.save(update_cells\u003dupdate_cells)"},{"line_number":51,"context_line":"        instance.info_cache \u003d ic"},{"line_number":52,"context_line":"    except Exception:"},{"line_number":53,"context_line":"        with excutils.save_and_reraise_exception():"},{"line_number":54,"context_line":"            LOG.exception(_LE(\u0027Failed storing info cache\u0027), instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":39,"id":"5f201791_ef6e1d95","line":51,"range":{"start_line":51,"start_character":0,"end_line":51,"end_character":32},"updated":"2017-06-29 04:19:01.000000000","message":"this answer to my query on PS18. Got it now.","commit_id":"82b89b6599cee1e8549a5530d1729e7f613c0f7f"}],"nova/network/neutronv2/api.py":[{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"c40eca66319693baae4a44104064783099af8cd5","unresolved":false,"context_lines":[{"line_number":1204,"context_line":"        Return network information for the instance"},{"line_number":1205,"context_line":"        \"\"\""},{"line_number":1206,"context_line":"        neutron \u003d get_client(context)"},{"line_number":1207,"context_line":"        preexisting_ports \u003d self._get_preexisting_port_ids(instance)"},{"line_number":1208,"context_line":"        if port_id in preexisting_ports:"},{"line_number":1209,"context_line":"            self._unbind_ports(context, [port_id], neutron)"},{"line_number":1210,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_0eb82d74","side":"PARENT","line":1207,"range":{"start_line":1207,"start_character":33,"end_line":1207,"end_character":58},"updated":"2016-11-29 13:02:13.000000000","message":"seems originally it\u0027s checking\n vif.get(\u0027preserve_on_delete\u0027)?\n\nseems we should check whether something wrong in _build_network_info_model function?","commit_id":"7b0db52b45fb06261dfe05bc043758d8373d12b9"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"58ab3ab77c526913b1418e59d304fc133f885356","unresolved":false,"context_lines":[{"line_number":1208,"context_line":"        # Delete the VirtualInterface for the given port_id."},{"line_number":1209,"context_line":"        vif \u003d objects.VirtualInterface.get_by_uuid(context, port_id)"},{"line_number":1210,"context_line":"        if vif:"},{"line_number":1211,"context_line":"            self._delete_ports(neutron, instance, [port_id],"},{"line_number":1212,"context_line":"                               raise_if_fail\u003dTrue)"},{"line_number":1213,"context_line":"            vif.destroy()"},{"line_number":1214,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5a74a57a_79944842","line":1211,"updated":"2016-11-28 13:16:42.000000000","message":"Why do you think that, to have a vif object is saying that the port has not been created by neutron ?","commit_id":"15710270bd0ffee95c984db87f865935f90eff06"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"85c66e54a0a41bedf5d6f7411a848d09b60f94d1","unresolved":false,"context_lines":[{"line_number":1214,"context_line":"        Return network information for the instance"},{"line_number":1215,"context_line":"        \"\"\""},{"line_number":1216,"context_line":"        neutron \u003d get_client(context)"},{"line_number":1217,"context_line":"        preexisting_ports \u003d self._get_preexisting_port_ids("},{"line_number":1218,"context_line":"            instance, additional_nw_info)"},{"line_number":1219,"context_line":"        if port_id in preexisting_ports:"},{"line_number":1220,"context_line":"            self._unbind_ports(context, [port_id], neutron)"},{"line_number":1221,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":31,"id":"5f201791_83d77d24","line":1218,"range":{"start_line":1217,"start_character":8,"end_line":1218,"end_character":41},"updated":"2017-06-20 21:12:50.000000000","message":"There are no unit test changes for this.","commit_id":"39fe613e817f8eed4c25ebf9d2ba93cbd30bb28f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"85c66e54a0a41bedf5d6f7411a848d09b60f94d1","unresolved":false,"context_lines":[{"line_number":2197,"context_line":"        deallocated upon instance deletion."},{"line_number":2198,"context_line":"        \"\"\""},{"line_number":2199,"context_line":"        net_info \u003d instance.get_network_info()"},{"line_number":2200,"context_line":"        if additional_nw_info:"},{"line_number":2201,"context_line":"            net_info \u003d net_info + additional_nw_info"},{"line_number":2202,"context_line":"        if not net_info:"},{"line_number":2203,"context_line":"            LOG.debug(\u0027Instance cache missing network info.\u0027,"}],"source_content_type":"text/x-python","patch_set":31,"id":"5f201791_43e165fe","line":2200,"updated":"2017-06-20 21:12:50.000000000","message":"You don\u0027t have a unit test for this.","commit_id":"39fe613e817f8eed4c25ebf9d2ba93cbd30bb28f"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"85c66e54a0a41bedf5d6f7411a848d09b60f94d1","unresolved":false,"context_lines":[{"line_number":2198,"context_line":"        \"\"\""},{"line_number":2199,"context_line":"        net_info \u003d instance.get_network_info()"},{"line_number":2200,"context_line":"        if additional_nw_info:"},{"line_number":2201,"context_line":"            net_info \u003d net_info + additional_nw_info"},{"line_number":2202,"context_line":"        if not net_info:"},{"line_number":2203,"context_line":"            LOG.debug(\u0027Instance cache missing network info.\u0027,"},{"line_number":2204,"context_line":"                      instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":31,"id":"5f201791_031ecd0b","line":2201,"range":{"start_line":2201,"start_character":23,"end_line":2201,"end_character":52},"updated":"2017-06-20 21:12:50.000000000","message":"What if there are conflicts in here? I guess if we had two vifs in here for the same port, and one said preserve on delete and the other didn\u0027t, then we wouldn\u0027t delete it, we\u0027d just unbind it, which is safest.","commit_id":"39fe613e817f8eed4c25ebf9d2ba93cbd30bb28f"}],"nova/tests/unit/compute/test_compute.py":[{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"2cab664e22a3e7de89a9b106dc9a64d6be704677","unresolved":false,"context_lines":[{"line_number":9419,"context_line":"                              \u0027deallocate_port_for_instance\u0027),"},{"line_number":9420,"context_line":"            mock.patch.dict(self.compute.driver.capabilities,"},{"line_number":9421,"context_line":"                            supports_attach_interface\u003dTrue),"},{"line_number":9422,"context_line":"            mock.patch.object(instance.info_cache, \u0027refresh\u0027)) as ("},{"line_number":9423,"context_line":"                mock_attach, mock_allocate, mock_deallocate, mock_dict,"},{"line_number":9424,"context_line":"                mock_refresh):"},{"line_number":9425,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_10f80e7c","line":9422,"range":{"start_line":9422,"start_character":12,"end_line":9422,"end_character":62},"updated":"2016-12-08 10:09:34.000000000","message":"maybe mock the util function so don\u0027t need call instance.info_cache and lead to issue","commit_id":"20cd085effa94edfa20b278213018cdc8fcde8a2"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"69636ff5831b6e292ca323ed39565fe3a566bf76","unresolved":false,"context_lines":[{"line_number":9419,"context_line":"                              \u0027deallocate_port_for_instance\u0027),"},{"line_number":9420,"context_line":"            mock.patch.dict(self.compute.driver.capabilities,"},{"line_number":9421,"context_line":"                            supports_attach_interface\u003dTrue),"},{"line_number":9422,"context_line":"            mock.patch.object(instance.info_cache, \u0027refresh\u0027)) as ("},{"line_number":9423,"context_line":"                mock_attach, mock_allocate, mock_deallocate, mock_dict,"},{"line_number":9424,"context_line":"                mock_refresh):"},{"line_number":9425,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"da4df55a_ac728347","line":9422,"range":{"start_line":9422,"start_character":12,"end_line":9422,"end_character":62},"in_reply_to":"3a71b18c_10f80e7c","updated":"2016-12-23 02:14:02.000000000","message":"Yeah thanks, I will try","commit_id":"20cd085effa94edfa20b278213018cdc8fcde8a2"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"8098c977ce2d196fad44738d2bd5a1f961009497","unresolved":false,"context_lines":[{"line_number":9421,"context_line":"                            supports_attach_interface\u003dTrue),"},{"line_number":9422,"context_line":"            mock.patch.object(instance.info_cache, \u0027refresh\u0027)) as ("},{"line_number":9423,"context_line":"                mock_attach, mock_allocate, mock_deallocate, mock_dict,"},{"line_number":9424,"context_line":"                mock_refresh):"},{"line_number":9425,"context_line":""},{"line_number":9426,"context_line":"            mock_allocate.return_value \u003d nwinfo"},{"line_number":9427,"context_line":"            mock_attach.side_effect \u003d exception.NovaException(\"attach_failed\")"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a71b18c_586ccb07","line":9424,"updated":"2016-12-06 16:14:53.000000000","message":"You need to assert that \u0027mock_refresh\u0027 has been called.","commit_id":"20cd085effa94edfa20b278213018cdc8fcde8a2"},{"author":{"_account_id":15888,"name":"Zhenyu Zheng","email":"zheng.zhenyu@outlook.com","username":"Kevin_Zheng"},"change_message_id":"37d1f43be517e0d1a2838e98c0b653c95899e2b8","unresolved":false,"context_lines":[{"line_number":9421,"context_line":"                            supports_attach_interface\u003dTrue),"},{"line_number":9422,"context_line":"            mock.patch.object(instance.info_cache, \u0027refresh\u0027)) as ("},{"line_number":9423,"context_line":"                mock_attach, mock_allocate, mock_deallocate, mock_dict,"},{"line_number":9424,"context_line":"                mock_refresh):"},{"line_number":9425,"context_line":""},{"line_number":9426,"context_line":"            mock_allocate.return_value \u003d nwinfo"},{"line_number":9427,"context_line":"            mock_attach.side_effect \u003d exception.NovaException(\"attach_failed\")"}],"source_content_type":"text/x-python","patch_set":9,"id":"da4df55a_0f7d416e","line":9424,"in_reply_to":"3a71b18c_586ccb07","updated":"2016-12-23 02:41:10.000000000","message":"Done","commit_id":"20cd085effa94edfa20b278213018cdc8fcde8a2"}],"nova/tests/unit/network/test_api.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"024843e63daa6c2d6fa2ad8e8f46727bb6bb5251","unresolved":false,"context_lines":[{"line_number":579,"context_line":"                                                                self.instance)"},{"line_number":580,"context_line":"        db_mock.assert_called_once_with(self.context, self.instance.uuid,"},{"line_number":581,"context_line":"                                        {\u0027network_info\u0027: self.nw_json})"},{"line_number":582,"context_line":"        self.assertEqual(fake_info_cache, self.instance.info_cache)"},{"line_number":583,"context_line":""},{"line_number":584,"context_line":"    def test_update_nw_info_one_network(self, db_mock, api_mock):"},{"line_number":585,"context_line":"        api_mock._get_instance_nw_info.return_value \u003d self.nw_info"}],"source_content_type":"text/x-python","patch_set":38,"id":"5f201791_1d654046","line":582,"range":{"start_line":582,"start_character":8,"end_line":582,"end_character":67},"updated":"2017-06-28 01:51:48.000000000","message":"I think we could just assert that self.instance.info_cache.network_info is equal to self.nw_info in this case.","commit_id":"266726490d32147c4b0d5e94b42c7846b80cf8fd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"024843e63daa6c2d6fa2ad8e8f46727bb6bb5251","unresolved":false,"context_lines":[{"line_number":588,"context_line":"        self.assertFalse(api_mock._get_instance_nw_info.called)"},{"line_number":589,"context_line":"        db_mock.assert_called_once_with(self.context, self.instance.uuid,"},{"line_number":590,"context_line":"                                        {\u0027network_info\u0027: self.nw_json})"},{"line_number":591,"context_line":"        self.assertEqual(fake_info_cache, self.instance.info_cache)"},{"line_number":592,"context_line":""},{"line_number":593,"context_line":"    def test_update_nw_info_empty_list(self, db_mock, api_mock):"},{"line_number":594,"context_line":"        api_mock._get_instance_nw_info.return_value \u003d self.nw_info"}],"source_content_type":"text/x-python","patch_set":38,"id":"5f201791_fd67244c","line":591,"updated":"2017-06-28 01:51:48.000000000","message":"same","commit_id":"266726490d32147c4b0d5e94b42c7846b80cf8fd"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"024843e63daa6c2d6fa2ad8e8f46727bb6bb5251","unresolved":false,"context_lines":[{"line_number":598,"context_line":"        self.assertFalse(api_mock._get_instance_nw_info.called)"},{"line_number":599,"context_line":"        db_mock.assert_called_once_with(self.context, self.instance.uuid,"},{"line_number":600,"context_line":"                                        {\u0027network_info\u0027: \u0027[]\u0027})"},{"line_number":601,"context_line":"        self.assertEqual(fake_info_cache, self.instance.info_cache)"},{"line_number":602,"context_line":""},{"line_number":603,"context_line":"    def test_decorator_return_object(self, db_mock, api_mock):"},{"line_number":604,"context_line":"        @base_api.refresh_cache"}],"source_content_type":"text/x-python","patch_set":38,"id":"5f201791_dd5a2881","line":601,"updated":"2017-06-28 01:51:48.000000000","message":"self.assertEqual(new_nw_info, self.instance.info_cache.network_info)","commit_id":"266726490d32147c4b0d5e94b42c7846b80cf8fd"}]}
