mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: ensure vhostuser FD is initialized to -1
The video private data was not initializing the vhostuser FD causing us to attempt to close FD 0 many times over. Fixes commit ca60ecfa8cc1bd85baf7137dd1864d5f00f019f0 Author: Marc-André Lureau <marcandre.lureau@redhat.com> Date: Mon Sep 23 14:44:36 2019 +0400 qemu: add qemuDomainVideoPrivate Since the test suite does not invoke qemuExtDevicesStart(), no vhost_user_fd will be present when generating test XML. To deal with this we can must a fake FD number. While the current XML is using FD == 0, we pick a very interesting number that's unlikely to be a real FD, so that we're more likely to see any mistakes closing the invalid FD. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
7a46bd5202
commit
227925a2e5
@ -1368,6 +1368,8 @@ qemuDomainVideoPrivateNew(void)
|
|||||||
if (!(priv = virObjectNew(qemuDomainVideoPrivateClass)))
|
if (!(priv = virObjectNew(qemuDomainVideoPrivateClass)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
priv->vhost_user_fd = -1;
|
||||||
|
|
||||||
return (virObjectPtr) priv;
|
return (virObjectPtr) priv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|||||||
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
||||||
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
-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 \
|
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
|
||||||
-chardev socket,id=chr-vu-video0,fd=0 \
|
-chardev socket,id=chr-vu-video0,fd=1729 \
|
||||||
-chardev socket,id=chr-vu-video1,fd=0 \
|
-chardev socket,id=chr-vu-video1,fd=1729 \
|
||||||
-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,\
|
-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,\
|
||||||
addr=0x2 \
|
addr=0x2 \
|
||||||
-device vhost-user-gpu-pci,id=video1,max_outputs=1,chardev=chr-vu-video1,\
|
-device vhost-user-gpu-pci,id=video1,max_outputs=1,chardev=chr-vu-video1,\
|
||||||
|
@ -31,7 +31,7 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
|
|||||||
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
||||||
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
-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 \
|
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
|
||||||
-chardev socket,id=chr-vu-video0,fd=0 \
|
-chardev socket,id=chr-vu-video0,fd=1729 \
|
||||||
-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,\
|
-device vhost-user-vga,id=video0,max_outputs=1,chardev=chr-vu-video0,bus=pci.0,\
|
||||||
addr=0x2 \
|
addr=0x2 \
|
||||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
|
||||||
|
@ -49,7 +49,7 @@ ats=on \
|
|||||||
ats=on \
|
ats=on \
|
||||||
-device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,\
|
-device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,\
|
||||||
addr=0x12,iommu_platform=on,ats=on \
|
addr=0x12,iommu_platform=on,ats=on \
|
||||||
-chardev socket,id=chr-vu-video0,fd=0 \
|
-chardev socket,id=chr-vu-video0,fd=1729 \
|
||||||
-device vhost-user-gpu-pci,id=video0,max_outputs=1,chardev=chr-vu-video0,\
|
-device vhost-user-gpu-pci,id=video0,max_outputs=1,chardev=chr-vu-video0,\
|
||||||
bus=pci.0,addr=0x2,iommu_platform=on,ats=on \
|
bus=pci.0,addr=0x2,iommu_platform=on,ats=on \
|
||||||
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,\
|
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,\
|
||||||
|
@ -528,6 +528,16 @@ testCompareXMLToArgv(const void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < vm->def->nvideos; i++) {
|
||||||
|
virDomainVideoDefPtr video = vm->def->videos[i];
|
||||||
|
|
||||||
|
if (video->backend == VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) {
|
||||||
|
qemuDomainVideoPrivatePtr vpriv = QEMU_DOMAIN_VIDEO_PRIVATE(video);
|
||||||
|
|
||||||
|
vpriv->vhost_user_fd = 1729;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & FLAG_SLIRP_HELPER) {
|
if (flags & FLAG_SLIRP_HELPER) {
|
||||||
for (i = 0; i < vm->def->nnets; i++) {
|
for (i = 0; i < vm->def->nnets; i++) {
|
||||||
virDomainNetDefPtr net = vm->def->nets[i];
|
virDomainNetDefPtr net = vm->def->nets[i];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user