]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ovs_lib: Fix a race between get_port_tag_dict and port removal
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Thu, 16 Apr 2015 04:39:55 +0000 (13:39 +0900)
committerYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Tue, 21 Apr 2015 01:16:02 +0000 (01:16 +0000)
get_port_tag_dict() gets a list of ports using get_port_name_list()
and then queries the db again for ports in the list.
It fails if some of ports disappeared in between.
This change fixes it by ignoring "not exist" errors in the later query.

Closes-Bug: #1444797
Change-Id: Ic54b644bb1d72a4664b70f124863d17805c26fff

neutron/agent/common/ovs_lib.py

index 3004bc99b583bef6c471abfa5d56f9feec910fcd..1576b15806c111d3697b41e9de74406bcb85a170 100644 (file)
@@ -388,7 +388,8 @@ class OVSBridge(BaseOVS):
 
         """
         port_names = self.get_port_name_list()
-        cmd = self.ovsdb.db_list('Port', port_names, columns=['name', 'tag'])
+        cmd = self.ovsdb.db_list('Port', port_names, columns=['name', 'tag'],
+                                 if_exists=True)
         results = cmd.execute(check_error=True)
         return {p['name']: p['tag'] for p in results}