[gnome-boxes] libvirt-machine: Connect using FD if local



commit fb04e17a7dac24ecb14b2b0d252f025841cef075
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Nov 19 01:11:45 2014 +0000

    libvirt-machine: Connect using FD if local
    
    If its a local libvirt machine, connect to SPICE display using file
    descriptor. While the issue of spice connection being exposed to other
    local users is not resolved by this patch[1], it prepares Boxes for the
    real solution.
    
    [1] Currently libvirt+Qemu mandate specifying a TCP port for the SPICE
    display.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738573

 src/libvirt-machine.vala |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index f78e158..e49f3cb 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -61,7 +61,20 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         }
 
         if (update_display ()) {
-            display.connect_it ();
+            Display.OpenFDFunc? open_fd = null;
+
+            if (source.uri.has_prefix ("qemu+unix"))
+                open_fd = () => {
+                    try {
+                        return domain.open_graphics_fd (0, 0);
+                    } catch (GLib.Error error) {
+                        critical ("Failed to open graphics for %s: %s", name, error.message);
+
+                        return -1;
+                    }
+                };
+
+            display.connect_it (open_fd);
         } else {
             show_display ();
             display.set_enable_audio (true);


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