]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainInterfaceStats: Check for the actual type of interface
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 2 Oct 2017 11:12:43 +0000 (13:12 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 5 Oct 2017 07:16:05 +0000 (09:16 +0200)
Users might have configured interface so that it's type of
network, but the corresponding network plugs interfaces into an
OVS bridge. Therefore, we have to check for the actual type of
the interface instead of the configured one.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_driver.c

index 4855c9047dfbbdeaf4aaf716ce3a18c12ca83fc4..2c8ea19e30019a710aaf33f1fde6804d5a75c1e8 100644 (file)
@@ -11045,7 +11045,7 @@ qemuDomainInterfaceStats(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
+    if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
         if (virNetDevOpenvswitchInterfaceStats(path, stats) < 0)
             goto cleanup;
     } else {
@@ -19568,15 +19568,19 @@ qemuDomainGetStatsInterface(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
     /* Check the path is one of the domain's network interfaces. */
     for (i = 0; i < dom->def->nnets; i++) {
+        virDomainNetType actualType;
+
         if (!dom->def->nets[i]->ifname)
             continue;
 
         memset(&tmp, 0, sizeof(tmp));
 
+        actualType = virDomainNetGetActualType(dom->def->nets[i]);
+
         QEMU_ADD_NAME_PARAM(record, maxparams,
                             "net", "name", i, dom->def->nets[i]->ifname);
 
-        if (dom->def->nets[i]->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
+        if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
             if (virNetDevOpenvswitchInterfaceStats(dom->def->nets[i]->ifname,
                                                    &tmp) < 0) {
                 virResetLastError();