From dadc65c0fae857020f75c8180f159f72cd66c7bd Mon Sep 17 00:00:00 2001 From: Sahid Orentino Ferdjaoui Date: Wed, 21 Feb 2018 14:13:10 +0100 Subject: [PATCH] ovs: do not delete port if already exists Change-Id: I0ab28bc38be1f72635afa97c2c4651cd1c2ab336 Closes-Bug: #1670628 --- vif_plug_ovs/linux_net.py | 3 +-- vif_plug_ovs/tests/unit/test_linux_net.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/vif_plug_ovs/linux_net.py b/vif_plug_ovs/linux_net.py index a2e13e3a..4d2f82cd 100644 --- a/vif_plug_ovs/linux_net.py +++ b/vif_plug_ovs/linux_net.py @@ -65,8 +65,7 @@ def _ovs_vsctl(args, timeout=None): def _create_ovs_vif_cmd(bridge, dev, iface_id, mac, instance_id, interface_type=None, vhost_server_path=None): - cmd = ['--', '--if-exists', 'del-port', dev, '--', - 'add-port', bridge, dev, + cmd = ['--', '--may-exist', 'add-port', bridge, dev, '--', 'set', 'Interface', dev, 'external-ids:iface-id=%s' % iface_id, 'external-ids:iface-status=active', diff --git a/vif_plug_ovs/tests/unit/test_linux_net.py b/vif_plug_ovs/tests/unit/test_linux_net.py index 7e85969c..8ab9ed3d 100644 --- a/vif_plug_ovs/tests/unit/test_linux_net.py +++ b/vif_plug_ovs/tests/unit/test_linux_net.py @@ -132,8 +132,7 @@ class LinuxNetTest(testtools.TestCase): mock.call('brctl', 'addif', 'br0', 'vnet1')]) def test_ovs_vif_port_cmd(self): - expected = ['--', '--if-exists', - 'del-port', 'fake-dev', '--', 'add-port', + expected = ['--', '--may-exist', 'add-port', 'fake-bridge', 'fake-dev', '--', 'set', 'Interface', 'fake-dev', 'external-ids:iface-id=fake-iface-id',