File fix-ovs-agent-udev-race.patch of Package openstack-quantum

From e56d960f222ec5a3e4623603907e8c424d430010 Mon Sep 17 00:00:00 2001
From: Ralf Haferkamp <rhafer@suse.de>
Date: Thu, 29 Aug 2013 21:01:21 +0200
Subject: [PATCH] Avoid race with udev during ovs agent startup

After taking down the veth link between the physical bridge and the integration
bridge call udevadm settle to wait for any udev events to be completely
processed by the operating system before recreating the veth pair.

Some distributions (e.g. openSUSE) have udev rules installed by default that
call e.g. ifdown <interface> during the remove event. If that is processed
after the ovs agent already brought up the veth pair again the veth pair's
link will be down after the agent completed startup and networking will be
broken for all VM instances.

Change-Id: If45dea5f76796a53540a6a9a7dbcf001b095cf3d
Closes-Bug: #1218556
---
 quantum/plugins/openvswitch/agent/ovs_quantum_agent.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
index 6499fb2..8aab768 100644
--- a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
+++ b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
@@ -586,6 +586,10 @@ class OVSQuantumAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
             br.delete_port(phys_veth_name)
             if ip_lib.device_exists(int_veth_name, self.root_helper):
                 ip_lib.IPDevice(int_veth_name, self.root_helper).link.delete()
+                # Give udev a chance to process its rules here, to avoid
+                # race conditions between commands launched by udev rules
+                # and the subsequent call to ip_wrapper.add_veth
+                utils.execute(['/sbin/udevadm', 'settle'])
             int_veth, phys_veth = ip_wrapper.add_veth(int_veth_name,
                                                       phys_veth_name)
             self.int_ofports[physical_network] = self.int_br.add_port(int_veth)
-- 
1.8.1.4
openSUSE Build Service is sponsored by