Ejemplo n.º 1
0
    def plug_vhostuser_fp(self, instance, vif):
        """Create a fp netdevice interface with a vhostuser socket"""
        dev = self.get_vif_devname(vif)
        if linux_net.device_exists(dev):
            return

        ovs_plug = vif['details'].get(
                                network_model.VIF_DETAILS_VHOSTUSER_OVS_PLUG,
                                False)
        sockmode_qemu, sockpath = self._get_vhostuser_settings(vif)
        sockmode_port = 'client' if sockmode_qemu == 'server' else 'server'

        try:
            linux_net.create_fp_dev(dev, sockpath, sockmode_port)

            if ovs_plug:
                if vif.is_hybrid_plug_enabled():
                    self.plug_ovs_hybrid(instance, vif)
                    utils.execute('brctl', 'addif',
                                  self.get_br_name(vif['id']),
                                  dev, run_as_root=True)
                else:
                    iface_id = self.get_ovs_interfaceid(vif)
                    mtu = vif['network'].get_meta('mtu')
                    linux_net.create_ovs_vif_port(self.get_bridge_name(vif),
                                                  dev, iface_id,
                                                  vif['address'],
                                                  instance.uuid, mtu)
        except processutils.ProcessExecutionError:
            LOG.exception(_LE("Failed while plugging vif"), instance=instance)
Ejemplo n.º 2
0
    def plug_vhostuser_fp(self, instance, vif):
        """Create a fp netdevice interface with a vhostuser socket"""
        dev = self.get_vif_devname(vif)
        if linux_net.device_exists(dev):
            return

        ovs_plug = vif['details'].get(
            network_model.VIF_DETAILS_VHOSTUSER_OVS_PLUG, False)
        sockmode_qemu, sockpath = self._get_vhostuser_settings(vif)
        sockmode_port = 'client' if sockmode_qemu == 'server' else 'server'

        try:
            linux_net.create_fp_dev(dev, sockpath, sockmode_port)

            if ovs_plug:
                if vif.is_hybrid_plug_enabled():
                    self.plug_ovs_hybrid(instance, vif)
                    utils.execute('brctl',
                                  'addif',
                                  self.get_br_name(vif['id']),
                                  dev,
                                  run_as_root=True)
                else:
                    iface_id = self.get_ovs_interfaceid(vif)
                    mtu = vif['network'].get_meta('mtu')
                    linux_net.create_ovs_vif_port(self.get_bridge_name(vif),
                                                  dev, iface_id,
                                                  vif['address'],
                                                  instance.uuid, mtu)
        except processutils.ProcessExecutionError:
            LOG.exception(_LE("Failed while plugging vif"), instance=instance)
Ejemplo n.º 3
0
    def plug_vhostuser_fp(self, instance, vif):
        """Create a fp netdevice interface with a vhostuser socket"""
        dev = self.get_vif_devname(vif)
        if linux_net.device_exists(dev):
            return

        sockmode_qemu, sockpath = self._get_vhostuser_settings(vif)
        sockmode_port = 'client' if sockmode_qemu == 'server' else 'server'

        try:
            linux_net.create_fp_dev(dev, sockpath, sockmode_port)
        except processutils.ProcessExecutionError:
            LOG.exception(_LE("Failed while plugging vif"), instance=instance)
Ejemplo n.º 4
0
    def plug_vhostuser_fp(self, instance, vif):
        """Create a fp netdevice interface with a vhostuser socket"""
        dev = self.get_vif_devname(vif)
        if linux_net.device_exists(dev):
            return

        sockmode_qemu, sockpath = self._get_vhostuser_settings(vif)
        sockmode_port = 'client' if sockmode_qemu == 'server' else 'server'

        try:
            linux_net.create_fp_dev(dev, sockpath, sockmode_port)
        except processutils.ProcessExecutionError:
            LOG.exception(_LE("Failed while plugging vif"), instance=instance)