From 1b029a929d09904485fba0c9778f6da9abf37158 Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Fri, 27 Sep 2019 11:47:21 -0400 Subject: [PATCH] qemu: add mac address to error messages in qemuDomainValidateActualNetDef This makes it easier to understand which interface's config caused the error. Signed-off-by: Laine Stump Reviewed-by: Cole Robinson --- src/qemu/qemu_domain.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a1d8dca512..5db950c4fc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5456,8 +5456,11 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net, * time), but only if the validations would SUCCEED for * type='network'.) */ + char macstr[VIR_MAC_STRING_BUFLEN]; virDomainNetType actualType = virDomainNetGetActualType(net); + virMacAddrFormat(&net->mac, macstr); + /* Only tap/macvtap devices support multiqueue. */ if (net->driver.virtio.queues > 0) { @@ -5467,17 +5470,17 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net, actualType == VIR_DOMAIN_NET_TYPE_ETHERNET || actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("multiqueue network is not supported for: %s"), - virDomainNetTypeToString(actualType)); + _("interface %s - multiqueue is not supported for network interfaces of type %s"), + macstr, virDomainNetTypeToString(actualType)); return -1; } if (net->driver.virtio.queues > 1 && actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("multiqueue network is not supported for vhost-user " - "with this QEMU binary")); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("interface %s - multiqueue is not supported for network interfaces of type vhost-user with this QEMU binary"), + macstr); return -1; } } @@ -5489,21 +5492,20 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net, */ if (net->filter) { virNetDevVPortProfilePtr vport = virDomainNetGetActualVirtPortProfile(net); + if (!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK || actualType == VIR_DOMAIN_NET_TYPE_BRIDGE || actualType == VIR_DOMAIN_NET_TYPE_ETHERNET)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("filterref is not supported for " - "network interfaces of type %s"), - virDomainNetTypeToString(actualType)); + _("interface %s - filterref is not supported for network interfaces of type %s"), + macstr, virDomainNetTypeToString(actualType)); return -1; } if (vport && vport->virtPortType != VIR_NETDEV_VPORT_PROFILE_NONE) { /* currently none of the defined virtualport types support iptables */ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("filterref is not supported for " - "network interfaces with virtualport type %s"), - virNetDevVPortTypeToString(vport->virtPortType)); + _("interface %s - filterref is not supported for network interfaces with virtualport type %s"), + macstr, virNetDevVPortTypeToString(vport->virtPortType)); return -1; } } @@ -5513,8 +5515,8 @@ qemuDomainValidateActualNetDef(const virDomainNetDef *net, actualType == VIR_DOMAIN_NET_TYPE_BRIDGE || actualType == VIR_DOMAIN_NET_TYPE_ETHERNET)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Custom tap device path is not supported for: %s"), - virDomainNetTypeToString(actualType)); + _("interface %s - custom tap device path is not supported for network interfaces of type %s"), + macstr, virDomainNetTypeToString(actualType)); return -1; }