• L
    conf: parse/format type='hostdev' network interfaces · 3b1c191f
    Laine Stump 提交于
    This is the new interface type that sets up an SR-IOV PCI network
    device to be assigned to the guest with PCI passthrough after
    initializing some network device-specific things from the config
    (e.g. MAC address, virtualport profile parameters). Here is an example
    of the syntax:
    
      <interface type='hostdev' managed='yes'>
        <source>
          <address type='pci' domain='0' bus='0' slot='4' function='3'/>
        </source>
        <mac address='00:11:22:33:44:55'/>
        <address type='pci' domain='0' bus='0' slot='7' function='0'/>
      </interface>
    
    This would assign the PCI card from bus 0 slot 4 function 3 on the
    host, to bus 0 slot 7 function 0 on the guest, but would first set the
    MAC address of the card to 00:11:22:33:44:55.
    
    NB: The parser and formatter don't care if the PCI card being
    specified is a standard single function network adapter, or a virtual
    function (VF) of an SR-IOV capable network adapter, but the upcoming
    code that implements the back end of this config will work *only* with
    SR-IOV VFs. This is because modifying the mac address of a standard
    network adapter prior to assigning it to a guest is pointless - part
    of the device reset that occurs during that process will reset the MAC
    address to the value programmed into the card's firmware.
    
    Although it's not supported by any of libvirt's hypervisor drivers,
    usb network hostdevs are also supported in the parser and formatter
    for completeness and consistency. <source> syntax is identical to that
    for plain <hostdev> devices, except that the <address> element should
    have "type='usb'" added if bus/device are specified:
    
      <interface type='hostdev'>
        <source>
          <address type='usb' bus='0' device='4'/>
        </source>
        <mac address='00:11:22:33:44:55'/>
      </interface>
    
    If the vendor/product form of usb specification is used, type='usb'
    is implied:
    
      <interface type='hostdev'>
        <source>
          <vendor id='0x0012'/>
          <product id='0x24dd'/>
        </source>
        <mac address='00:11:22:33:44:55'/>
      </interface>
    
    Again, the upcoming patch to fill in the backend of this functionality
    will log an error and fail with "Unsupported Config" if you actually
    try to assign a USB network adapter to a guest using <interface
    type='hostdev'> - just use a standard <hostdev> entry in that case
    (and also for single-port PCI adapters).
    3b1c191f
uml_conf.c 14.5 KB