From ca11545e06fbe5f8ad0467c99c84d6a5bacbb895 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Tue, 30 Jun 2020 09:56:29 +0000 Subject: [PATCH] Avoid empty "vsctl" transactions The OVS DB "vsctl" implementation does not allow empty transactions. In [1], if qos and queue are None, this transaction won't have any operation. In "vsctl" implementation this will raise the following exception: Exit code: 1; Stdin: ; Stdout: ; Stderr: ovs-vsctl: missing command name (use --help for help) [1]https://review.opendev.org/#/c/738171/1/neutron/agent/common/ovs_lib.py@914 Change-Id: Iece42986b32e774018affbbbe83923ce73590d77 Closes-Bug: #1885695 --- neutron/agent/common/ovs_lib.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/neutron/agent/common/ovs_lib.py b/neutron/agent/common/ovs_lib.py index 75d2e624030..c7fd4a7b286 100644 --- a/neutron/agent/common/ovs_lib.py +++ b/neutron/agent/common/ovs_lib.py @@ -911,11 +911,12 @@ class OVSBridge(BaseOVS): 'qos').execute(check_error=False) qos = self.find_qos(port_name) queue = self.find_queue(port_name, QOS_DEFAULT_QUEUE) - with self.ovsdb.transaction(check_error=True) as txn: - if qos: - txn.add(self.ovsdb.db_destroy('QoS', qos['_uuid'])) - if queue: - txn.add(self.ovsdb.db_destroy('Queue', queue['_uuid'])) + if qos: + self.ovsdb.db_destroy('QoS', + qos['_uuid']).execute(check_error=True) + if queue: + self.ovsdb.db_destroy('Queue', + queue['_uuid']).execute(check_error=True) def set_controller_field(self, field, value): attr = [(field, value)]