Reviewed: https://review.openstack.org/403568 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=115cf068a6d48cdf8b0d20a3c5a779bb8120aa9b Submitter: Jenkins Branch: master
commit 115cf068a6d48cdf8b0d20a3c5a779bb8120aa9b Author: Kevin_Zheng <email address hidden> Date: Mon Nov 28 16:12:51 2016 +0800
Don't delete neutron port when attach failed
Currently, when attaching neutron pre-existing port to an instance, if the attach failed, it will also be deleted in Neutron side due to bad judgement of the who created the port by reading not up-to-date info_cache.
The workflow starts at: https://github.com/openstack/nova/blob/9ed0d6114/nova/network/neutronv2/api.py#L881 ordered_ports and preexisting_port_ids are the same when attaching a preexisting port to an instance and it calls https://github.com/openstack/nova/blob/9ed0d6114/nova/network/base_api.py#L246 which calls back into the neutronv2 api code https://github.com/openstack/nova/blob/9ed0d6114/nova/network/neutronv2/api.py#L1274 and at this point, compute_utils.refresh_info_cache_for_instance(context, instance) won't have the newly attached port in it(see debug log: http://paste.openstack.org/show/613232/) because _build_network_info_model() is going to process it. The instance obj in memoryt with old info_cache will be used at rollback process and causing the miss-judging.
This patch fixed it by updating instance.info_cache to the new ic after it is created.
Co-Authored-By: <email address hidden> Change-Id: Ib323b74d4ea1e874b476ab5addfc6bc79cb7c751 closes-bug: #1645175
Reviewed: https:/ /review. openstack. org/403568 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=115cf068a6d 48cdf8b0d20a3c5 a779bb8120aa9b
Committed: https:/
Submitter: Jenkins
Branch: master
commit 115cf068a6d48cd f8b0d20a3c5a779 bb8120aa9b
Author: Kevin_Zheng <email address hidden>
Date: Mon Nov 28 16:12:51 2016 +0800
Don't delete neutron port when attach failed
Currently, when attaching neutron pre-existing
port to an instance, if the attach failed, it
will also be deleted in Neutron side due to
bad judgement of the who created the port by
reading not up-to-date info_cache.
The workflow starts at: /github. com/openstack/ nova/blob/ 9ed0d6114/ nova/network/ neutronv2/ api.py# L881 port_ids are /github. com/openstack/ nova/blob/ 9ed0d6114/ nova/network/ base_api. py#L246 /github. com/openstack/ nova/blob/ 9ed0d6114/ nova/network/ neutronv2/ api.py# L1274 utils.refresh_ info_cache_ for_instance( context, paste.openstack .org/show/ 613232/) network_ info_model( ) is going to
https:/
ordered_ports and preexisting_
the same when attaching a preexisting port
to an instance and it calls
https:/
which calls back into the neutronv2 api code
https:/
and at this point, compute_
instance) won't have the newly attached port in it(see
debug log: http://
because _build_
process it. The instance obj in memoryt with old
info_cache will be used at rollback process and
causing the miss-judging.
This patch fixed it by updating instance.info_cache
to the new ic after it is created.
Co-Authored-By: <email address hidden> 74b476ab5addfc6 bc79cb7c751
Change-Id: Ib323b74d4ea1e8
closes-bug: #1645175