Exemple #1
0
    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)
Exemple #2
0
    def plug(self, instance, vif):
        """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.
        """
        iface_id = vif.ovs_interfaceid
        br_name = vif.br_name
        v1_name, v2_name = vif.veth_pair_names

        if not linux_net.device_exists(br_name):
            processutils.execute('brctl', 'addbr', br_name,
                                 run_as_root=True)
            processutils.execute('brctl', 'setfd', br_name, 0,
                                 run_as_root=True)
            processutils.execute('brctl', 'stp', br_name, 'off',
                                 run_as_root=True)
            syspath = '/sys/class/net/%s/bridge/multicast_snooping'
            syspath = syspath % br_name
            processutils.execute('tee', syspath, process_input='0',
                                 check_exit_code=[0, 1],
                                 run_as_root=True)

        if not linux_net.device_exists(v2_name):
            linux_net.create_veth_pair(v1_name, v2_name, self.network_device_mtu)
            processutils.execute('ip', 'link', 'set', br_name, 'up',
                                 run_as_root=True)
            processutils.execute('brctl', 'addif', br_name, v1_name,
                                 run_as_root=True)
            linux_net.create_ovs_vif_port(vif.bridge_name,
                                          v2_name, iface_id,
                                          vif.address, instance.uuid)
    def plug(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.
        """

        if not hasattr(vif, "port_profile"):
            raise exception.MissingPortProfile()
        if not isinstance(vif.port_profile,
                          objects.vif.VIFPortProfileOpenVSwitch):
            raise exception.WrongPortProfile(
                profile=vif.port_profile.__class__.__name__)

        v1_name, v2_name = self.get_veth_pair_names(vif)

        if not linux_net.device_exists(vif.bridge_name):
            processutils.execute('brctl', 'addbr', vif.bridge_name,
                                 run_as_root=True)
            processutils.execute('brctl', 'setfd', vif.bridge_name, 0,
                                 run_as_root=True)
            processutils.execute('brctl', 'stp', vif.bridge_name, 'off',
                                 run_as_root=True)
            syspath = '/sys/class/net/%s/bridge/multicast_snooping'
            syspath = syspath % vif.bridge_name
            processutils.execute('tee', syspath, process_input='0',
                                 check_exit_code=[0, 1],
                                 run_as_root=True)
            disv6 = ('/proc/sys/net/ipv6/conf/%s/disable_ipv6' %
                     vif.bridge_name)
            if os.path.exists(disv6):
                processutils.execute('tee',
                                     disv6,
                                     process_input='1',
                                     run_as_root=True,
                                     check_exit_code=[0, 1])

        if not linux_net.device_exists(v2_name):
            linux_net.create_veth_pair(v1_name, v2_name,
                                       self.config.network_device_mtu)
            processutils.execute('ip', 'link', 'set', vif.bridge_name, 'up',
                                 run_as_root=True)
            processutils.execute('brctl', 'addif', vif.bridge_name, v1_name,
                                 run_as_root=True)
            linux_net.create_ovs_vif_port(
                vif.network.bridge,
                v2_name,
                vif.port_profile.interface_id,
                vif.address, instance_info.uuid,
                self.config.network_device_mtu,
                timeout=self.config.ovs_vsctl_timeout)
Exemple #4
0
    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)
Exemple #5
0
    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)