Browse Source

Merge "Fix handling no qos_queues while removing min bw limit rule"

Zuul 1 month ago
parent
commit
590002728d

+ 2
- 0
neutron/agent/common/ovs_lib.py View File

@@ -981,6 +981,8 @@ class OVSBridge(BaseOVS):
981 981
         queue_num = int(queue['external_ids']['queue-num'])
982 982
         self._unset_queue_for_minimum_bandwidth(queue_num)
983 983
         qos_id, qos_queues = self._find_qos()
984
+        if not qos_queues:
985
+            return
984 986
         if queue_num in qos_queues.keys():
985 987
             qos_queues.pop(queue_num)
986 988
             self._update_qos(

+ 13
- 0
neutron/tests/functional/agent/common/test_ovs_lib.py View File

@@ -387,6 +387,19 @@ class BaseOVSTestCase(base.BaseSudoTestCase):
387 387
         qos = self._list_qos(qos_id)
388 388
         self.assertEqual(0, len(qos['queues']))
389 389
 
390
+    def test_delete_minimum_bandwidth_queue_no_qos_found(self):
391
+        queue_id, neutron_port_id = self._create_queue(queue_num=1)
392
+        self.addCleanup(self.ovs._delete_queue, queue_id)
393
+
394
+        # Check that it will not raise any exception even if there is no
395
+        # qos with associated queues
396
+        self.ovs.delete_minimum_bandwidth_queue(neutron_port_id)
397
+
398
+        # And verify that this queue wasn't in fact deleted as there was no
399
+        # qos found
400
+        queue = self._list_queues(queue_id)
401
+        self.assertEqual(queue_id, queue['_uuid'])
402
+
390 403
     def test_clear_minimum_bandwidth_qos(self):
391 404
         queue_id_1, _ = self._create_queue(queue_num=1)
392 405
         queue_id_2, _ = self._create_queue(queue_num=2)

Loading…
Cancel
Save