Exemple #1
0
    def get_config_bridge(self, instance, network, mapping, image_meta):
        """Get VIF configurations for bridge type."""
        conf = super(LibvirtGenericVIFDriver,
                     self).get_config(instance,
                                      network,
                                      mapping,
                                      image_meta)

        designer.set_vif_host_backend_bridge_config(
            conf, self.get_bridge_name(network),
            self.get_vif_devname(mapping))

        mac_id = mapping['mac'].replace(':', '')
        name = "nova-instance-" + instance['name'] + "-" + mac_id
        primary_addr = mapping['ips'][0]['ip']
        dhcp_server = ra_server = ipv4_cidr = ipv6_cidr = None

        if mapping['dhcp_server']:
            dhcp_server = mapping['dhcp_server']
        if CONF.use_ipv6:
            ra_server = mapping.get('gateway_v6') + "/128"
        if CONF.allow_same_net_traffic:
            ipv4_cidr = network['cidr']
            if CONF.use_ipv6:
                ipv6_cidr = network['cidr_v6']

        if self.get_firewall_required():
            designer.set_vif_host_backend_filter_config(
                conf, name, primary_addr, dhcp_server,
                ra_server, ipv4_cidr, ipv6_cidr)
        designer.set_vif_bandwidth_config(conf, instance)

        return conf
 def get_config(self, instance, vif, image_meta, inst_type):
     conf = super(VRouterVIFDriver, self).get_config(instance, vif, image_meta, inst_type)
     dev = self.get_vif_devname(vif)
     designer.set_vif_host_backend_ethernet_config(conf, dev)
     designer.set_vif_bandwidth_config(conf, inst_type)
 
     return conf
Exemple #3
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)
        designer.set_vif_host_backend_ethernet_config(conf, dev)

        designer.set_vif_bandwidth_config(conf, inst_type)
        return conf
Exemple #4
0
    def _get_config_os_vif(self, instance, vif, image_meta, inst_type,
                           virt_type, host, vnic_type):
        """Get the domain config for a VIF

        :param instance: nova.objects.Instance
        :param vif: os_vif.objects.vif.VIFBase subclass
        :param image_meta: nova.objects.ImageMeta
        :param inst_type: nova.objects.Flavor
        :param virt_type: virtualization type
        :param host: nova.virt.libvirt.host.Host
        :param vnic_type: vnic type

        :returns: nova.virt.libvirt.config.LibvirtConfigGuestInterface
        """

        # Do the config that's common to all vif types
        conf = self.get_base_config(instance, vif.address, image_meta,
                                    inst_type, virt_type, vnic_type)

        # Do the VIF type specific config
        viffunc = "_set_config_" + vif.obj_name()
        func = getattr(self, viffunc, None)
        if not func:
            raise exception.InternalError(
                _("Unsupported VIF type %(obj)s func %(func)s") %
                {'obj': vif.obj_name(), 'func': viffunc})
        func(instance, vif, conf, host)

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
    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
Exemple #6
0
    def get_config_macvtap(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']
        macvtap_src = vif_details.get(network_model.VIF_DETAILS_MACVTAP_SOURCE)
        macvtap_mode = vif_details.get(network_model.VIF_DETAILS_MACVTAP_MODE)
        phys_interface = vif_details.get(
                                    network_model.VIF_DETAILS_PHYS_INTERFACE)

        missing_params = []
        if macvtap_src is None:
            missing_params.append(network_model.VIF_DETAILS_MACVTAP_SOURCE)
        if macvtap_mode is None:
            missing_params.append(network_model.VIF_DETAILS_MACVTAP_MODE)
        if phys_interface is None:
            missing_params.append(network_model.VIF_DETAILS_PHYS_INTERFACE)

        if len(missing_params) > 0:
            raise exception.VifDetailsMissingMacvtapParameters(
                                                vif_id=vif['id'],
                                                missing_params=missing_params)

        designer.set_vif_host_backend_direct_config(
            conf, macvtap_src, macvtap_mode)

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
    def get_config(self, instance, vif, image_meta, inst_type):
        #conf = super(VRouterVIFDriver, self).get_config(instance, vif, image_meta, inst_type)
        conf = LibvirtBaseVIFDriver.get_config(self, instance, vif, image_meta, inst_type)
        dev = self.get_vif_devname(vif)
        br_name = self._get_br_name(dev)
        designer.set_vif_host_backend_bridge_config(conf, br_name)
        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #8
0
    def get_config_802qbh(self, instance, vif, image_meta, inst_type):
        conf = super(LibvirtGenericVIFDriver, self).get_config(instance, vif, image_meta, inst_type)

        params = vif["qbh_params"]
        designer.set_vif_host_backend_802qbh_config(conf, vif["network"].get_meta("interface"), params["profileid"])

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #9
0
    def get_config_mlnx_direct(self, instance, vif, image_meta, inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta, inst_type, virt_type)

        devname = self.get_vif_devname_with_prefix(vif, DEV_PREFIX_ETH)
        designer.set_vif_host_backend_direct_config(conf, devname)

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #10
0
    def get_config_mlnx_direct(self, instance, vif, image_meta, inst_type):
        conf = super(LibvirtGenericVIFDriver, self).get_config(instance, vif, image_meta, inst_type)

        devname = self.get_vif_devname_with_prefix(vif, DEV_PREFIX_ETH)
        designer.set_vif_host_backend_direct_config(conf, devname)

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #11
0
    def get_config_ovs_bridge(self, instance, vif, image_meta, inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta, inst_type, virt_type)

        designer.set_vif_host_backend_ovs_config(
            conf, self.get_bridge_name(vif), self.get_ovs_interfaceid(vif), self.get_vif_devname(vif)
        )

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #12
0
    def get_config_ovs_bridge(self, instance, vif, image_meta, inst_type):
        conf = super(LibvirtGenericVIFDriver, self).get_config(instance, vif, image_meta, inst_type)

        designer.set_vif_host_backend_ovs_config(
            conf, self.get_bridge_name(vif), self.get_ovs_interfaceid(vif), self.get_vif_devname(vif)
        )

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #13
0
    def get_config_iovisor(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)
        designer.set_vif_host_backend_ethernet_config(conf, dev, host)

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #14
0
    def test_set_vif_bandwidth_config_no_extra_specs(self):
        # Test whether test_set_vif_bandwidth_config_no_extra_specs fails when
        # its second parameter has no 'extra_specs' field.

        try:
            # The conf will never be user be used, so we can use 'None'.
            # An empty dictionary is fine: all that matters it that there is no
            # 'extra_specs' field.
            designer.set_vif_bandwidth_config(None, {})
        except KeyError as e:
            self.fail('KeyError: %s' % e)
Exemple #15
0
    def get_config_bridge(self, instance, network, mapping, image_meta):
        """Get VIF configurations for bridge type."""
        conf = super(LibvirtGenericVIFDriver, self).get_config(instance, network, mapping, image_meta)

        designer.set_vif_host_backend_bridge_config(conf, self.get_bridge_name(network), self.get_vif_devname(mapping))

        mac_id = mapping["mac"].replace(":", "")
        name = "nova-instance-" + instance["name"] + "-" + mac_id
        conf.filtername = name
        designer.set_vif_bandwidth_config(conf, instance)

        return conf
    def get_config(self, instance, vif, image_meta, inst_type):
        conf = super(VRouterVIFDriver, self).get_config(instance, vif,
                                                        image_meta, inst_type)
        dev = self.get_vif_devname(vif)
        if cfg.CONF.libvirt.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:
            designer.set_vif_host_backend_ethernet_config(conf, dev)
        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #17
0
    def get_config_bridge(self, instance, vif, image_meta, inst_type):
        """Get VIF configurations for bridge type."""
        conf = super(LibvirtGenericVIFDriver, self).get_config(instance, vif, image_meta, inst_type)

        designer.set_vif_host_backend_bridge_config(conf, self.get_bridge_name(vif), self.get_vif_devname(vif))

        mac_id = vif["address"].replace(":", "")
        name = "nova-instance-" + instance["name"] + "-" + mac_id
        if self.get_firewall_required():
            conf.filtername = name
        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #18
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
Exemple #19
0
    def get_config_802qbh(self, instance, vif, image_meta,
                          inst_type, virt_type):
        conf = self.get_base_config(instance, vif, image_meta,
                                    inst_type, virt_type)

        params = vif["qbh_params"]
        designer.set_vif_host_backend_802qbh_config(
            conf, vif['network'].get_meta('interface'),
            params['profileid'])

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #20
0
    def get_config_evs(self, instance, vif, image_meta,
                       inst_type, virt_type):
        conf = self.get_base_config(instance, vif, image_meta,
                                    inst_type, virt_type)

        bridge = vif['details'].get(EVS_BRIDGE,False)
        designer.set_vif_host_backend_ovs_config(
            conf, bridge,
            self.get_ovs_interfaceid(vif),
            self.get_vif_devname(vif))

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #21
0
    def get_config_hw_veb(self, instance, vif, image_meta,
                            inst_type, virt_type):
        conf = self.get_base_config(instance, vif, image_meta,
                                    inst_type, virt_type)

        profile = vif["profile"]
        vif_details = vif["details"]
        net_type = 'direct'
        if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
            net_type = 'hostdev'
        designer.set_vif_host_backend_hw_veb(
            conf, net_type, profile['pci_slot'],
            vif_details[network_model.VIF_DETAILS_VLAN])
        designer.set_vif_bandwidth_config(conf, inst_type)
        return conf
Exemple #22
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
Exemple #23
0
    def get_config_802qbg(self, instance, vif, image_meta,
                          inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta,
                                    inst_type, virt_type)

        params = vif["qbg_params"]
        designer.set_vif_host_backend_802qbg_config(
            conf, vif['network'].get_meta('interface'),
            params['managerid'],
            params['typeid'],
            params['typeidversion'],
            params['instanceid'])

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #24
0
    def get_config_802qbh(self, instance, vif, image_meta, inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta, inst_type, virt_type)

        profile = vif["profile"]
        vif_details = vif["details"]
        net_type = "direct"
        if vif["vnic_type"] == network_model.VNIC_TYPE_DIRECT:
            net_type = "hostdev"

        designer.set_vif_host_backend_802qbh_config(
            conf, net_type, profile["pci_slot"], vif_details[network_model.VIF_DETAILS_PROFILEID]
        )

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #25
0
    def get_config_802qbg(self, instance, vif, image_meta, inst_type, virt_type, host):
        conf = self.get_base_config(instance, vif, image_meta, inst_type, virt_type)

        params = vif["qbg_params"]
        designer.set_vif_host_backend_802qbg_config(
            conf,
            vif["network"].get_meta("interface"),
            params["managerid"],
            params["typeid"],
            params["typeidversion"],
            params["instanceid"],
        )

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #26
0
    def get_config_bridge(self, instance, vif, image_meta,
                          inst_type, virt_type):
        """Get VIF configurations for bridge type."""
        conf = self.get_base_config(instance, vif, image_meta,
                                    inst_type, virt_type)

        designer.set_vif_host_backend_bridge_config(
            conf, self.get_bridge_name(vif),
            self.get_vif_devname(vif))

        mac_id = vif['address'].replace(':', '')
        name = "nova-instance-" + instance.name + "-" + mac_id
        if self.get_firewall_required(vif):
            conf.filtername = name
        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #27
0
    def get_config_bridge(self, instance, vif, image_meta, inst_type,
                          virt_type):
        """Get VIF configurations for bridge type."""
        conf = super(LibvirtGenericVIFDriver,
                     self).get_config(instance, vif, image_meta, inst_type,
                                      virt_type)

        designer.set_vif_host_backend_bridge_config(conf,
                                                    self.get_bridge_name(vif),
                                                    self.get_vif_devname(vif))

        mac_id = vif['address'].replace(':', '')
        name = "nova-instance-" + instance['name'] + "-" + mac_id
        if self.get_firewall_required(vif):
            conf.filtername = name
        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #28
0
    def get_config_hw_veb(self, instance, vif, image_meta, inst_type,
                          virt_type):
        conf = self.get_base_config(instance, vif['address'], image_meta,
                                    inst_type, virt_type, vif['vnic_type'])

        profile = vif["profile"]
        vif_details = vif["details"]
        net_type = 'direct'
        if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
            net_type = 'hostdev'

        designer.set_vif_host_backend_hw_veb(
            conf, net_type, profile['pci_slot'],
            vif_details[network_model.VIF_DETAILS_VLAN])

        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #29
0
    def _get_config_os_vif(self, instance, vif, image_meta, inst_type,
                           virt_type, host, vnic_type):
        """Get the domain config for a VIF

        :param instance: nova.objects.Instance
        :param vif: os_vif.objects.vif.VIFBase subclass
        :param image_meta: nova.objects.ImageMeta
        :param inst_type: nova.objects.Flavor
        :param virt_type: virtualization type
        :param host: nova.virt.libvirt.host.Host
        :param vnic_type: vnic type

        :returns: nova.virt.libvirt.config.LibvirtConfigGuestInterface
        """

        # Do the config that's common to all vif types
        conf = self.get_base_config(instance, vif.address, image_meta,
                                    inst_type, virt_type, vnic_type, host)

        # Do the VIF type specific config
        if isinstance(vif, osv_vifs.VIFGeneric):
            self._set_config_VIFGeneric(instance, vif, conf, host)
        elif isinstance(vif, osv_vifs.VIFBridge):
            self._set_config_VIFBridge(instance, vif, conf, host)
        elif isinstance(vif, osv_vifs.VIFOpenVSwitch):
            self._set_config_VIFOpenVSwitch(instance, vif, conf, host)
        elif isinstance(vif, osv_vifs.VIFVHostUser):
            self._set_config_VIFVHostUser(instance, vif, conf, host)
        elif isinstance(vif, osv_vifs.VIFHostDevice):
            self._set_config_VIFHostDevice(instance, vif, conf, host)
        else:
            raise exception.InternalError(
                _("Unsupported VIF type %s") % vif.obj_name())

        # not all VIF types support bandwidth configuration
        # https://github.com/libvirt/libvirt/blob/568a41722/src/conf/netdev_bandwidth_conf.h#L38
        if vif.obj_name() not in ('VIFVHostUser', 'VIFHostDevice'):
            designer.set_vif_bandwidth_config(conf, inst_type)

        if ('network' in vif and 'mtu' in vif.network
                and self._has_min_version_for_mtu(host)):
            designer.set_vif_mtu_config(conf, vif.network.mtu)

        return conf
Exemple #30
0
    def get_config_bridge(self, instance, network, mapping, image_meta):
        """Get VIF configurations for bridge type."""
        conf = super(LibvirtGenericVIFDriver,
                     self).get_config(instance,
                                      network,
                                      mapping,
                                      image_meta)

        designer.set_vif_host_backend_bridge_config(
            conf, self.get_bridge_name(network),
            self.get_vif_devname(mapping))

        mac_id = mapping['mac'].replace(':', '')
        name = "nova-instance-" + instance['name'] + "-" + mac_id
        if self.get_firewall_required():
            conf.filtername = name
        designer.set_vif_bandwidth_config(conf, instance)

        return conf
Exemple #31
0
    def get_config_bridge(self, instance, vif, image_meta,
                          inst_type, virt_type, host):
        """Get VIF configurations for bridge type."""
        conf = self.get_base_config(instance, vif['address'], image_meta,
                                    inst_type, virt_type, vif['vnic_type'])

        designer.set_vif_host_backend_bridge_config(
            conf, self.get_bridge_name(vif),
            self.get_vif_devname(vif))

        mac_id = vif['address'].replace(':', '')
        name = "nova-instance-" + instance.name + "-" + mac_id
        if self.get_firewall_required(vif):
            conf.filtername = name
        designer.set_vif_bandwidth_config(conf, inst_type)

        self._set_mtu_config(vif, host, conf)

        return conf
Exemple #32
0
    def _get_config_os_vif(self, instance, vif, image_meta, inst_type,
                           virt_type, host, vnic_type):
        """Get the domain config for a VIF

        :param instance: nova.objects.Instance
        :param vif: os_vif.objects.vif.VIFBase subclass
        :param image_meta: nova.objects.ImageMeta
        :param inst_type: nova.objects.Flavor
        :param virt_type: virtualization type
        :param host: nova.virt.libvirt.host.Host
        :param vnic_type: vnic type

        :returns: nova.virt.libvirt.config.LibvirtConfigGuestInterface
        """

        # Do the config that's common to all vif types
        conf = self.get_base_config(instance, vif.address, image_meta,
                                    inst_type, virt_type, vnic_type,
                                    host)

        # Do the VIF type specific config
        viffunc = "_set_config_" + vif.obj_name()
        func = getattr(self, viffunc, None)
        if not func:
            raise exception.InternalError(
                _("Unsupported VIF type %(obj)s func %(func)s") %
                {'obj': vif.obj_name(), 'func': viffunc})
        func(instance, vif, conf, host)

        # not all VIF types support bandwidth configuration
        # https://github.com/libvirt/libvirt/blob/568a41722/src/conf/netdev_bandwidth_conf.h#L38
        if vif.obj_name() not in ('VIFVHostUser', 'VIFHostDevice'):
            designer.set_vif_bandwidth_config(conf, inst_type)

        if ('network' in vif and 'mtu' in vif.network and
                self._has_min_version_for_mtu(host)):
            designer.set_vif_mtu_config(conf, vif.network.mtu)

        return conf
Exemple #33
0
    def get_config_hw_veb(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'])

        profile = vif["profile"]
        vif_details = vif["details"]
        net_type = 'direct'
        if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
            net_type = 'hostdev'

        designer.set_vif_host_backend_hw_veb(
            conf, net_type, profile['pci_slot'],
            vif_details[network_model.VIF_DETAILS_VLAN])

        # NOTE(vladikr): Not setting vlan tags for macvtap on SR-IOV VFs
        # as vlan tag is not supported in Libvirt until version 1.3.5
        if (vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP and not
                host.has_min_version(MIN_LIBVIRT_MACVTAP_PASSTHROUGH_VLAN)):
            conf.vlan = None
        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #34
0
    def get_config_hw_veb(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'])

        profile = vif["profile"]
        vif_details = vif["details"]
        net_type = 'direct'
        if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
            net_type = 'hostdev'

        designer.set_vif_host_backend_hw_veb(
            conf, net_type, profile['pci_slot'],
            vif_details[network_model.VIF_DETAILS_VLAN])

        # NOTE(vladikr): Not setting vlan tags for macvtap on SR-IOV VFs
        # as vlan tag is not supported in Libvirt until version 1.3.5
        if (vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP and not
                host.has_min_version(MIN_LIBVIRT_MACVTAP_PASSTHROUGH_VLAN)):
            conf.vlan = None
        designer.set_vif_bandwidth_config(conf, inst_type)

        return conf
Exemple #35
0
    def _get_config_os_vif(self, instance, vif, image_meta, inst_type,
                           virt_type, host, vnic_type):
        """Get the domain config for a VIF

        :param instance: nova.objects.Instance
        :param vif: os_vif.objects.vif.VIFBase subclass
        :param image_meta: nova.objects.ImageMeta
        :param inst_type: nova.objects.Flavor
        :param virt_type: virtualization type
        :param host: nova.virt.libvirt.host.Host
        :param vnic_type: vnic type

        :returns: nova.virt.libvirt.config.LibvirtConfigGuestInterface
        """

        # Do the config that's common to all vif types
        conf = self.get_base_config(instance, vif.address, image_meta,
                                    inst_type, virt_type, vnic_type, host)

        # Do the VIF type specific config
        viffunc = "_set_config_" + vif.obj_name()
        func = getattr(self, viffunc, None)
        if not func:
            raise exception.InternalError(
                _("Unsupported VIF type %(obj)s func %(func)s") % {
                    'obj': vif.obj_name(),
                    'func': viffunc
                })
        func(instance, vif, conf, host)

        designer.set_vif_bandwidth_config(conf, inst_type)
        if ('network' in vif and 'mtu' in vif.network
                and self._has_min_version_for_mtu(host)):
            designer.set_vif_mtu_config(conf, vif.network.mtu)

        return conf