• L
    qemu: fix ifindex array reported to systemd · 4bbe1029
    Laine Stump 提交于
    Commit f7afeddc added code to report to systemd an array of interface
    indexes for all tap devices used by a guest. Unfortunately it not only
    didn't add code to report the ifindexes for macvtap interfaces
    (interface type='direct') or the tap devices used by type='ethernet',
    it ended up sending "-1" as the ifindex for each macvtap or hostdev
    interface. This resulted in a failure to start any domain that had a
    macvtap or hostdev interface (or actually any type other than
    "network" or "bridge").
    
    This patch does the following with the nicindexes array:
    
    1) Modify qemuBuildInterfaceCommandLine() to only fill in the
    nicindexes array if given a non-NULL pointer to an array (and modifies
    the test jig calls to the function to send NULL). This is because
    there are tests in the test suite that have type='ethernet' and still
    have an ifname specified, but that device of course doesn't actually
    exist on the test system, so attempts to call virNetDevGetIndex() will
    fail.
    
    2) Even then, only add an entry to the nicindexes array for
    appropriate types, and to do so for all appropriate types ("network",
    "bridge", and "direct"), but only if the ifname is known (since that
    is required to call virNetDevGetIndex().
    4bbe1029
qemu_command.c 451.5 KB