[gnome-boxes] Avoid blocking call in network stats



commit 7ca05e7f79d5f1bac3ee5eae1ff105379da3c2b9
Author: Alexander Larsson <alexl redhat com>
Date:   Wed May 2 17:05:44 2012 +0200

    Avoid blocking call in network stats
    
    domain.get_devices () does a blocking get_config() call, but we already have a
    copy of the config. Use that instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675663

 src/libvirt-machine.vala |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 80df148..81806c5 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -403,10 +403,9 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         var net = null as GVir.DomainInterface;
 
         // FiXME: We currently only entertain one network interface
-        foreach (var device in domain.get_devices ()) {
-            if (device is GVir.DomainInterface) {
-                net = device as GVir.DomainInterface;
-
+        foreach (var device_config in domain_config.get_devices ()) {
+            if (device_config is GVirConfig.DomainInterface) {
+                net = Object.new (typeof (GVir.DomainInterface), "domain", domain, "config", device_config) as GVir.DomainInterface;
                 break;
             }
         }



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