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

Michal Privoznik posted 7 patches 7 years, 7 months ago
[libvirt] [PATCH 2/7] qemuDomainInterfaceStats: Check for the actual type of interface
Posted by Michal Privoznik 7 years, 7 months ago
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>
---
 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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/7] qemuDomainInterfaceStats: Check for the actual type of interface
Posted by John Ferlan 7 years, 7 months ago

On 10/02/2017 11:05 AM, Michal Privoznik wrote:
> 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>
> ---
>  src/qemu/qemu_driver.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list