From: Peter Krempa <pkrempa@redhat.com> qemu is going to deprecate the 'fd' and 'vhostfd' options of 'tap' netdev. While the current guidance is to use the plural 'fds' and 'vhostfds' even when one FD is used, this doesn't apply cleanly on older versions. Add capability QEMU_CAPS_NETDEV_TAP_FD_VHOSTFD_PLURAL which is detected if 'vhostfd' is deprecated or completely missing to switch to the new behaviour only conditionally. Currently there's no caps dump showing this because it'd at the same time break test validation due to use of deprecated fields. Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_capabilities.c | 8 ++++++++ src/qemu/qemu_capabilities.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f456e8a378..bf73b083b3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -755,6 +755,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "disk-timed-stats", /* QEMU_CAPS_DISK_TIMED_STATS */ "query-accelerators", /* QEMU_CAPS_QUERY_ACCELERATORS */ "mshv", /* QEMU_CAPS_MSHV */ + "netdev.tap.use.fd.vhostfd.plural", /* QEMU_CAPS_NETDEV_TAP_FD_VHOSTFD_PLURAL */ ); @@ -5874,6 +5875,13 @@ virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCaps *qemuCaps, virQEMUQAPISchemaPathExists("block-stream/arg-type/backing-mask-protocol", schema)) virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_BACKING_MASK_PROTOCOL); + /* QEMU-11.0 deprecated use of 'fd' and 'vhostfd' for TAP netdevs but the + * replacement ('fds', 'vhostfds' for one FD) doesn't reliably work in + * all versions which support the attributes. Detect deprecation or absence. */ + if (virQEMUQAPISchemaPathExists("netdev_add/arg-type/+tap/vhostfd/$deprecated", schema) || + !virQEMUQAPISchemaPathExists("netdev_add/arg-type/+tap/vhostfd", schema)) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_TAP_FD_VHOSTFD_PLURAL); + return 0; } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index f180844e66..22318c769c 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -730,6 +730,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_DISK_TIMED_STATS, /* timed stats support ('stats-intervals' property of disk frontends) */ QEMU_CAPS_QUERY_ACCELERATORS, /* query-accelerators command */ QEMU_CAPS_MSHV, /* -accel mshv */ + QEMU_CAPS_NETDEV_TAP_FD_VHOSTFD_PLURAL, /* use 'fds' and 'vhostfds' also for 1 fd 'tap' in -netdev */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; -- 2.53.0