def _plug_bridge(self, vif, instance_info): """Plug using hybrid strategy Create a per-VIF linux bridge, then link that bridge to the OVS integration bridge via a veth device, setting up the other end of the veth device just like a normal OVS port. Then boot the VIF on the linux bridge using standard libvirt mechanisms. """ v1_name, v2_name = self.get_veth_pair_names(vif) linux_net.ensure_bridge(vif.bridge_name) mtu = self._get_mtu(vif) if not linux_net.device_exists(v2_name): linux_net.create_veth_pair(v1_name, v2_name, mtu) linux_net.add_bridge_port(vif.bridge_name, v1_name) linux_net.ensure_ovs_bridge(vif.network.bridge, self._get_vif_datapath_type(vif), timeout=self.config.ovs_vsctl_timeout, ovsdb_connection=self.config.ovsdb_connection) self._create_vif_port(vif, v2_name, instance_info) else: linux_net.update_veth_pair(v1_name, v2_name, mtu) self._update_vif_port(vif, v2_name)
def test_add_bridge_port(self, mock_execute): linux_net.add_bridge_port("br0", "vnet1") self.assertEqual(mock_execute.mock_calls, [ mock.call('ip', 'link', 'set', 'br0', 'up'), mock.call('brctl', 'addif', 'br0', 'vnet1'), ])
def _plug_bridge(self, vif, instance_info): """Plug using hybrid strategy Create a per-VIF linux bridge, then link that bridge to the OVS integration bridge via a veth device, setting up the other end of the veth device just like a normal OVS port. Then boot the VIF on the linux bridge using standard libvirt mechanisms. """ v1_name, v2_name = self.get_veth_pair_names(vif) linux_net.ensure_bridge(vif.bridge_name) if not linux_net.device_exists(v2_name): linux_net.create_veth_pair(v1_name, v2_name, self.config.network_device_mtu) linux_net.add_bridge_port(vif.bridge_name, v1_name) linux_net.ensure_ovs_bridge(vif.network.bridge, constants.OVS_DATAPATH_SYSTEM) self._create_vif_port(vif, v2_name, instance_info)
def _plug_bridge(self, vif, instance_info): """Plug using hybrid strategy Create a per-VIF linux bridge, then link that bridge to the OVS integration bridge via a veth device, setting up the other end of the veth device just like a normal OVS port. Then boot the VIF on the linux bridge using standard libvirt mechanisms. """ v1_name, v2_name = self.get_veth_pair_names(vif) linux_net.ensure_bridge(vif.bridge_name) if not linux_net.device_exists(v2_name): if vif.network and vif.network.mtu: mtu = vif.network.mtu else: mtu = self.config.network_device_mtu linux_net.create_veth_pair(v1_name, v2_name, mtu) linux_net.add_bridge_port(vif.bridge_name, v1_name) linux_net.ensure_ovs_bridge(vif.network.bridge, constants.OVS_DATAPATH_SYSTEM) self._create_vif_port(vif, v2_name, instance_info)
def test_add_bridge_port(self, mock_set): linux_net.add_bridge_port("br0", "vnet1") mock_set.assert_called_once_with("vnet1", master="br0")
def test_add_bridge_port(self, mock_execute): linux_net.add_bridge_port("br0", "vnet1") mock_execute.assert_has_calls( [mock.call('brctl', 'addif', 'br0', 'vnet1')])