[gnome-boxes/dont-always-recreate-network-iface: 69/69] vm-configurator: Update network config only when necessary



commit 8a336ba05fc675d841ce7acbd53f063b4cbd628d
Author: Felipe Borges <felipeborges gnome org>
Date:   Tue Feb 13 16:30:01 2018 +0100

    vm-configurator: Update network config only when necessary
    
    Commit 30c2d638f has introduced a regression which causes the mac
    address of a domain to change every time Boxes starts.
    
    These changes create a new network interface only when the existing
    one is not already bridged.
    
    Fixes #158

 src/vm-configurator.vala | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 76994b65..e46e0536 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -257,7 +257,6 @@ public static async void update_existing_domain (Domain          domain,
             warning ("Failed to update CPU config for '%s': %s", domain.name, e.message);
         }
 
-        // First remove existing network interface device
         GLib.List<GVirConfig.DomainDevice> devices = null;
         DomainInterface iface = null;
         DomainGraphicsSpice graphics = null;
@@ -277,12 +276,16 @@ else if (device is DomainChannel) {
                 devices.prepend (device);
         }
 
-        // If user interface device was found and removed, let's add bridge device now.
+        // If user interface device was found and it needs to be bridged
         if (iface != null) {
             var bridge = is_libvirt_bridge_net_available ();
-            var virtio = iface.get_model () == "virtio";
+            if (bridge && (iface is DomainInterfaceUser)) {
+                var virtio = iface.get_model () == "virtio";
 
-            devices.prepend (create_network_interface (domain, bridge, virtio));
+                devices.prepend (create_network_interface (domain, bridge, virtio));
+            } else {
+                devices.prepend (iface);
+            }
         }
 
         if (graphics != null)


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