qemu: plug <teaming> config from <hostdev> into qemu commandline

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Laine Stump 2021-02-11 02:05:15 -05:00
parent db64acfbda
commit 010ed0856b
3 changed files with 53 additions and 5 deletions

View File

@ -4427,6 +4427,7 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def,
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
int backend = pcisrc->backend;
virDomainNetTeamingInfoPtr teaming;
/* caller has to assign proper passthrough backend type */
switch ((virDomainHostdevSubsysPCIBackendType)backend) {
@ -4461,11 +4462,15 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def,
if (qemuBuildRomStr(&buf, dev->info) < 0)
return NULL;
if (dev->parentnet && dev->parentnet->teaming &&
dev->parentnet->teaming->type == VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT &&
dev->parentnet->teaming->persistent) {
virBufferAsprintf(&buf, ",failover_pair_id=%s",
dev->parentnet->teaming->persistent);
if (dev->parentnet)
teaming = dev->parentnet->teaming;
else
teaming = dev->teaming;
if (teaming &&
teaming->type == VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT &&
teaming->persistent) {
virBufferAsprintf(&buf, ",failover_pair_id=%s", teaming->persistent);
}
return virBufferContentAndReset(&buf);

View File

@ -0,0 +1,40 @@
LC_ALL=C \
PATH=/bin \
HOME=/tmp/lib/domain--1-QEMUGuest1 \
USER=test \
LOGNAME=test \
XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu-system-i386 \
-name QEMUGuest1 \
-S \
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
-m 214 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-display none \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
server,nowait \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc \
-no-shutdown \
-no-acpi \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
-netdev user,id=hostua-backup0 \
-device virtio-net-pci,failover=on,netdev=hostua-backup0,id=ua-backup0,\
mac=00:11:22:33:44:55,bus=pci.0,addr=0x3 \
-netdev user,id=hostua-backup1 \
-device virtio-net-pci,failover=on,netdev=hostua-backup1,id=ua-backup1,\
mac=66:44:33:22:11:00,bus=pci.0,addr=0x4 \
-device vfio-pci,host=0000:03:07.1,id=hostdev0,bus=pci.0,addr=0x5,\
failover_pair_id=ua-backup0 \
-device vfio-pci,host=0000:03:07.2,id=hostdev1,bus=pci.0,addr=0x6,\
failover_pair_id=ua-backup1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7

View File

@ -1503,6 +1503,9 @@ mymain(void)
QEMU_CAPS_VIRTIO_NET_FAILOVER,
QEMU_CAPS_DEVICE_VFIO_PCI);
DO_TEST_PARSE_ERROR("net-virtio-teaming", NONE);
DO_TEST("net-virtio-teaming-hostdev",
QEMU_CAPS_VIRTIO_NET_FAILOVER,
QEMU_CAPS_DEVICE_VFIO_PCI);
DO_TEST("net-eth", NONE);
DO_TEST("net-eth-ifname", NONE);
DO_TEST("net-eth-names", NONE);