Browse Source

Merge "[OVN]: Make _delete_port() more error-resilent" into stable/train

changes/28/733628/1
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
4dfc438d3a
2 changed files with 15 additions and 4 deletions
  1. +6
    -1
      networking_ovn/common/client_extensions/qos.py
  2. +9
    -3
      networking_ovn/common/ovn_client.py

+ 6
- 1
networking_ovn/common/client_extensions/qos.py View File

@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.

from ovsdbapp.backend.ovs_idl import idlutils

from neutron.db import models_v2
from neutron.db.qos import models as qos_db_model
from neutron.objects.qos import policy as qos_policy
@@ -167,7 +169,10 @@ class OVNClientQosExtension(object):
for ovn_rule in [self._ovn_qos_rule(direction, {}, port_id,
network_id, delete=True)
for direction in constants.VALID_DIRECTIONS]:
txn.add(self._driver._nb_idl.qos_del(**ovn_rule))
try:
txn.add(self._driver._nb_idl.qos_del(**ovn_rule))
except idlutils.RowNotFound:
continue

if not qos_policy_id:
return # If no QoS policy is defined, there are no QoS rules.


+ 9
- 3
networking_ovn/common/ovn_client.py View File

@@ -678,7 +678,11 @@ class OVNClient(object):
db_rev.bump_revision(port, ovn_const.TYPE_PORTS)

def _delete_port(self, port_id, port_object=None):
ovn_port = self._nb_idl.lookup('Logical_Switch_Port', port_id)
ovn_port = self._nb_idl.lookup(
'Logical_Switch_Port', port_id, default=None)
if ovn_port is None:
return

network_id = ovn_port.external_ids.get(
ovn_const.OVN_NETWORK_NAME_EXT_ID_KEY)

@@ -692,7 +696,8 @@ class OVNClient(object):
port_id, network_id))

if not self._nb_idl.is_port_groups_supported():
txn.add(self._nb_idl.delete_acl(network_id, port_id))
txn.add(self._nb_idl.delete_acl(
network_id, port_id, if_exists=True))

addresses = utils.sort_ips_by_version(
utils.get_ovn_port_addresses(ovn_port))
@@ -705,7 +710,8 @@ class OVNClient(object):
txn.add(self._nb_idl.update_address_set(
name=utils.ovn_addrset_name(sg_id, ip_version),
addrs_add=None,
addrs_remove=addr_list))
addrs_remove=addr_list,
if_exists=True))

p_object = ({'id': port_id, 'network_id': network_id}
if not port_object else port_object)


Loading…
Cancel
Save