Now that we have a capability for each domain net backend we can start validating user's selection against QEMU capabilities. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/qemu/qemu_validate.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index b392428f48..23d642c1ce 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1705,11 +1705,27 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net, size_t i; if (net->type == VIR_DOMAIN_NET_TYPE_USER) { - if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the passt network backend is not supported with this QEMU binary")); - return -1; + switch (net->backend.type) { + case VIR_DOMAIN_NET_BACKEND_DEFAULT: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_USER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("the '%1$s' network backend is not supported with this QEMU binary"), + virDomainNetBackendTypeToString(net->backend.type)); + return -1; + } + break; + + case VIR_DOMAIN_NET_BACKEND_PASST: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_STREAM)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("the '%1$s' network backend is not supported with this QEMU binary"), + virDomainNetBackendTypeToString(net->backend.type)); + return -1; + } + break; + + case VIR_DOMAIN_NET_BACKEND_LAST: + break; } if (net->guestIP.nroutes) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- 2.44.2