[gnome-boxes] Revert "libvirt-machine-props: Allow changing network iface"



commit 58e5c2951ff4355ca388be856783cd252d023a6c
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Dec 13 18:04:24 2013 +0000

    Revert "libvirt-machine-props: Allow changing network iface"
    
    This reverts commit b2128c245b0d58fb8cf22f21f8a0861aba2b0fa5.
    
    Turns out that bridge network setup through 'virbr0' interface actually
    means a NAT setup where guests are on a separate private (internal to
    host) network. This means that such a setup is as safe as 'user'
    networking and therefore providing the option to change between the two
    does not make much sense.
    
    It might make sense to allow settting up a proper bridge network against
    a particular interface in future though.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720399

 src/libvirt-machine-properties.vala |   39 -----------------------------------
 src/vm-configurator.vala            |   10 +--------
 2 files changed, 1 insertions(+), 48 deletions(-)
---
diff --git a/src/libvirt-machine-properties.vala b/src/libvirt-machine-properties.vala
index 01341f9..25d4933 100644
--- a/src/libvirt-machine-properties.vala
+++ b/src/libvirt-machine-properties.vala
@@ -53,18 +53,6 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
         notify_reboot_required ();
     }
 
-    private void try_change_network_interface (bool bridge, bool virtio) throws GLib.Error {
-        var config = machine.domain.get_config (GVir.DomainXMLFlags.INACTIVE);
-
-        VMConfigurator.remove_network_interface (config);
-        VMConfigurator.add_network_interface (config, bridge, virtio);
-
-        // This will take effect only after next reboot
-        machine.domain.set_config (config);
-        if (machine.is_on ())
-            notify_reboot_required ();
-    }
-
     private string collect_logs () {
         var builder = new StringBuilder ();
 
@@ -217,8 +205,6 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
 
             bool has_usb_redir = false;
             bool has_smartcard = false;
-            bool bridge_net = false;
-            bool virtio_net = false;
             // We look at the INACTIVE config here, because we want to show the usb
             // widgetry if usb has been added already but we have not rebooted
             try {
@@ -230,12 +216,6 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
                     if (device is GVirConfig.DomainSmartcard) {
                         has_smartcard = true;
                     }
-                    if (device is GVirConfig.DomainInterfaceBridge) {
-                        bridge_net = true;
-                    }
-                    if (device is GVirConfig.DomainInterface) {
-                        virtio_net = (device as GVirConfig.DomainInterface).get_model () == "virtio";
-                    }
                 }
             } catch (GLib.Error error) {
                 warning ("Failed to fetch configuration for domain '%s': %s", machine.domain.get_name (), 
error.message);
@@ -278,25 +258,6 @@ private class Boxes.LibvirtMachineProperties: GLib.Object, Boxes.IPropertiesProv
                 });
             }
 
-            var combo = new Gtk.ComboBoxText ();
-            combo.halign = Gtk.Align.START;
-            combo.insert_text (0, _("Fastest"));
-            combo.insert_text (1, _("Most secure"));
-            combo.active = bridge_net? 0 : 1;
-            add_property (ref list, _("Network"), combo);
-            if (!bridge_net && !is_libvirt_bridge_net_available ())
-                combo.sensitive = false;
-            else {
-                combo.changed.connect (() => {
-                    try {
-                        try_change_network_interface (combo.get_active() == 0, virtio_net);
-                        machine.update_domain_config ();
-                    } catch (GLib.Error error) {
-                        warning ("Failed to change network interface");
-                    }
-                });
-            }
-
             break;
         }
 
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 5f8c8d4..5b5fcba 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -431,17 +431,9 @@ private class Boxes.VMConfigurator {
 
     // Remove all existing usb controllers. This is used when upgrading from the old usb1 controllers to usb2
     public static void remove_usb_controllers (Domain domain) throws Boxes.Error {
-        remove_device_by_type (domain, typeof (DomainControllerUsb));
-    }
-
-    public static void remove_network_interface (Domain domain) throws Boxes.Error {
-        remove_device_by_type (domain, typeof (DomainInterface));
-    }
-
-    public static void remove_device_by_type (Domain domain, Type type) throws Boxes.Error {
         GLib.List<GVirConfig.DomainDevice> devices = null;
         foreach (var device in domain.get_devices ()) {
-            if (!(device.get_type ().is_a (type))) {
+            if (!(device is DomainControllerUsb)) {
                 devices.prepend (device);
             }
         }


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