]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: add mac address to error messages in qemuDomainValidateActualNetDef
authorLaine Stump <laine@redhat.com>
Fri, 27 Sep 2019 15:47:21 +0000 (11:47 -0400)
committerLaine Stump <laine@redhat.com>
Mon, 25 Nov 2019 20:29:41 +0000 (15:29 -0500)
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>
src/qemu/qemu_domain.c

index a1d8dca5125bebf1f78236fd410a33205abbefed..5db950c4fc66874baba2d9a65a3ecc82fa3e5c8a 100644 (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;
     }