ovs: do not delete port if already exists

Change-Id: I0ab28bc38be1f72635afa97c2c4651cd1c2ab336
Closes-Bug: #1670628
This commit is contained in:
Sahid Orentino Ferdjaoui 2018-02-21 14:13:10 +01:00
parent 6adbaa4b42
commit dadc65c0fa
2 changed files with 2 additions and 4 deletions

View File

@ -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',

View File

@ -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',