Browse Source

Merge "[OVS] Make QoS OVS agent deletion operations more resilient" into stable/ussuri

changes/14/738214/1
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
2483242525
2 changed files with 7 additions and 8 deletions
  1. +5
    -7
      neutron/agent/common/ovs_lib.py
  2. +2
    -1
      neutron/tests/unit/agent/common/test_ovs_lib.py

+ 5
- 7
neutron/agent/common/ovs_lib.py View File

@@ -715,8 +715,8 @@ class OVSBridge(BaseOVS):
self.set_controller_field('inactivity_probe', interval * 1000)

def _set_egress_bw_limit_for_port(self, port_name, max_kbps,
max_burst_kbps):
with self.ovsdb.transaction(check_error=True) as txn:
max_burst_kbps, check_error=True):
with self.ovsdb.transaction(check_error=check_error) as txn:
txn.add(self.ovsdb.db_set('Interface', port_name,
('ingress_policing_rate', max_kbps)))
txn.add(self.ovsdb.db_set('Interface', port_name,
@@ -743,8 +743,7 @@ class OVSBridge(BaseOVS):
def delete_egress_bw_limit_for_port(self, port_name):
if not self.port_exists(port_name):
return
self._set_egress_bw_limit_for_port(
port_name, 0, 0)
self._set_egress_bw_limit_for_port(port_name, 0, 0, check_error=False)

def find_qos(self, port_name):
qos = self.ovsdb.db_find(
@@ -915,12 +914,11 @@ class OVSBridge(BaseOVS):
return max_kbps, max_burst_kbit

def delete_ingress_bw_limit_for_port(self, port_name):
self.ovsdb.db_clear('Port', port_name,
'qos').execute(check_error=False)
qos = self.find_qos(port_name)
queue = self.find_queue(port_name, QOS_DEFAULT_QUEUE)
does_port_exist = self.port_exists(port_name)
with self.ovsdb.transaction(check_error=True) as txn:
if does_port_exist:
txn.add(self.ovsdb.db_clear("Port", port_name, 'qos'))
if qos:
txn.add(self.ovsdb.db_destroy('QoS', qos['_uuid']))
if queue:


+ 2
- 1
neutron/tests/unit/agent/common/test_ovs_lib.py View File

@@ -471,7 +471,8 @@ class OVS_Lib_Test(base.BaseTestCase):
) as port_exists_mock:
self.br.delete_egress_bw_limit_for_port("test_port")
port_exists_mock.assert_called_once_with("test_port")
set_egress_mock.assert_called_once_with("test_port", 0, 0)
set_egress_mock.assert_called_once_with("test_port", 0, 0,
check_error=False)

def test_delete_egress_bw_limit_for_port_port_not_exists(self):
with mock.patch.object(


Loading…
Cancel
Save