1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

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 <laine@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Laine Stump 2019-09-27 11:47:21 -04:00
parent 9b1d53d417
commit 1b029a929d

View File

@ -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;
}