• L
    qemu: add bootindex option to hostdev network interface commandline · a8e3247e
    Laine Stump 提交于
    when appropriate, of course. If the config for a domain specifies boot
    order with <boot dev='blah'/> elements, e.g.:
    
         <os>
           ...
           <boot dev='hd'/>
           <boot dev='network'/>
         </os>
    
    Then the first disk device in the config will have ",bootindex=1"
    appended to its qemu commandline -device options, and the first (and
    *only* the first) network interface device will get ",bootindex=2".
    
    However, if the first network interface device is a "hostdev" device
    (an SRIOV Virtual Function (VF) being assigned to the domain with
    vfio), then the bootindex option will *not* be appended. This happens
    because the bootindex=n option corresponding to the order of "<boot
    dev='network'/>" is added to the -device for the first network device
    when network device commandline args are constructed, but if it's a
    hostdev network device, its commandline arg is instead constructed in
    the loop for hostdevs.
    
    This patch fixes that omission by noticing (in bootHostdevNet) if the
    first network device was a hostdev, and if so passing on the proper
    bootindex to the commandline generator for hostdev devices - the
    result is that ",bootindex=2" will be properly appended to the first
    "network" device in the config even if it is really a hostdev
    (including if it is assigned from a libvirt network pool). (note that
    this is only the case if there is no <bootmenu enabled='yes'/> element
    in the config ("-boot menu-on" in qemu) , since the two are mutually
    exclusive - when the bootmenu is enabled, the individual per-device
    bootindex options can't be used by qemu, and we revert to using "-boot
    order=xyz" instead).
    
    If a greater level of control over boot order is desired (e.g., more
    than one network device should be tried, or a network device other
    than the first one encountered in the config), then <boot
    dev='network'/> in the <os> element should not be used; instead, the
    individual device elements in the config should be given a "<boot
    order='n'/>
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1278421
    a8e3247e
qemu_hotplug.c 145.6 KB