Do not call linux_net.delete_net_dev on Windows
The current ovs unplug codepath for Windows triggers an OVSDB port delete command, which is applicable, and a linux netdev delete command, which is not. This changes the unplug logic to skip the delete step. Change-Id: Id7f81ae174d354e593d919813bdf7b3b97cbcd8b Closes-Bug: #1798051 Signed-off-by: Jan Gutter <jan.gutter@netronome.com>
This commit is contained in:
parent
330051a702
commit
c5fda08d40
@ -253,7 +253,8 @@ class OvsPlugin(plugin.PluginBase):
|
||||
|
||||
def _unplug_vif_windows(self, vif, instance_info):
|
||||
"""Remove port from OVS."""
|
||||
self.ovsdb.delete_ovs_vif_port(vif.network.bridge, vif.id)
|
||||
self.ovsdb.delete_ovs_vif_port(vif.network.bridge, vif.id,
|
||||
delete_netdev=False)
|
||||
|
||||
def _unplug_vf_passthrough(self, vif, instance_info):
|
||||
"""Remove port from OVS."""
|
||||
|
@ -131,6 +131,13 @@ class BaseOVSTest(testtools.TestCase):
|
||||
[mock.call('device', bridge='bridge', if_exists=True)])
|
||||
mock_delete_net_dev.assert_has_calls([mock.call('device')])
|
||||
|
||||
@mock.patch.object(linux_net, 'delete_net_dev')
|
||||
def test_delete_ovs_vif_port_no_delete_netdev(self, mock_delete_net_dev):
|
||||
self.br.delete_ovs_vif_port('bridge', 'device', delete_netdev=False)
|
||||
self.mock_del_port.assert_has_calls(
|
||||
[mock.call('device', bridge='bridge', if_exists=True)])
|
||||
mock_delete_net_dev.assert_not_called()
|
||||
|
||||
def test_ensure_ovs_bridge(self):
|
||||
self.br.ensure_ovs_bridge('bridge', constants.OVS_DATAPATH_SYSTEM)
|
||||
self.mock_add_br('bridge', may_exist=True,
|
||||
|
@ -278,7 +278,8 @@ class PluginTest(testtools.TestCase):
|
||||
mock_sys.platform = constants.PLATFORM_WIN32
|
||||
plugin = ovs.OvsPlugin.load(constants.PLUGIN_NAME)
|
||||
plugin.unplug(vif, self.instance)
|
||||
delete_ovs_vif_port.assert_called_once_with('br0', vif.id)
|
||||
delete_ovs_vif_port.assert_called_once_with('br0', vif.id,
|
||||
delete_netdev=False)
|
||||
|
||||
def test_unplug_ovs_windows(self):
|
||||
self._check_unplug_ovs_windows(self.vif_ovs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user