#include "virdevmapper.h"
#include <fcntl.h>
+#include "testutils.h"
+
#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
#include "qemu/qemu_monitor_priv.h"
}
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));
}
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 *
-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"}' \
-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"}' \