Ejemplo n.º 1
0
 def _set_config_VIFVHostUser(self, instance, vif, conf, host=None):
     designer.set_vif_host_backend_vhostuser_config(conf, vif.mode,
                                                    vif.path)
     if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
         LOG.debug('Queues are not a vhostuser supported feature.')
         conf.driver_name = None
         conf.vhost_queues = None
Ejemplo n.º 2
0
    def get_config(self, instance, vif, image_meta, inst_type, virt_type=None):
        try:
            conf = super(VRouterVIFDriver, self).get_config(instance, vif,
                                                        image_meta, inst_type)
        except TypeError:
            conf = super(VRouterVIFDriver, self).get_base_config(instance, vif,
                                             image_meta, inst_type, virt_type)
        dev = self.get_vif_devname(vif)
        if not virt_type:
            try:
                virt_type = cfg.CONF.libvirt.virt_type
            except cfg.NoSuchOptError:
                virt_type = cfg.CONF.libvirt_type

        if virt_type == 'lxc':
            # for lxc we need to pass a bridge to libvirt
            br_name = self._get_br_name(dev)
            designer.set_vif_host_backend_bridge_config(conf, br_name)
        else:
            if CONF.contrail.use_userspace_vhost:
                dev = path.join(CONF.contrail.userspace_vhost_socket_dir,
                                'uvh_vif_' + dev)
                designer.set_vif_host_backend_vhostuser_config(conf, 'client',
                        dev)
            else:
                designer.set_vif_host_backend_ethernet_config(conf, dev)
        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Ejemplo n.º 3
0
 def test_set_vif_host_backend_vhostuser_config(self):
     conf = config.LibvirtConfigGuestInterface()
     designer.set_vif_host_backend_vhostuser_config(conf, "fake-mode", "fake-path")
     self.assertEqual("vhostuser", conf.net_type)
     self.assertEqual("unix", conf.vhostuser_type)
     self.assertEqual("fake-mode", conf.vhostuser_mode)
     self.assertEqual("fake-path", conf.vhostuser_path)
Ejemplo n.º 4
0
Archivo: vif.py Proyecto: andymcc/nova
 def _set_config_VIFVHostUser(self, instance, vif, conf, host=None):
     designer.set_vif_host_backend_vhostuser_config(
         conf, vif.mode, vif.path)
     if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
         LOG.debug('Queues are not a vhostuser supported feature.')
         conf.driver_name = None
         conf.vhost_queues = None
Ejemplo n.º 5
0
 def test_set_vif_host_backend_vhostuser_config(self):
     conf = config.LibvirtConfigGuestInterface()
     designer.set_vif_host_backend_vhostuser_config(conf, 'fake-mode',
                                                    'fake-path')
     self.assertEqual('vhostuser', conf.net_type)
     self.assertEqual('unix', conf.vhostuser_type)
     self.assertEqual('fake-mode', conf.vhostuser_mode)
     self.assertEqual('fake-path', conf.vhostuser_path)
Ejemplo n.º 6
0
 def test_set_vif_host_backend_vhostuser_config(self):
     conf = config.LibvirtConfigGuestInterface()
     designer.set_vif_host_backend_vhostuser_config(conf, 'fake-mode',
                                                    'fake-path')
     self.assertEqual('vhostuser', conf.net_type)
     self.assertEqual('unix', conf.vhostuser_type)
     self.assertEqual('fake-mode', conf.vhostuser_mode)
     self.assertEqual('fake-path', conf.vhostuser_path)
Ejemplo n.º 7
0
    def _set_config_VIFVHostUser(self, instance, vif, conf, host=None):
        # TODO(sahid): We should never configure a driver backend for
        # vhostuser interface. Specifically override driver to use
        # None. This can be removed when get_base_config will be fixed
        # and rewrite to set the correct backend.
        conf.driver_name = None

        rx_queue_size, tx_queue_size = self._get_virtio_queue_sizes(host)
        designer.set_vif_host_backend_vhostuser_config(
            conf, vif.mode, vif.path, rx_queue_size, tx_queue_size)
Ejemplo n.º 8
0
 def test_set_vif_host_backend_vhostuser_config_rx_queue_size(self):
     conf = config.LibvirtConfigGuestInterface()
     designer.set_vif_host_backend_vhostuser_config(conf, 'fake-mode',
                                                    'fake-path', 512, None)
     self.assertEqual('vhostuser', conf.net_type)
     self.assertEqual('unix', conf.vhostuser_type)
     self.assertEqual('fake-mode', conf.vhostuser_mode)
     self.assertEqual('fake-path', conf.vhostuser_path)
     self.assertEqual(512, conf.vhost_rx_queue_size)
     self.assertIsNone(conf.vhost_tx_queue_size)
Ejemplo n.º 9
0
Archivo: vif.py Proyecto: YLTiny/nova
    def _set_config_VIFVHostUser(self, instance, vif, conf):
        # TODO(sahid): We should never configure a driver backend for
        # vhostuser interface. Specifically override driver to use
        # None. This can be removed when get_base_config will be fixed
        # and rewrite to set the correct backend.
        conf.driver_name = None

        designer.set_vif_host_backend_vhostuser_config(
            conf, vif.mode, vif.path, CONF.libvirt.rx_queue_size,
            CONF.libvirt.tx_queue_size)
Ejemplo n.º 10
0
 def test_set_vif_host_backend_vhostuser_config_rx_queue_size(self):
     conf = config.LibvirtConfigGuestInterface()
     designer.set_vif_host_backend_vhostuser_config(conf, 'fake-mode',
                                                    'fake-path', 512, None)
     self.assertEqual('vhostuser', conf.net_type)
     self.assertEqual('unix', conf.vhostuser_type)
     self.assertEqual('fake-mode', conf.vhostuser_mode)
     self.assertEqual('fake-path', conf.vhostuser_path)
     self.assertEqual(512, conf.vhost_rx_queue_size)
     self.assertIsNone(conf.vhost_tx_queue_size)
Ejemplo n.º 11
0
    def get_config_ovs_acc(self, instance, vif, image_meta, inst_type,
                           virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta, inst_type,
                                    virt_type)
        iface_id = self.get_ovs_interfaceid(vif)
        mode, sock_path = self._get_netronome_port_settings(iface_id)
        if mode and sock_path:
            designer.set_vif_host_backend_vhostuser_config(
                conf, mode, sock_path)

        return conf
Ejemplo n.º 12
0
 def get_config_vhostuser(self, instance, vif, image_meta,
                           inst_type, virt_type):
     conf = self.get_base_config(instance, vif, image_meta,
                                 inst_type, virt_type)
     vif_details = vif['details']
     mode = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_MODE,
                            'server')
     sock_path = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_SOCKET)
     if sock_path is None:
         raise exception.VifDetailsMissingVhostuserSockPath(
                                                     vif_id=vif['id'])
     designer.set_vif_host_backend_vhostuser_config(conf, mode, sock_path)
     return conf
Ejemplo n.º 13
0
 def get_config_vhostuser(self, instance, vif, image_meta,
                           inst_type, virt_type):
     conf = self.get_base_config(instance, vif, image_meta,
                                 inst_type, virt_type)
     vif_details = vif['details']
     mode = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_MODE,
                            'server')
     sock_path = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_SOCKET)
     if sock_path is None:
         raise exception.VifDetailsMissingVhostuserSockPath(
                                                     vif_id=vif['id'])
     designer.set_vif_host_backend_vhostuser_config(conf, mode, sock_path)
     return conf
Ejemplo n.º 14
0
    def _set_config_VIFVHostUser(self, instance, vif, conf, host=None):
        # TODO(sahid): We should never configure a driver backend for
        # vhostuser interface. Specifically override driver to use
        # None. This can be removed when get_base_config will be fixed
        # and rewrite to set the correct backend.
        conf.driver_name = None

        rx_queue_size, tx_queue_size = self._get_virtio_queue_sizes(host)
        designer.set_vif_host_backend_vhostuser_config(
            conf, vif.mode, vif.path, rx_queue_size, tx_queue_size)
        if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
            LOG.debug('Queues are not a vhostuser supported feature.')
            conf.vhost_queues = None
Ejemplo n.º 15
0
    def get_config_vhostuser(self, instance, vif, image_meta,
                            inst_type, virt_type):
        conf = self.get_base_config(instance, vif, image_meta,
                                    inst_type, virt_type)
        source_path = "/var/run/vhost-user/" + vif["devname"]
        designer.set_vif_host_backend_vhostuser_config(
            conf, source_path, source_mode="client" )

        designer.set_vif_bandwidth_config(conf, inst_type)

        designer.set_vif_profile_config(conf, vif['profile'])

        return conf
Ejemplo n.º 16
0
    def _set_config_VIFVHostUser(self, instance, vif, conf, host=None):
        # TODO(sahid): We should never configure a driver backend for
        # vhostuser interface. Specifically override driver to use
        # None. This can be removed when get_base_config will be fixed
        # and rewrite to set the correct backend.
        conf.driver_name = None

        rx_queue_size, tx_queue_size = self._get_virtio_queue_sizes(host)
        designer.set_vif_host_backend_vhostuser_config(
            conf, vif.mode, vif.path, rx_queue_size, tx_queue_size)
        if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
            LOG.debug('Queues are not a vhostuser supported feature.')
            conf.vhost_queues = None
Ejemplo n.º 17
0
    def get_config_vhostuser(self, instance, vif, image_meta, inst_type,
                             virt_type, host):
        conf = self.get_base_config(instance, vif['address'], image_meta,
                                    inst_type, virt_type, vif['vnic_type'])
        mode, sock_path = self._get_vhostuser_settings(vif)
        designer.set_vif_host_backend_vhostuser_config(conf, mode, sock_path)
        # (vladikr) Not setting up driver and queues for vhostuser
        # as queues are not supported in Libvirt until version 1.2.17
        if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
            LOG.debug('Queues are not a vhostuser supported feature.')
            conf.driver_name = None
            conf.vhost_queues = None

        return conf
Ejemplo n.º 18
0
    def get_config_vhostuser(self, instance, vif, image_meta,
                            inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta,
                                    inst_type, virt_type)
        mode, sock_path = self._get_vhostuser_settings(vif)
        designer.set_vif_host_backend_vhostuser_config(conf, mode, sock_path)
        # (vladikr) Not setting up driver and queues for vhostuser
        # as queues are not supported in Libvirt until version 1.2.17
        if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
            LOG.debug('Queues are not a vhostuser supported feature.')
            conf.driver_name = None
            conf.vhost_queues = None

        return conf
Ejemplo n.º 19
0
    def get_config_vrouter(self, instance, vif, image_meta,
                           inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta,
                                    inst_type, virt_type)
        dev = self.get_vif_devname(vif)

        if CONF.contrail.use_userspace_vhost:
            dev = path.join(CONF.contrail.userspace_vhost_socket_dir,
                            'uvh_vif_' + dev)
            designer.set_vif_host_backend_vhostuser_config(conf, 'client', dev)
        else:
            designer.set_vif_host_backend_ethernet_config(conf, dev)

        designer.set_vif_bandwidth_config(conf, inst_type)
        return conf
Ejemplo n.º 20
0
Archivo: vif.py Proyecto: Juniper/nova
    def get_config_vrouter(self, instance, vif, image_meta, inst_type,
                           virt_type, host):
        conf = self.get_base_config(instance, vif['address'], image_meta,
                                    inst_type, virt_type, vif['vnic_type'])
        dev = self.get_vif_devname(vif)

        if CONF.contrail.use_userspace_vhost:
            dev = path.join(CONF.contrail.userspace_vhost_socket_dir,
                            'uvh_vif_' + dev)
            designer.set_vif_host_backend_vhostuser_config(conf, 'client', dev)
        else:
            designer.set_vif_host_backend_ethernet_config(conf, dev, host)

        designer.set_vif_bandwidth_config(conf, inst_type)
        return conf
Ejemplo n.º 21
0
Archivo: vif.py Proyecto: isyippee/nova
    def get_config_vhostuser(self, instance, vif, image_meta, inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta, inst_type, virt_type)
        vif_details = vif["details"]
        mode = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_MODE, "server")
        sock_path = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_SOCKET)
        if sock_path is None:
            raise exception.VifDetailsMissingVhostuserSockPath(vif_id=vif["id"])
        designer.set_vif_host_backend_vhostuser_config(conf, mode, sock_path)
        # (vladikr) Not setting up driver and queues for vhostuser
        # as queues are not supported in Libvirt until version 1.2.17
        if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
            LOG.debug("Queues are not a vhostuser supported feature.")
            conf.driver_name = None
            conf.vhost_queues = None

        return conf
Ejemplo n.º 22
0
    def get_config_vhostuser(self, instance, vif, image_meta,
                            inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif['address'], image_meta,
                                    inst_type, virt_type, vif['vnic_type'],
                                    host)
        # TODO(sahid): We should never configure a driver backend for
        # vhostuser interface. Specifically override driver to use
        # None. This can be removed when get_base_config will be fixed
        # and rewrite to set the correct backend.
        conf.driver_name = None

        mode, sock_path = self._get_vhostuser_settings(vif)
        rx_queue_size, tx_queue_size = self._get_virtio_queue_sizes(host)
        designer.set_vif_host_backend_vhostuser_config(
            conf, mode, sock_path, rx_queue_size, tx_queue_size)

        return conf
Ejemplo n.º 23
0
    def get_config_vhostuser(self, instance, vif, image_meta, inst_type,
                             virt_type, host):
        conf = self.get_base_config(instance, vif['address'], image_meta,
                                    inst_type, virt_type, vif['vnic_type'],
                                    host)
        # TODO(sahid): We should never configure a driver backend for
        # vhostuser interface. Specifically override driver to use
        # None. This can be removed when get_base_config will be fixed
        # and rewrite to set the correct backend.
        conf.driver_name = None

        mode, sock_path = self._get_vhostuser_settings(vif)
        rx_queue_size, tx_queue_size = self._get_virtio_queue_sizes(host)
        designer.set_vif_host_backend_vhostuser_config(conf, mode, sock_path,
                                                       rx_queue_size,
                                                       tx_queue_size)

        return conf
Ejemplo n.º 24
0
    def get_config_vhostuser(self, instance, vif, image_meta, inst_type,
                             virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta, inst_type,
                                    virt_type)
        vif_details = vif['details']
        mode = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_MODE,
                               'server')
        sock_path = vif_details.get(network_model.VIF_DETAILS_VHOSTUSER_SOCKET)
        if sock_path is None:
            raise exception.VifDetailsMissingVhostuserSockPath(
                vif_id=vif['id'])
        designer.set_vif_host_backend_vhostuser_config(conf, mode, sock_path)
        # (vladikr) Not setting up driver and queues for vhostuser
        # as queues are not supported in Libvirt until version 1.2.17
        if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
            LOG.debug('Queues are not a vhostuser supported feature.')
            conf.driver_name = None
            conf.vhost_queues = None

        return conf
Ejemplo n.º 25
0
    def get_config_vhostuser(self, instance, vif, image_meta,
                            inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif['address'], image_meta,
                                    inst_type, virt_type, vif['vnic_type'],
                                    host)
        # TODO(sahid): We should never configure a driver backend for
        # vhostuser interface. Specifically override driver to use
        # None. This can be removed when get_base_config will be fixed
        # and rewrite to set the correct backend.
        conf.driver_name = None

        mode, sock_path = self._get_vhostuser_settings(vif)
        rx_queue_size, tx_queue_size = self._get_virtio_queue_sizes(host)
        designer.set_vif_host_backend_vhostuser_config(
            conf, mode, sock_path, rx_queue_size, tx_queue_size)

        # (vladikr) Not setting up driver and queues for vhostuser
        # as queues are not supported in Libvirt until version 1.2.17
        if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
            LOG.debug('Queues are not a vhostuser supported feature.')
            conf.vhost_queues = None

        return conf
Ejemplo n.º 26
0
    def get_config_vhostuser(self, instance, vif, image_meta,
                            inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif['address'], image_meta,
                                    inst_type, virt_type, vif['vnic_type'],
                                    host)
        # TODO(sahid): We should never configure a driver backend for
        # vhostuser interface. Specifically override driver to use
        # None. This can be removed when get_base_config will be fixed
        # and rewrite to set the correct backend.
        conf.driver_name = None

        mode, sock_path = self._get_vhostuser_settings(vif)
        rx_queue_size, tx_queue_size = self._get_virtio_queue_sizes(host)
        designer.set_vif_host_backend_vhostuser_config(
            conf, mode, sock_path, rx_queue_size, tx_queue_size)

        # (vladikr) Not setting up driver and queues for vhostuser
        # as queues are not supported in Libvirt until version 1.2.17
        if not host.has_min_version(MIN_LIBVIRT_VHOSTUSER_MQ):
            LOG.debug('Queues are not a vhostuser supported feature.')
            conf.vhost_queues = None

        return conf