Merge "Avoid race between activating vif and pod deletion"

This commit is contained in:
Zuul 2019-10-09 16:36:41 +00:00 committed by Gerrit Code Review
commit 08f4e2ca30

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutronclient.common import exceptions as n_exc
from oslo_cache import core as cache
from oslo_config import cfg as oslo_cfg
from oslo_log import log as logging
@ -134,8 +135,12 @@ class VIFHandler(k8s_base.ResourceEventHandler):
if vif.plugin == constants.KURYR_VIF_TYPE_SRIOV:
driver_utils.update_port_pci_info(pod, vif)
if not vif.active:
self._drv_vif_pool.activate_vif(pod, vif)
changed = True
try:
self._drv_vif_pool.activate_vif(pod, vif)
changed = True
except n_exc.PortNotFoundClient:
LOG.debug("Port not found, possibly already "
"deleted. No need to activate it")
finally:
if changed:
try: