def set_vif_host_backend_802qbg_config(conf, devname, managerid, typeid,
    typeidversion, instanceid, tapname=None):
    """Populate a LibvirtConfigGuestInterface instance
    with host backend details for an 802.1qbg device.
    """
    conf.net_type = 'direct'
    conf.source_dev = devname
    conf.source_mode = 'vepa'
    conf.vporttype = '802.1Qbg'
    conf.add_vport_param('managerid', managerid)
    conf.add_vport_param('typeid', typeid)
    conf.add_vport_param('typeidversion', typeidversion)
    conf.add_vport_param('instanceid', instanceid)
    if tapname:
        conf.target_dev = tapname
