[PATCH 1/2] virsh: Accept iface alias for domifstats too

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=1459091

Not every interface has a name (for instance, vhostuser
interfaces might not have one). However, all interfaces have
aliases. We can accept those to uniquely identify interfaces.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c       | 6 ++++--
 tools/virsh-domain-monitor.c | 3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f0cdea659..0634d9e5a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10753,8 +10753,10 @@ qemuDomainInterfaceStats(virDomainPtr dom,
 
     /* Check the path is one of the domain's network interfaces. */
     for (i = 0; i < vm->def->nnets; i++) {
-        if (STREQ_NULLABLE(vm->def->nets[i]->ifname, path)) {
-            net = vm->def->nets[i];
+        virDomainNetDefPtr tmp = vm->def->nets[i];
+        if (STREQ_NULLABLE(tmp->ifname, path) ||
+            STREQ(tmp->info.alias, path)) {
+            net = tmp;
             break;
         }
     }
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 0ca53e438..313a6d2f0 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -614,7 +614,8 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd)
                                 "|./source/@network"
                                 "|./source/@name)", ctxt);
 
-        target = virXPathString("string(./target/@dev)", ctxt);
+        target = virXPathString("string(./target/@dev"
+                                "|./alias/@name)", ctxt);
         model = virXPathString("string(./model/@type)", ctxt);
         mac = virXPathString("string(./mac/@address)", ctxt);
 
-- 
2.13.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux