]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
qemu: fix ifindex array reported to systemd
authorLaine Stump <laine@laine.org>
Fri, 20 Feb 2015 19:52:37 +0000 (14:52 -0500)
committerLaine Stump <laine@laine.org>
Wed, 25 Feb 2015 18:11:14 +0000 (13:11 -0500)
commit4bbe1029f2fb6cd1c102794951a944c62fdbd0e6
tree994ae4f3f567148b92d437a5df192486658815ce
parent153b06c6d14f00e9f63e25712b34f3f918f41dff
qemu: fix ifindex array reported to systemd

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().
src/qemu/qemu_command.c
src/qemu/qemu_command.h
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
tests/qemuxml2argvtest.c
tests/qemuxmlnstest.c