[libvirt] [PATCH 2/7] qemuDomainInterfaceStats: Check for the actual type of interface

Michal Privoznik mprivozn at redhat.com
Mon Oct 2 15:05:12 UTC 2017


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 at redhat.com>
---
 src/qemu/qemu_driver.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4855c9047..2c8ea19e3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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();
-- 
2.13.5




More information about the libvir-list mailing list