[gnome-boxes] vm-configurator: Replace user iface w/ bridge for existing domains
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] vm-configurator: Replace user iface w/ bridge for existing domains
- Date: Wed, 1 Oct 2014 20:56:53 +0000 (UTC)
commit b240bc9d518b5894bf965d58a91bc23152fff7b9
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Oct 1 18:51:49 2014 +0100
vm-configurator: Replace user iface w/ bridge for existing domains
While we update configuration of existing domains, lets also replace the
slow user network interface device with faster bridge device (if its
available).
src/vm-configurator.vala | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/vm-configurator.vala b/src/vm-configurator.vala
index 62af0ee..44d6db3 100644
--- a/src/vm-configurator.vala
+++ b/src/vm-configurator.vala
@@ -239,6 +239,27 @@ private class Boxes.VMConfigurator {
} catch (GLib.Error e) {
warning ("Failed to update CPU config for '%s': %s", domain.name, e.message);
}
+
+ if (!is_libvirt_bridge_net_available ())
+ return;
+
+ // First remove user interface device
+ GLib.List<GVirConfig.DomainDevice> devices = null;
+ DomainInterfaceUser iface = null;
+ foreach (var device in domain.get_devices ()) {
+ if (device is DomainInterfaceUser)
+ iface = device as DomainInterfaceUser;
+ else
+ devices.prepend (device);
+ }
+ devices.reverse ();
+ domain.set_devices (devices);
+
+ // If user interface device was found and removed, let's add bridge device now.
+ if (iface != null) {
+ var virtio = iface.get_model () == "virtio";
+ add_network_interface (domain, true, virtio);
+ }
}
private static void set_target_media_config (Domain domain, string target_path, InstallerMedia
install_media) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]