From 98eabee0a1f6ceeeceebdd4fe41e660dbdf53d8a Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 2 Oct 2017 13:12:43 +0200 Subject: [PATCH] qemuDomainInterfaceStats: Check for the actual type of interface 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 Reviewed-by: John Ferlan --- 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 4855c9047d..2c8ea19e30 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(); -- GitLab