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
This commit is contained in:
Nate Johnston 2019-01-04 10:28:01 -05:00 committed by Slawek Kaplonski
parent 284afcf24f
commit 65a2f86aaf
1 changed files with 1 additions and 1 deletions

View File

@ -99,7 +99,7 @@ class QoSPlugin(qos.QoSPluginBase):
if not qos_policy: if not qos_policy:
net = network_object.Network.get_object( net = network_object.Network.get_object(
context.get_admin_context(), id=port_res['network_id']) 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( qos_policy = policy_object.QosPolicy.get_network_policy(
context.get_admin_context(), net.id) context.get_admin_context(), net.id)