mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
qemuxmlconftest: (consistently) use real FDs in tests for VDPA netdevs
Use virTestMakeDummyFD() to get a real FD for the test in qemuxmlconftest. Use virTestMakeDummyFD() also in qemuhotplugmock. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
1 parent
45d2ce9012
commit
b28c8cbbb8
4 files changed
+8
-9
No files matched your search
@@ -26,6 +26,8 @@
|
||||
#include "virdevmapper.h"
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "testutils.h"
|
||||
|
||||
#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
|
||||
#include "qemu/qemu_monitor_priv.h"
|
||||
|
||||
@@ -71,10 +73,9 @@ qemuProcessKillManagedPRDaemon(virDomainObj *vm G_GNUC_UNUSED)
|
||||
}
|
||||
|
||||
int
|
||||
qemuVDPAConnect(const char *devicepath G_GNUC_UNUSED)
|
||||
qemuVDPAConnect(const char *devicepath)
|
||||
{
|
||||
/* need a valid fd or sendmsg won't work. Just open /dev/null */
|
||||
return open("/dev/null", O_RDONLY);
|
||||
return virTestMakeDummyFD(g_strdup_printf("@vdpa-%s-fd@", devicepath));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -266,11 +266,9 @@ virNetDevBandwidthSetRootQDisc(const char *ifname G_GNUC_UNUSED,
|
||||
|
||||
|
||||
int
|
||||
qemuVDPAConnect(const char *devicepath G_GNUC_UNUSED)
|
||||
qemuVDPAConnect(const char *devicepath)
|
||||
{
|
||||
if (fcntl(1732, F_GETFD) != -1)
|
||||
abort();
|
||||
return 1732;
|
||||
return virTestMakeDummyFD(g_strdup_printf("@vdpa-%s-fd@", devicepath));
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
@@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
|
||||
-no-shutdown \
|
||||
-boot strict=on \
|
||||
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
|
||||
-add-fd set=0,fd=XXXXXXX,opaque=net0-vdpa \
|
||||
-add-fd set=0,fd=@vdpa-/dev/vhost-vdpa-0-fd@,opaque=net0-vdpa \
|
||||
-netdev '{"type":"vhost-vdpa","vhostdev":"/dev/fdset/0","queues":2,"id":"hostnet0"}' \
|
||||
-device '{"driver":"virtio-net-pci","mq":true,"vectors":6,"netdev":"hostnet0","id":"net0","mac":"52:54:00:95:db:c0","bus":"pci.0","addr":"0x2"}' \
|
||||
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||
|
||||
@@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
|
||||
-no-shutdown \
|
||||
-boot strict=on \
|
||||
-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
|
||||
-add-fd set=0,fd=XXXXXXX,opaque=net0-vdpa \
|
||||
-add-fd set=0,fd=@vdpa-/dev/vhost-vdpa-0-fd@,opaque=net0-vdpa \
|
||||
-netdev '{"type":"vhost-vdpa","vhostdev":"/dev/fdset/0","id":"hostnet0"}' \
|
||||
-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:95:db:c0","bus":"pci.0","addr":"0x2"}' \
|
||||
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||
|
||||
Reference in new issue
Block a user