From 65a2f86aafa7637ec07aa0a313ea0fae39758608 Mon Sep 17 00:00:00 2001 From: Nate Johnston Date: Fri, 4 Jan 2019 10:28:01 -0500 Subject: [PATCH] Gracefully handle fetch network fail in qos extend port When the qos plugin is handling a port resource request through it's port resource request extension, sometimes the network a port is attached to is looked up and returns None. It may happen like that if network will be deleted in concurrent API request. Change-Id: Ide4acdf4c373713968f9d43274fb0c7550283c11 Closes-Bug: #1810504 --- neutron/services/qos/qos_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/services/qos/qos_plugin.py b/neutron/services/qos/qos_plugin.py index d9bc59e9da4..4f48b37f319 100644 --- a/neutron/services/qos/qos_plugin.py +++ b/neutron/services/qos/qos_plugin.py @@ -99,7 +99,7 @@ class QoSPlugin(qos.QoSPluginBase): if not qos_policy: net = network_object.Network.get_object( context.get_admin_context(), id=port_res['network_id']) - if net.qos_policy_id: + if net and net.qos_policy_id: qos_policy = policy_object.QosPolicy.get_network_policy( context.get_admin_context(), net.id)